[PATCH v5 08/16] md/raid10: refactor handle_read_error()

Kenta Akagi posted 16 patches 1 month, 3 weeks ago
[PATCH v5 08/16] md/raid10: refactor handle_read_error()
Posted by Kenta Akagi 1 month, 3 weeks ago
For the failfast bio feature, the behavior of handle_read_error() will
be changed in a subsequent commit, but refactor it first.

This commit only refactors the code without functional changes. A
subsequent commit will replace md_error() with md_cond_error()
to implement proper failfast error handling.

Signed-off-by: Kenta Akagi <k@mgml.me>
---
 drivers/md/raid10.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 68dbab7b360b..87468113e31a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2873,14 +2873,15 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
 	bio_put(bio);
 	r10_bio->devs[slot].bio = NULL;
 
-	if (mddev->ro)
+	if (mddev->ro) {
 		r10_bio->devs[slot].bio = IO_BLOCKED;
-	else if (!test_bit(FailFast, &rdev->flags)) {
+	} else if (test_bit(FailFast, &rdev->flags)) {
+		md_error(mddev, rdev);
+	} else {
 		freeze_array(conf, 1);
 		fix_read_error(conf, mddev, r10_bio);
 		unfreeze_array(conf);
-	} else
-		md_error(mddev, rdev);
+	}
 
 	rdev_dec_pending(rdev, mddev);
 	r10_bio->state = 0;
-- 
2.50.1
Re: [PATCH v5 08/16] md/raid10: refactor handle_read_error()
Posted by Yu Kuai 1 month, 2 weeks ago
在 2025/10/27 23:04, Kenta Akagi 写道:

> For the failfast bio feature, the behavior of handle_read_error() will
> be changed in a subsequent commit, but refactor it first.
>
> This commit only refactors the code without functional changes. A
> subsequent commit will replace md_error() with md_cond_error()
> to implement proper failfast error handling.
>
> Signed-off-by: Kenta Akagi<k@mgml.me>
> ---
>   drivers/md/raid10.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Yu Kuai <yukuai@fnnas.com>