linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drbd: use DEFINE_SPINLOCK() for spinlock
@ 2021-04-06 12:09 Huang Guobin
  2021-04-06 15:31 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Huang Guobin @ 2021-04-06 12:09 UTC (permalink / raw)
  To: huangguobin4, Philipp Reisner, Lars Ellenberg, Jens Axboe
  Cc: drbd-dev, linux-block, linux-kernel

From: Guobin Huang <huangguobin4@huawei.com>

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Guobin Huang <huangguobin4@huawei.com>
---
 drivers/block/drbd/drbd_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 25cd8a2f729d..d8605159240b 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -125,7 +125,7 @@ struct bio_set drbd_io_bio_set;
 	 member of struct page.
  */
 struct page *drbd_pp_pool;
-spinlock_t   drbd_pp_lock;
+DEFINE_SPINLOCK(drbd_pp_lock);
 int          drbd_pp_vacant;
 wait_queue_head_t drbd_pp_wait;
 
@@ -2161,9 +2161,6 @@ static int drbd_create_mempools(void)
 	if (ret)
 		goto Enomem;
 
-	/* drbd's page pool */
-	spin_lock_init(&drbd_pp_lock);
-
 	for (i = 0; i < number; i++) {
 		page = alloc_page(GFP_HIGHUSER);
 		if (!page)


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

* Re: [PATCH -next] drbd: use DEFINE_SPINLOCK() for spinlock
  2021-04-06 12:09 [PATCH -next] drbd: use DEFINE_SPINLOCK() for spinlock Huang Guobin
@ 2021-04-06 15:31 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-04-06 15:31 UTC (permalink / raw)
  To: Huang Guobin, Philipp Reisner, Lars Ellenberg
  Cc: drbd-dev, linux-block, linux-kernel

On 4/6/21 6:09 AM, Huang Guobin wrote:
> From: Guobin Huang <huangguobin4@huawei.com>
> 
> spinlock can be initialized automatically with DEFINE_SPINLOCK()
> rather than explicitly calling spin_lock_init().

Applied, thanks.

-- 
Jens Axboe


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 12:09 [PATCH -next] drbd: use DEFINE_SPINLOCK() for spinlock Huang Guobin
2021-04-06 15:31 ` Jens Axboe

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).