* [PATCH 0/2] md: small cleanups in MD driver
@ 2026-04-15 14:03 Abd-Alrhman Masalkhi
2026-04-15 14:03 ` [PATCH 1/2] md: replace wait loop with wait_event() in md_handle_request() Abd-Alrhman Masalkhi
2026-04-15 14:03 ` [PATCH 2/2] md: use mddev_lock_nointr() in mddev_suspend_and_lock_nointr() Abd-Alrhman Masalkhi
0 siblings, 2 replies; 3+ messages in thread
From: Abd-Alrhman Masalkhi @ 2026-04-15 14:03 UTC (permalink / raw)
To: song, yukuai; +Cc: linux-raid, linux-kernel, Abd-Alrhman Masalkhi
Hi,
This small series contains two cleanups in the MD driver.
Patch 1: replaces a wait loop in md_handle_request() with wait_event()
Patch 2: replaces a mutex_lock() with mddev_lock_nointr()
Thanks,
Abd-Alrhman
Abd-Alrhman Masalkhi (2):
md: replace wait loop with wait_event() in md_handle_request()
md: use mddev_lock_nointr() in mddev_suspend_and_lock_nointr()
drivers/md/md.c | 10 +---------
drivers/md/md.h | 2 +-
2 files changed, 2 insertions(+), 10 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] md: replace wait loop with wait_event() in md_handle_request()
2026-04-15 14:03 [PATCH 0/2] md: small cleanups in MD driver Abd-Alrhman Masalkhi
@ 2026-04-15 14:03 ` Abd-Alrhman Masalkhi
2026-04-15 14:03 ` [PATCH 2/2] md: use mddev_lock_nointr() in mddev_suspend_and_lock_nointr() Abd-Alrhman Masalkhi
1 sibling, 0 replies; 3+ messages in thread
From: Abd-Alrhman Masalkhi @ 2026-04-15 14:03 UTC (permalink / raw)
To: song, yukuai; +Cc: linux-raid, linux-kernel, Abd-Alrhman Masalkhi
The wait loop is equivalent to wait_event() and can be simplified by
usaing it for improving readability.
Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
---
drivers/md/md.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index ac71640ff3a8..ba2b5fb2740e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -397,20 +397,12 @@ bool md_handle_request(struct mddev *mddev, struct bio *bio)
{
check_suspended:
if (is_suspended(mddev, bio)) {
- DEFINE_WAIT(__wait);
/* Bail out if REQ_NOWAIT is set for the bio */
if (bio->bi_opf & REQ_NOWAIT) {
bio_wouldblock_error(bio);
return true;
}
- for (;;) {
- prepare_to_wait(&mddev->sb_wait, &__wait,
- TASK_UNINTERRUPTIBLE);
- if (!is_suspended(mddev, bio))
- break;
- schedule();
- }
- finish_wait(&mddev->sb_wait, &__wait);
+ wait_event(mddev->sb_wait, !is_suspended(mddev, bio));
}
if (!percpu_ref_tryget_live(&mddev->active_io))
goto check_suspended;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] md: use mddev_lock_nointr() in mddev_suspend_and_lock_nointr()
2026-04-15 14:03 [PATCH 0/2] md: small cleanups in MD driver Abd-Alrhman Masalkhi
2026-04-15 14:03 ` [PATCH 1/2] md: replace wait loop with wait_event() in md_handle_request() Abd-Alrhman Masalkhi
@ 2026-04-15 14:03 ` Abd-Alrhman Masalkhi
1 sibling, 0 replies; 3+ messages in thread
From: Abd-Alrhman Masalkhi @ 2026-04-15 14:03 UTC (permalink / raw)
To: song, yukuai; +Cc: linux-raid, linux-kernel, Abd-Alrhman Masalkhi
This keeps mddev locking consistent and ensures that any future changes
to locking behavior are done through the wrapper.
Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
---
drivers/md/md.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 3bfbee595156..09ced132a917 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -1013,7 +1013,7 @@ static inline int mddev_suspend_and_lock(struct mddev *mddev)
static inline void mddev_suspend_and_lock_nointr(struct mddev *mddev)
{
mddev_suspend(mddev, false);
- mutex_lock(&mddev->reconfig_mutex);
+ mddev_lock_nointr(mddev);
}
static inline void mddev_unlock_and_resume(struct mddev *mddev)
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-15 14:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-15 14:03 [PATCH 0/2] md: small cleanups in MD driver Abd-Alrhman Masalkhi
2026-04-15 14:03 ` [PATCH 1/2] md: replace wait loop with wait_event() in md_handle_request() Abd-Alrhman Masalkhi
2026-04-15 14:03 ` [PATCH 2/2] md: use mddev_lock_nointr() in mddev_suspend_and_lock_nointr() Abd-Alrhman Masalkhi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox