All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: [PATCH 8/8] btrfs: call rbio_orig_end_io from scrub_rbio
Date: Tue, 13 Dec 2022 09:41:23 +0100	[thread overview]
Message-ID: <20221213084123.309790-9-hch@lst.de> (raw)
In-Reply-To: <20221213084123.309790-1-hch@lst.de>

The only caller of scrub_rbio calls rbio_orig_end_io right after it,
move it into scrub_rbio to match the other work item helpers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/raid56.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index b2e02f02294163..4f2d63bfddae3c 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -2732,7 +2732,7 @@ static int scrub_assemble_read_bios(struct btrfs_raid_bio *rbio,
 	return ret;
 }
 
-static int scrub_rbio(struct btrfs_raid_bio *rbio)
+static void scrub_rbio(struct btrfs_raid_bio *rbio)
 {
 	struct bio_list bio_list = BIO_EMPTY_LIST;
 	bool need_check = false;
@@ -2742,13 +2742,13 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
 
 	ret = alloc_rbio_essential_pages(rbio);
 	if (ret)
-		return ret;
+		goto out;
 
 	bitmap_clear(rbio->error_bitmap, 0, rbio->nr_sectors);
 
 	ret = scrub_assemble_read_bios(rbio, &bio_list);
 	if (ret < 0)
-		return ret;
+		goto out;
 
 	submit_read_bios(rbio, &bio_list);
 	wait_event(rbio->io_wait, atomic_read(&rbio->stripes_pending) == 0);
@@ -2758,7 +2758,7 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
 	if (ret < 0) {
 		while ((bio = bio_list_pop(&bio_list)))
 			bio_put(bio);
-		return ret;
+		goto out;
 	}
 
 	/*
@@ -2776,17 +2776,13 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
 			break;
 		}
 	}
-	return ret;
+out:
+	rbio_orig_end_io(rbio, errno_to_blk_status(ret));
 }
 
 static void scrub_rbio_work_locked(struct work_struct *work)
 {
-	struct btrfs_raid_bio *rbio;
-	int ret;
-
-	rbio = container_of(work, struct btrfs_raid_bio, work);
-	ret = scrub_rbio(rbio);
-	rbio_orig_end_io(rbio, errno_to_blk_status(ret));
+	scrub_rbio(container_of(work, struct btrfs_raid_bio, work));
 }
 
 void raid56_parity_submit_scrub_rbio(struct btrfs_raid_bio *rbio)
-- 
2.35.1


  parent reply	other threads:[~2022-12-13  8:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  8:41 small raid56 cleanups v2 Christoph Hellwig
2022-12-13  8:41 ` [PATCH 1/8] btrfs: cleanup raid56_parity_write Christoph Hellwig
2022-12-13  8:41 ` [PATCH 2/8] btrfs: cleanup rmw_rbio Christoph Hellwig
2022-12-13  8:41 ` [PATCH 3/8] btrfs: cleanup rmw_read_wait_recover Christoph Hellwig
2022-12-13  8:41 ` [PATCH 4/8] btrfs: cleanup recover_rbio Christoph Hellwig
2022-12-13  8:50   ` Qu Wenruo
2022-12-13  8:41 ` [PATCH 5/8] btrfs: cleanup scrub_rbio Christoph Hellwig
2022-12-13  8:53   ` Qu Wenruo
2022-12-13 13:24     ` Christoph Hellwig
2022-12-13 23:32       ` Qu Wenruo
2022-12-14 16:45         ` Christoph Hellwig
2022-12-13  8:41 ` [PATCH 6/8] btrfs: call rbio_orig_end_io from rmw_rbio Christoph Hellwig
2022-12-13  8:54   ` Qu Wenruo
2022-12-13  8:41 ` [PATCH 7/8] btrfs: call rbio_orig_end_io from recover_rbio Christoph Hellwig
2022-12-13  8:54   ` Qu Wenruo
2022-12-13  8:41 ` Christoph Hellwig [this message]
2022-12-13  8:55   ` [PATCH 8/8] btrfs: call rbio_orig_end_io from scrub_rbio Qu Wenruo
2022-12-13  8:59 ` small raid56 cleanups v2 Qu Wenruo
2022-12-13 13:25   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221213084123.309790-9-hch@lst.de \
    --to=hch@lst.de \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.