mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/8] block: change wait on bd_claiming to use a var_waitqueue, not a bit_waitqueue
Date: Wed, 25 Sep 2024 15:24:04 +1000	[thread overview]
Message-ID: <20240925053118.3956520-2-neilb@suse.de> (raw)
In-Reply-To: <20240925053118.3956520-1-neilb@suse.de>

bd_prepare_to_claim() waits for a var to change, not for a bit to be
cleared.
So change from bit_waitqueue() to __var_waitqueue() and correspondingly
use wake_up_var().
This will allow a future patch which change the "bit" function to expect
an "unsigned long *" instead of "void *".

Signed-off-by: NeilBrown <neilb@suse.de>
---
 block/bdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/bdev.c b/block/bdev.c
index 33f9c4605e3a..738e3c8457e7 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -555,7 +555,7 @@ int bd_prepare_to_claim(struct block_device *bdev, void *holder,
 
 	/* if claiming is already in progress, wait for it to finish */
 	if (whole->bd_claiming) {
-		wait_queue_head_t *wq = bit_waitqueue(&whole->bd_claiming, 0);
+		wait_queue_head_t *wq = __var_waitqueue(&whole->bd_claiming);
 		DEFINE_WAIT(wait);
 
 		prepare_to_wait(wq, &wait, TASK_UNINTERRUPTIBLE);
@@ -578,7 +578,7 @@ static void bd_clear_claiming(struct block_device *whole, void *holder)
 	/* tell others that we're done */
 	BUG_ON(whole->bd_claiming != holder);
 	whole->bd_claiming = NULL;
-	wake_up_bit(&whole->bd_claiming, 0);
+	wake_up_var(&whole->bd_claiming);
 }
 
 /**
-- 
2.46.0


  reply	other threads:[~2024-09-25  5:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25  5:24 [PATCH 0/8 v3] Make wake_up_{bit,var} less fragile NeilBrown
2024-09-25  5:24 ` NeilBrown [this message]
2024-09-25  5:24 ` [PATCH 2/8] sched: change wake_up_bit() and related function to expect unsigned long * NeilBrown
2024-09-25  5:24 ` [PATCH 3/8] sched: Improve documentation for wake_up_bit/wait_on_bit family of functions NeilBrown
2024-09-25  5:24 ` [PATCH 4/8] sched: Document wait_var_event() family of functions and wake_up_var() NeilBrown
2024-09-25  5:24 ` [PATCH 5/8] sched: Add test_and_clear_wake_up_bit() and atomic_dec_and_wake_up() NeilBrown
2024-09-25  5:24 ` [PATCH 6/8] sched: Add wait/wake interface for variable updated under a lock NeilBrown
2024-09-25  5:24 ` [PATCH 7/8] sched: add wait_var_event_io() NeilBrown
2024-09-25  5:24 ` [PATCH 8/8] softirq: use bit waits instead of var waits NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240925053118.3956520-2-neilb@suse.de \
    --to=neilb@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®