linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: clean up locking name in scrub_enumerate_chunks()
@ 2019-10-31 10:55 Dan Carpenter
  2019-10-31 11:42 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-10-31 10:55 UTC (permalink / raw)
  To: Chris Mason, David Sterba
  Cc: Josef Bacik, linux-btrfs, linux-kernel, kernel-janitors

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 <dan.carpenter@oracle.com>
---
 fs/btrfs/scrub.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 4a5a4e4ef707..06494304ab80 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: clean up locking name in scrub_enumerate_chunks()
  2019-10-31 10:55 [PATCH] btrfs: clean up locking name in scrub_enumerate_chunks() Dan Carpenter
@ 2019-10-31 11:42 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2019-10-31 11:42 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Chris Mason, David Sterba, Josef Bacik, linux-btrfs,
	linux-kernel, kernel-janitors

On Thu, Oct 31, 2019 at 01:55:01PM +0300, Dan Carpenter wrote:
> 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 <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-31 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 10:55 [PATCH] btrfs: clean up locking name in scrub_enumerate_chunks() Dan Carpenter
2019-10-31 11:42 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).