Message ID | 20240826063659.15327-2-neilb@suse.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Make wake_up_{bit,var} less fragile | expand |
On 8/26/24 12:30 AM, NeilBrown wrote: > 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 *". Looks fine to me - since this one is separate from the series, I can snag it and shove it into the block side so it'll make 6.12-rc1. Then at least it won't be a dependency for the rest of the series post that.
On Mon, 26 Aug 2024 16:30:58 +1000, NeilBrown wrote: > 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 *". > > [...] Applied, thanks! [1/7] block: change wait on bd_claiming to use a var_waitqueue, not a bit_waitqueue commit: aa3d8a36780ab568d528348dd8115560f63ea16b Best regards,
On Tue, 17 Sep 2024, Jens Axboe wrote: > On 8/26/24 12:30 AM, NeilBrown wrote: > > 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 *". > > Looks fine to me - since this one is separate from the series, I can snag > it and shove it into the block side so it'll make 6.12-rc1. Then at least > it won't be a dependency for the rest of the series post that. Thanks Jens! NeilBrown
diff --git a/block/bdev.c b/block/bdev.c index c5507b6f63b8..21e688fb6449 100644 --- a/block/bdev.c +++ b/block/bdev.c @@ -548,7 +548,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); @@ -571,7 +571,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); } /**
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(-)