[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251027150433.18193-16-k@mgml.me>
Date: Tue, 28 Oct 2025 00:04:32 +0900
From: Kenta Akagi <k@...l.me>
To: Song Liu <song@...nel.org>, Yu Kuai <yukuai@...as.com>,
Shaohua Li <shli@...com>, Mariusz Tkaczyk <mtkaczyk@...nel.org>,
Guoqing Jiang <jgq516@...il.com>
Cc: linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
Kenta Akagi <k@...l.me>
Subject: [PATCH v5 15/16] md: rename 'LastDev' rdev flag to 'RetryingSBWrite'
The rdev LastDev flag is assigned to devices
that have had metadata written with MD_FAILFAST in a Failfast rdev,
but whose bio failed but did not become faulty after an md_error.
After that, the metadata write is retried by sb_flags
MD_SB_NEED_REWRITE, but if rdev LastDev is set at this time, FailFast is
not used and LastDev is cleared if the write is successful.
Although it's called LastDev, this rdev flag actually means "metadata
write with FailFast failed and a retry is required. Do not use FailFast
when retrying for this rdev."
This is different from what we might expect from the name LastDev,
and can be confusing when reading the code.
This commit renames the LastDev flag to better reflect its actual
behavior for improving readability. The implementation remains
unchanged.
Signed-off-by: Kenta Akagi <k@...l.me>
---
drivers/md/md.c | 6 +++---
drivers/md/md.h | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 3c3f5703531b..1cbb4fd8bbc0 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1063,10 +1063,10 @@ static void super_written(struct bio *bio)
if (!md_cond_error(mddev, rdev, bio)
&& (bio->bi_opf & MD_FAILFAST)) {
set_bit(MD_SB_NEED_REWRITE, &mddev->sb_flags);
- set_bit(LastDev, &rdev->flags);
+ set_bit(RetryingSBWrite, &rdev->flags);
}
} else
- clear_bit(LastDev, &rdev->flags);
+ clear_bit(RetryingSBWrite, &rdev->flags);
bio_put(bio);
@@ -1119,7 +1119,7 @@ void md_write_metadata(struct mddev *mddev, struct md_rdev *rdev,
if (test_bit(MD_FAILFAST_SUPPORTED, &mddev->flags) &&
test_bit(FailFast, &rdev->flags) &&
- !test_bit(LastDev, &rdev->flags))
+ !test_bit(RetryingSBWrite, &rdev->flags))
bio->bi_opf |= MD_FAILFAST;
atomic_inc(&mddev->pending_writes);
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 38f9874538a6..0943cc5a86aa 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -282,9 +282,10 @@ enum flag_bits {
* It is expects that no bad block log
* is present.
*/
- LastDev, /* Seems to be the last working dev as
- * it didn't fail, so don't use FailFast
- * any more for metadata
+ RetryingSBWrite, /*
+ * metadata write with MD_FAILFAST failed,
+ * so it is being retried. Failfast
+ * will not be used during the retry.
*/
CollisionCheck, /*
* check if there is collision between raid1
--
2.50.1
Powered by blists - more mailing lists