summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbd-Alrhman Masalkhi <abd.masalkhi@gmail.com>2026-04-15 17:03:18 +0300
committerYu Kuai <yukuai@fnnas.com>2026-04-28 15:44:37 +0300
commit8e8278ac702e2d5d44211b4b10599aa3b2cb0555 (patch)
tree03bcee862b8babc3741a4254559bd155b58f623b
parent9aa6d860b0930e2f72795665c42c44252a558a0c (diff)
downloadlinux-8e8278ac702e2d5d44211b4b10599aa3b2cb0555.tar.xz
md: replace wait loop with wait_event() in md_handle_request()
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> Link: https://lore.kernel.org/r/20260415140319.376578-2-abd.masalkhi@gmail.com Signed-off-by: Yu Kuai <yukuai@fnnas.com>
-rw-r--r--drivers/md/md.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8656f2eff40d..ebaf47fb9de6 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -396,20 +396,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;