linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 5/7] Btrfs: add helper __raid_write_end_io
Date: Tue, 21 Nov 2017 17:35:56 -0700	[thread overview]
Message-ID: <20171122003558.28722-6-bo.li.liu@oracle.com> (raw)
In-Reply-To: <20171122003558.28722-1-bo.li.liu@oracle.com>

We'd like to retry write on errors, so this splits raid_write_end_io()
to two parts, a) checking errors and b) the rest in a helper
__raid_write_end_io().

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/raid56.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index aa04e5b..aebc849 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -887,19 +887,12 @@ static void rbio_orig_end_io(struct btrfs_raid_bio *rbio, blk_status_t err)
 	}
 }
 
-/*
- * end io function used by finish_rmw.  When we finally
- * get here, we've written a full stripe
- */
-static void raid_write_end_io(struct bio *bio)
+static void __raid_write_end_io(struct bio *bio)
 {
 	struct btrfs_raid_bio *rbio = bio->bi_private;
-	blk_status_t err = bio->bi_status;
+	blk_status_t err;
 	int max_errors;
 
-	if (err)
-		fail_bio_stripe(bio);
-
 	bio_put(bio);
 
 	if (!atomic_dec_and_test(&rbio->stripes_pending))
@@ -917,6 +910,18 @@ static void raid_write_end_io(struct bio *bio)
 }
 
 /*
+ * end io function used by finish_rmw.  When we finally
+ * get here, we've written a full stripe
+ */
+static void raid_write_end_io(struct bio *bio)
+{
+	if (bio->bi_status)
+		fail_bio_stripe(bio);
+
+	__raid_write_end_io(bio);
+}
+
+/*
  * the read/modify/write code wants to use the original bio for
  * any pages it included, and then use the rbio for everything
  * else.  This function decides if a given index (stripe number)
-- 
2.9.4


  parent reply	other threads:[~2017-11-22  1:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  0:35 [PATCH 0/7] retry write on error Liu Bo
2017-11-22  0:35 ` [PATCH 1/7] Btrfs: keep a copy of bi_iter in btrfs_io_bio Liu Bo
2017-11-22  0:35 ` [PATCH 2/7] Btrfs: add helper __btrfs_end_bio Liu Bo
2017-11-22  0:35 ` [PATCH 3/7] Btrfs: retry write for non-raid56 Liu Bo
2017-11-22 14:41   ` Nikolay Borisov
2017-11-28 23:01     ` Liu Bo
2017-11-22  0:35 ` [PATCH 4/7] Btrfs: get rbio inside fail_bio_stripe Liu Bo
2017-11-22  0:35 ` Liu Bo [this message]
2017-11-22  0:35 ` [PATCH 6/7] Btrfs: retry write for raid56 Liu Bo
2017-11-22  0:35 ` [PATCH 7/7] Btrfs: retry the whole bio on write error Liu Bo
2017-11-28 19:22 ` [PATCH 0/7] retry write on error David Sterba
2017-11-28 22:07   ` Edmund Nadolski
2017-11-28 23:41     ` Peter Grandi
2017-11-29  4:09       ` Anand Jain
2017-11-29 16:47         ` David Sterba
2017-11-30 20:22           ` Liu Bo
2017-12-03 21:00             ` Peter Grandi
2017-12-04  9:14             ` Anand Jain
2017-12-04 20:49             ` Edmund Nadolski
2017-12-05 18:57             ` David Sterba
2017-11-29 18:09   ` Liu Bo

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=20171122003558.28722-6-bo.li.liu@oracle.com \
    --to=bo.li.liu@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).