summaryrefslogtreecommitdiff
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2022-07-15 22:45:24 +0300
committerDavid Sterba <dsterba@suse.com>2022-09-26 13:27:54 +0300
commit3349b57fd47b5de10936bd8928db546b20c9fb91 (patch)
tree12dce14e91153e4ae52b8bf7b525bb366c0ec8f8 /fs/btrfs/dev-replace.c
parent723de71d41f50709eaf2eef1b08aa409687a3c97 (diff)
downloadlinux-3349b57fd47b5de10936bd8928db546b20c9fb91.tar.xz
btrfs: convert block group bit field to use bit helpers
We use a bit field in the btrfs_block_group for different flags, however this is awkward because we have to hold the block_group->lock for any modification of any of these fields, and makes the code clunky for a few of these flags. Convert these to a properly flags setup so we can utilize the bit helpers. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r--fs/btrfs/dev-replace.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 41cddd3ff059..46b608260b33 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -546,7 +546,7 @@ static int mark_block_group_to_copy(struct btrfs_fs_info *fs_info,
continue;
spin_lock(&cache->lock);
- cache->to_copy = 1;
+ set_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags);
spin_unlock(&cache->lock);
btrfs_put_block_group(cache);
@@ -577,7 +577,7 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev,
return true;
spin_lock(&cache->lock);
- if (cache->removed) {
+ if (test_bit(BLOCK_GROUP_FLAG_REMOVED, &cache->runtime_flags)) {
spin_unlock(&cache->lock);
return true;
}
@@ -611,7 +611,7 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev,
/* Last stripe on this device */
spin_lock(&cache->lock);
- cache->to_copy = 0;
+ clear_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags);
spin_unlock(&cache->lock);
return true;