btrfs: root->fs_info cleanup, add fs_info convenience variables
In routines where someptr->fs_info is referenced multiple times, we introduce a convenience variable. This makes the code considerably more readable. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
6202df6921
commit
0b246afa62
@@ -1352,9 +1352,11 @@ static inline int
|
||||
btrfs_should_fragment_free_space(struct btrfs_root *root,
|
||||
struct btrfs_block_group_cache *block_group)
|
||||
{
|
||||
return (btrfs_test_opt(root->fs_info, FRAGMENT_METADATA) &&
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
|
||||
return (btrfs_test_opt(fs_info, FRAGMENT_METADATA) &&
|
||||
block_group->flags & BTRFS_BLOCK_GROUP_METADATA) ||
|
||||
(btrfs_test_opt(root->fs_info, FRAGMENT_DATA) &&
|
||||
(btrfs_test_opt(fs_info, FRAGMENT_DATA) &&
|
||||
block_group->flags & BTRFS_BLOCK_GROUP_DATA);
|
||||
}
|
||||
#endif
|
||||
@@ -2312,10 +2314,11 @@ static inline unsigned long btrfs_leaf_data(struct extent_buffer *l)
|
||||
static inline unsigned int leaf_data_end(struct btrfs_root *root,
|
||||
struct extent_buffer *leaf)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
u32 nr = btrfs_header_nritems(leaf);
|
||||
|
||||
if (nr == 0)
|
||||
return BTRFS_LEAF_DATA_SIZE(root->fs_info);
|
||||
return BTRFS_LEAF_DATA_SIZE(fs_info);
|
||||
return btrfs_item_offset_nr(leaf, nr - 1);
|
||||
}
|
||||
|
||||
@@ -2905,8 +2908,9 @@ static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
|
||||
*/
|
||||
static inline int btrfs_need_cleaner_sleep(struct btrfs_root *root)
|
||||
{
|
||||
return (root->fs_info->sb->s_flags & MS_RDONLY ||
|
||||
btrfs_fs_closing(root->fs_info));
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
|
||||
return (fs_info->sb->s_flags & MS_RDONLY || btrfs_fs_closing(fs_info));
|
||||
}
|
||||
|
||||
static inline void free_fs_info(struct btrfs_fs_info *fs_info)
|
||||
|
Reference in New Issue
Block a user