Skip to content

Commit c26634e

Browse files
fdmananakdave
authored andcommitted
btrfs: avoid double slot decrement at btrfs_convert_free_space_to_extents()
There's no need to subtract 1 from path->slots[0] and then decrement the slot, we can reduce the generated assembly code by decrementing the slot and then use it. Module size before: $ size fs/btrfs/btrfs.ko text data bss dec hex filename 1846220 162998 16136 2025354 1ee78a fs/btrfs/btrfs.ko Module size after: $ size fs/btrfs/btrfs.ko text data bss dec hex filename 1846204 162998 16136 2025338 1ee77a fs/btrfs/btrfs.ko Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 579f4a1 commit c26634e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/btrfs/free-space-tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,12 @@ int btrfs_convert_free_space_to_extents(struct btrfs_trans_handle *trans,
406406
data_size = free_space_bitmap_size(fs_info,
407407
found_key.offset);
408408

409-
ptr = btrfs_item_ptr_offset(leaf, path->slots[0] - 1);
409+
path->slots[0]--;
410+
ptr = btrfs_item_ptr_offset(leaf, path->slots[0]);
410411
read_extent_buffer(leaf, bitmap_cursor, ptr,
411412
data_size);
412413

413414
nr++;
414-
path->slots[0]--;
415415
} else {
416416
ASSERT(0);
417417
}

0 commit comments

Comments
 (0)