Skip to content

Commit 9283b9e

Browse files
josefbacikkdave
authored andcommitted
btrfs: remove lock protection for BLOCK_GROUP_FLAG_TO_COPY
We use this during device replace for zoned devices, we were simply taking the lock because it was in a bit field and we needed the lock to be safe with other modifications in the bitfield. With the bit helpers we no longer require that locking. Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 3349b57 commit 9283b9e

File tree

3 files changed

+0
-9
lines changed

3 files changed

+0
-9
lines changed

fs/btrfs/dev-replace.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,7 @@ static int mark_block_group_to_copy(struct btrfs_fs_info *fs_info,
545545
if (!cache)
546546
continue;
547547

548-
spin_lock(&cache->lock);
549548
set_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags);
550-
spin_unlock(&cache->lock);
551-
552549
btrfs_put_block_group(cache);
553550
}
554551
if (iter_ret < 0)
@@ -610,9 +607,7 @@ bool btrfs_finish_block_group_to_copy(struct btrfs_device *srcdev,
610607
}
611608

612609
/* Last stripe on this device */
613-
spin_lock(&cache->lock);
614610
clear_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags);
615-
spin_unlock(&cache->lock);
616611

617612
return true;
618613
}

fs/btrfs/scrub.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3755,13 +3755,11 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
37553755
}
37563756

37573757
if (sctx->is_dev_replace && btrfs_is_zoned(fs_info)) {
3758-
spin_lock(&cache->lock);
37593758
if (!test_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags)) {
37603759
spin_unlock(&cache->lock);
37613760
btrfs_put_block_group(cache);
37623761
goto skip;
37633762
}
3764-
spin_unlock(&cache->lock);
37653763
}
37663764

37673765
/*

fs/btrfs/volumes.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6153,9 +6153,7 @@ static bool is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical)
61536153

61546154
cache = btrfs_lookup_block_group(fs_info, logical);
61556155

6156-
spin_lock(&cache->lock);
61576156
ret = test_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags);
6158-
spin_unlock(&cache->lock);
61596157

61606158
btrfs_put_block_group(cache);
61616159
return ret;

0 commit comments

Comments
 (0)