mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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>
This commit is contained in:
@@ -761,7 +761,7 @@ next:
|
||||
nritems = btrfs_header_nritems(leaf);
|
||||
|
||||
while (1) {
|
||||
if (btrfs_fs_closing(fs_info) > 1) {
|
||||
if (btrfs_fs_closing_done(fs_info)) {
|
||||
last = (u64)-1;
|
||||
break;
|
||||
}
|
||||
|
||||
+10
-8
@@ -1118,15 +1118,17 @@ void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag,
|
||||
#define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \
|
||||
BTRFS_MOUNT_##opt)
|
||||
|
||||
static inline int btrfs_fs_closing(const struct btrfs_fs_info *fs_info)
|
||||
static inline bool btrfs_fs_closing(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
/* Do it this way so we only ever do one test_bit in the normal case. */
|
||||
if (test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags)) {
|
||||
if (test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags))
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return unlikely(test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags));
|
||||
}
|
||||
|
||||
static inline bool btrfs_fs_closing_done(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
if (btrfs_fs_closing(fs_info) && test_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user