All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] btrfs: integrity-checker: use DEFINE_MUTEX() for mutex lock
@ 2021-04-05 10:14 Zheng Yongjun
  2021-04-06 12:16 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2021-04-05 10:14 UTC (permalink / raw)
  To: zhengyongjun3, Chris Mason, Josef Bacik, David Sterba
  Cc: linux-btrfs, kernel-janitors, Hulk Robot

mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 fs/btrfs/check-integrity.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 169508609324..7af9273ef1b6 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -370,7 +370,7 @@ static void btrfsic_cmp_log_and_dev_bytenr(struct btrfsic_state *state,
 					   struct btrfsic_dev_state *dev_state,
 					   u64 dev_bytenr);
 
-static struct mutex btrfsic_mutex;
+static DEFINE_MUTEX(btrfsic_mutex);
 static int btrfsic_is_initialized;
 static struct btrfsic_dev_state_hashtable btrfsic_dev_state_hashtable;
 
@@ -2787,7 +2787,6 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
 		return -ENOMEM;
 
 	if (!btrfsic_is_initialized) {
-		mutex_init(&btrfsic_mutex);
 		btrfsic_dev_state_hashtable_init(&btrfsic_dev_state_hashtable);
 		btrfsic_is_initialized = 1;
 	}


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

* Re: [PATCH -next] btrfs: integrity-checker: use DEFINE_MUTEX() for mutex lock
  2021-04-05 10:14 [PATCH -next] btrfs: integrity-checker: use DEFINE_MUTEX() for mutex lock Zheng Yongjun
@ 2021-04-06 12:16 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2021-04-06 12:16 UTC (permalink / raw)
  To: Zheng Yongjun
  Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs,
	kernel-janitors, Hulk Robot

On Mon, Apr 05, 2021 at 06:14:46PM +0800, Zheng Yongjun wrote:
> mutex lock can be initialized automatically with DEFINE_MUTEX()
> rather than explicitly calling mutex_init().
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>

You've sent this patch already and haven't provided the answer why the
changes should be done.
https://lore.kernel.org/linux-btrfs/20210104144559.GF6430@twin.jikos.cz/

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

end of thread, other threads:[~2021-04-06 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-05 10:14 [PATCH -next] btrfs: integrity-checker: use DEFINE_MUTEX() for mutex lock Zheng Yongjun
2021-04-06 12:16 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.