[PATCH v2] md: use md_free_cloned_bio() in md_end_clone_io()

Abd-Alrhman Masalkhi <[email protected]>
Newsgroups gmane.linux.raid,gmane.linux.kernel
Message-ID <[email protected]>
md_end_clone_io() and md_free_cloned_bio() share identical teardown
logic. Use md_free_cloned_bio() in md_end_clone_io() for cleanup and
call bio_endio() afterwards.

Signed-off-by: Abd-Alrhman Masalkhi <[email protected]>
---
Changes in v2:
 - Reuse md_free_cloned_bio() instead of introducing a new helper
 - Link to v1: https://lore.kernel.org/linux-raid/[email protected]
---
 drivers/md/md.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index ac71640ff3a8..8565566a447b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9212,20 +9212,9 @@ static void md_end_clone_io(struct bio *bio)
 {
 	struct md_io_clone *md_io_clone = bio->bi_private;
 	struct bio *orig_bio = md_io_clone->orig_bio;
-	struct mddev *mddev = md_io_clone->mddev;
-
-	if (bio_data_dir(orig_bio) == WRITE && md_bitmap_enabled(mddev, false))
-		md_bitmap_end(mddev, md_io_clone);
-
-	if (bio->bi_status && !orig_bio->bi_status)
-		orig_bio->bi_status = bio->bi_status;
-
-	if (md_io_clone->start_time)
-		bio_end_io_acct(orig_bio, md_io_clone->start_time);
 
-	bio_put(bio);
+	md_free_cloned_bio(bio);
 	bio_endio(orig_bio);
-	percpu_ref_put(&mddev->active_io);
 }
 
 static void md_clone_bio(struct mddev *mddev, struct bio **bio)
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.