btrfs: clean up locking name in scrub_enumerate_chunks()
Subsystems (2)
PATCH 1/1 btrfs: clean up locking name in scrub_enumerate_chunks()
The "&fs_info->dev_replace.rwsem" and "&dev_replace->rwsem" refer to the same lock but Smatch is not clever enough to figure that out so it leads to static checker warnings. It's better to use it consistently anyway.
Signed-off-by Dan Carpenter <[email protected]>
--- fs/btrfs/scrub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/scrub.c +3 -3
@@ -3620,7 +3620,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,break ; } -down_write (&fs_info->dev_replace.rwsem); +down_write (&dev_replace->rwsem); dev_replace->cursor_right = found_key.offset + length; dev_replace->cursor_left = found_key.offset; dev_replace->item_needs_writeback =1 ;
@@ -3661,10 +3661,10 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,scrub_pause_off (fs_info); -down_write (&fs_info->dev_replace.rwsem); +down_write (&dev_replace->rwsem); dev_replace->cursor_left = dev_replace->cursor_right; dev_replace->item_needs_writeback =1 ; -up_write (&fs_info->dev_replace.rwsem); +up_write (&dev_replace->rwsem);if (ro_set)btrfs_dec_block_group_ro (cache);
Signature · 1 line
2.20.1
Quoted 4 lines · Dan Carpenter
The "
&fs_info->dev_replace.rwsem" and "&dev_replace->rwsem" refer to the same lock but Smatch is not clever enough to figure that out so it leads to static checker warnings. It's better to use it consistently anyway.
Both reasons, smatch and code consitency are fine, thanks.
Reviewed-by David Sterba <[email protected]>