From: Logan Gunthorpe Date: Thu, 16 Jun 2022 19:19:39 +0000 (-0600) Subject: md/raid5: Refactor for loop in raid5_make_request() into while loop X-Git-Tag: v6.1-rc5~702^2~113 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a2d1694de6095dadbc99a6eb803ebab381de09e;p=platform%2Fkernel%2Flinux-starfive.git md/raid5: Refactor for loop in raid5_make_request() into while loop The for loop with retry label can be more cleanly expressed as a while loop by moving the logical_sector increment into the success path. No functional changes intended. Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Signed-off-by: Song Liu Signed-off-by: Jens Axboe --- diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 57a5a03..025228a 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5975,22 +5975,23 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) } md_account_bio(mddev, &bi); prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE); - for (; logical_sector < last_sector; logical_sector += RAID5_STRIPE_SECTORS(conf)) { - retry: + while (logical_sector < last_sector) { res = make_stripe_request(mddev, conf, &ctx, logical_sector, bi); if (res == STRIPE_FAIL) break; if (res == STRIPE_RETRY) - goto retry; + continue; if (res == STRIPE_SCHEDULE_AND_RETRY) { schedule(); prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE); - goto retry; + continue; } + + logical_sector += RAID5_STRIPE_SECTORS(conf); } finish_wait(&conf->wait_for_overlap, &w);