md/raid5: Keep a reference to last stripe_head for batch
authorLogan Gunthorpe <logang@deltatee.com>
Thu, 16 Jun 2022 19:19:40 +0000 (13:19 -0600)
committerSong Liu <song@kernel.org>
Sun, 3 Jul 2022 14:55:42 +0000 (07:55 -0700)
commit4fcbd9abb6f2a13017b5125539fb79b6b63fb570
tree7ce29dc52c3d3bb0fadbf5ae7a632da58cdd1905
parentcb775de29f28b36219bde44b6fdef39642e4633d
md/raid5: Keep a reference to last stripe_head for batch

When batching, every stripe head has to find the previous stripe head to
add to the batch list. This involves taking the hash lock which is
highly contended during IO.

Instead of finding the previous stripe_head each time, store a
reference to the previous stripe_head in a pointer so that it doesn't
require taking the contended lock another time.

The reference to the previous stripe must be released before scheduling
and waiting for work to get done. Otherwise, it can hold up
raid5_activate_delayed() and deadlock.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/raid5.c