Skip to content

Commit f95380a

Browse files
fdmananakdave
authored andcommitted
btrfs: split btrfs_is_fsstree() into multiple if statements for readability
Instead of a single if statement with multiple conditions, split it into several if statements testing only one condition at a time and return true or false immediately after. This makes it more immediate to reason. The module's text size also slightly decreases, at least with gcc 14.2.0 on x86_64. Before: $ size fs/btrfs/btrfs.ko text data bss dec hex filename 1897138 161583 16136 2074857 1fa8e9 fs/btrfs/btrfs.ko After: $ size fs/btrfs/btrfs.ko text data bss dec hex filename 1896976 161583 16136 2074695 1fa847 fs/btrfs/btrfs.ko Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent fc64e7b commit f95380a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

fs/btrfs/ctree.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,16 @@ int btrfs_leaf_free_space(const struct extent_buffer *leaf);
723723

724724
static inline bool btrfs_is_fstree(u64 rootid)
725725
{
726-
if (rootid == BTRFS_FS_TREE_OBJECTID ||
727-
((s64)rootid >= (s64)BTRFS_FIRST_FREE_OBJECTID &&
728-
!btrfs_qgroup_level(rootid)))
726+
if (rootid == BTRFS_FS_TREE_OBJECTID)
729727
return true;
730-
return false;
728+
729+
if ((s64)rootid < (s64)BTRFS_FIRST_FREE_OBJECTID)
730+
return false;
731+
732+
if (btrfs_qgroup_level(rootid) != 0)
733+
return false;
734+
735+
return true;
731736
}
732737

733738
static inline bool btrfs_is_data_reloc_root(const struct btrfs_root *root)

0 commit comments

Comments
 (0)