Commit 42f620ae authored by Boris Burkov's avatar Boris Burkov Committed by David Sterba

btrfs: store fs_info in space_info

This is handy when computing space_info dynamic reclaim thresholds where
we do not have access to a block group. We could add it to the various
functions as a parameter, but it seems reasonable for space_info to have
an fs_info pointer.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarBoris Burkov <boris@bur.io>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 243192b6
...@@ -232,6 +232,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags) ...@@ -232,6 +232,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags)
if (!space_info) if (!space_info)
return -ENOMEM; return -ENOMEM;
space_info->fs_info = info;
for (i = 0; i < BTRFS_NR_RAID_TYPES; i++) for (i = 0; i < BTRFS_NR_RAID_TYPES; i++)
INIT_LIST_HEAD(&space_info->block_groups[i]); INIT_LIST_HEAD(&space_info->block_groups[i]);
init_rwsem(&space_info->groups_sem); init_rwsem(&space_info->groups_sem);
......
...@@ -94,6 +94,7 @@ enum btrfs_flush_state { ...@@ -94,6 +94,7 @@ enum btrfs_flush_state {
}; };
struct btrfs_space_info { struct btrfs_space_info {
struct btrfs_fs_info *fs_info;
spinlock_t lock; spinlock_t lock;
u64 total_bytes; /* total bytes in the space, u64 total_bytes; /* total bytes in the space,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment