@@ -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)
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(-)