From: Logan Gunthorpe Date: Thu, 16 Jun 2022 19:19:34 +0000 (-0600) Subject: md/raid5: Move stripe_add_to_batch_list() call out of add_stripe_bio() X-Git-Tag: baikal/aarch64/sdk6.1~3362^2~118 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=f4d3131d703fc88a4c35146ed2a1048c2863fc71;p=kernel.git md/raid5: Move stripe_add_to_batch_list() call out of add_stripe_bio() stripe_add_to_batch_list() is better done in the loop in make_request instead of inside add_stripe_bio(). This is clearer and allows for storing the batch_head state outside the loop in a subsequent patch. The call to add_stripe_bio() in retry_aligned_read() is for read and batching only applies to write. So it's impossible for batching to happen at that call site. No functional changes intended. Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Reviewed-by: Guoqing Jiang Signed-off-by: Song Liu Signed-off-by: Jens Axboe --- diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ee7c1af8dcdb2..ae2c1ec8bc204 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3532,8 +3532,6 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, } spin_unlock_irq(&sh->stripe_lock); - if (stripe_can_batch(sh)) - stripe_add_to_batch_list(conf, sh); return 1; overlap: @@ -5951,6 +5949,9 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) goto retry; } + if (stripe_can_batch(sh)) + stripe_add_to_batch_list(conf, sh); + if (do_flush) { set_bit(STRIPE_R5C_PREFLUSH, &sh->state); /* we only need flush for one stripe */