Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: split btrfs_fs_closing() and change return type to bool

There are two tests in btrfs_fs_closing() but checking the
BTRFS_FS_CLOSING_DONE bit is done only in one place
load_extent_tree_free(). As this is an inline we can reduce size of the
generated code. The types can be also changed to bool as this becomes a
simple condition.

text data bss dec hex filename
1674006 146704 15560 1836270 1c04ee pre/btrfs.ko
1673772 146704 15560 1836036 1c0404 post/btrfs.ko

DELTA: -234

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

+11 -9
+1 -1
fs/btrfs/block-group.c
··· 761 761 nritems = btrfs_header_nritems(leaf); 762 762 763 763 while (1) { 764 - if (btrfs_fs_closing(fs_info) > 1) { 764 + if (btrfs_fs_closing_done(fs_info)) { 765 765 last = (u64)-1; 766 766 break; 767 767 }
+10 -8
fs/btrfs/fs.h
··· 1118 1118 #define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \ 1119 1119 BTRFS_MOUNT_##opt) 1120 1120 1121 - static inline int btrfs_fs_closing(const struct btrfs_fs_info *fs_info) 1121 + static inline bool btrfs_fs_closing(const struct btrfs_fs_info *fs_info) 1122 1122 { 1123 - /* Do it this way so we only ever do one test_bit in the normal case. */ 1124 - if (test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)) { 1125 - if (test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags)) 1126 - return 2; 1127 - return 1; 1128 - } 1129 - return 0; 1123 + return unlikely(test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)); 1124 + } 1125 + 1126 + static inline bool btrfs_fs_closing_done(const struct btrfs_fs_info *fs_info) 1127 + { 1128 + if (btrfs_fs_closing(fs_info) && test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags)) 1129 + return true; 1130 + 1131 + return false; 1130 1132 } 1131 1133 1132 1134 /*