summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2022-11-01 16:15:43 +0000
committerDavid Sterba <dsterba@suse.com>2022-12-05 18:00:49 +0100
commit344174a1a68a55599d3a264db47d96583ff66473 (patch)
tree4668a3a2d3fcb362cde80880360c7d1ebf503ae8 /fs/btrfs/send.c
parentd3f41317f0fedac6b0a3de68b3dab66b71923dd8 (diff)
downloadlinux-344174a1a68a55599d3a264db47d96583ff66473.tar.gz
linux-344174a1a68a55599d3a264db47d96583ff66473.tar.bz2
linux-344174a1a68a55599d3a264db47d96583ff66473.zip
btrfs: send: drop unnecessary backref context field initializations
At find_extent_clone() we are initializing to zero the 'found_itself' and 'found' fields of the backref context before we use it but we have already initialized the structure to zeroes when we declared it on stack, so it's pointless to initialize those fields and they are unnecessarily increasing the object text size with two "mov" instructions (x86_64). Similarly make the 'extent_len' initialization more clear by using an if- -then-else instead of a double assignment to it in case the extent's end crosses the i_size boundary. Before this change: $ size fs/btrfs/send.o text data bss dec hex filename 68694 4252 16 72962 11d02 fs/btrfs/send.o After this change: $ size fs/btrfs/send.o text data bss dec hex filename 68678 4252 16 72946 11cf2 fs/btrfs/send.o Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 4ce5c154f6d7..7d289bdc6de1 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1432,11 +1432,8 @@ static int find_extent_clone(struct send_ctx *sctx,
}
backref_ctx.sctx = sctx;
- backref_ctx.found = 0;
backref_ctx.cur_objectid = ino;
backref_ctx.cur_offset = data_offset;
- backref_ctx.found_itself = 0;
- backref_ctx.extent_len = num_bytes;
/*
* The last extent of a file may be too large due to page alignment.
@@ -1445,6 +1442,8 @@ static int find_extent_clone(struct send_ctx *sctx,
*/
if (data_offset + num_bytes >= ino_size)
backref_ctx.extent_len = ino_size - data_offset;
+ else
+ backref_ctx.extent_len = num_bytes;
/*
* Now collect all backrefs.