Commit 364be842 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: change name and type of private member of btrfs_free_space_ctl

btrfs_free_space_ctl::private is either unset or it always points to
struct btrfs_block_group when it is set. So there's no point in keeping
the unhelpful 'private' name and keeping it an untyped pointer. Change
both the type and name to be self-describing. No functional changes.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 290ef19a
...@@ -666,7 +666,7 @@ static int io_ctl_read_bitmap(struct btrfs_io_ctl *io_ctl, ...@@ -666,7 +666,7 @@ static int io_ctl_read_bitmap(struct btrfs_io_ctl *io_ctl,
static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl)
{ {
struct btrfs_block_group *block_group = ctl->private; struct btrfs_block_group *block_group = ctl->block_group;
u64 max_bytes; u64 max_bytes;
u64 bitmap_bytes; u64 bitmap_bytes;
u64 extent_bytes; u64 extent_bytes;
...@@ -2182,7 +2182,7 @@ static u64 add_bytes_to_bitmap(struct btrfs_free_space_ctl *ctl, ...@@ -2182,7 +2182,7 @@ static u64 add_bytes_to_bitmap(struct btrfs_free_space_ctl *ctl,
static bool use_bitmap(struct btrfs_free_space_ctl *ctl, static bool use_bitmap(struct btrfs_free_space_ctl *ctl,
struct btrfs_free_space *info) struct btrfs_free_space *info)
{ {
struct btrfs_block_group *block_group = ctl->private; struct btrfs_block_group *block_group = ctl->block_group;
struct btrfs_fs_info *fs_info = block_group->fs_info; struct btrfs_fs_info *fs_info = block_group->fs_info;
bool forced = false; bool forced = false;
...@@ -2251,7 +2251,7 @@ static int insert_into_bitmap(struct btrfs_free_space_ctl *ctl, ...@@ -2251,7 +2251,7 @@ static int insert_into_bitmap(struct btrfs_free_space_ctl *ctl,
return 0; return 0;
if (ctl->op == &free_space_op) if (ctl->op == &free_space_op)
block_group = ctl->private; block_group = ctl->block_group;
again: again:
/* /*
* Since we link bitmaps right into the cluster we need to see if we * Since we link bitmaps right into the cluster we need to see if we
...@@ -2868,7 +2868,7 @@ void btrfs_init_free_space_ctl(struct btrfs_block_group *block_group, ...@@ -2868,7 +2868,7 @@ void btrfs_init_free_space_ctl(struct btrfs_block_group *block_group,
spin_lock_init(&ctl->tree_lock); spin_lock_init(&ctl->tree_lock);
ctl->unit = fs_info->sectorsize; ctl->unit = fs_info->sectorsize;
ctl->start = block_group->start; ctl->start = block_group->start;
ctl->private = block_group; ctl->block_group = block_group;
ctl->op = &free_space_op; ctl->op = &free_space_op;
ctl->free_space_bytes = RB_ROOT_CACHED; ctl->free_space_bytes = RB_ROOT_CACHED;
INIT_LIST_HEAD(&ctl->trimming_ranges); INIT_LIST_HEAD(&ctl->trimming_ranges);
...@@ -2967,8 +2967,8 @@ void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) ...@@ -2967,8 +2967,8 @@ void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl)
{ {
spin_lock(&ctl->tree_lock); spin_lock(&ctl->tree_lock);
__btrfs_remove_free_space_cache_locked(ctl); __btrfs_remove_free_space_cache_locked(ctl);
if (ctl->private) if (ctl->block_group)
btrfs_discard_update_discardable(ctl->private); btrfs_discard_update_discardable(ctl->block_group);
spin_unlock(&ctl->tree_lock); spin_unlock(&ctl->tree_lock);
} }
......
...@@ -56,7 +56,7 @@ struct btrfs_free_space_ctl { ...@@ -56,7 +56,7 @@ struct btrfs_free_space_ctl {
s32 discardable_extents[BTRFS_STAT_NR_ENTRIES]; s32 discardable_extents[BTRFS_STAT_NR_ENTRIES];
s64 discardable_bytes[BTRFS_STAT_NR_ENTRIES]; s64 discardable_bytes[BTRFS_STAT_NR_ENTRIES];
const struct btrfs_free_space_op *op; const struct btrfs_free_space_op *op;
void *private; struct btrfs_block_group *block_group;
struct mutex cache_writeout_mutex; struct mutex cache_writeout_mutex;
struct list_head trimming_ranges; struct list_head trimming_ranges;
}; };
......
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