[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240305072306.2562024-5-yukuai1@huaweicloud.com>
Date: Tue, 5 Mar 2024 15:23:01 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: xni@...hat.com,
zkabelac@...hat.com,
agk@...hat.com,
snitzer@...nel.org,
mpatocka@...hat.com,
dm-devel@...ts.linux.dev,
song@...nel.org,
yukuai3@...wei.com,
heinzm@...hat.com,
jbrassow@...hat.com,
neilb@...e.de
Cc: linux-kernel@...r.kernel.org,
linux-raid@...r.kernel.org,
yukuai1@...weicloud.com,
yi.zhang@...wei.com,
yangerkun@...wei.com
Subject: [PATCH md-6.8 v2 4/9] md: add a new helper reshape_interrupted()
From: Yu Kuai <yukuai3@...wei.com>
The helper will be used for dm-raid456 later to detect the case that
reshape can't make progress.
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
Signed-off-by: Xiao Ni <xni@...hat.com>
Acked-by: Mike Snitzer <snitzer@...nel.org>
---
drivers/md/md.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 684cc866402a..7f955115d78d 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -570,6 +570,25 @@ static inline bool md_is_rdwr(struct mddev *mddev)
return (mddev->ro == MD_RDWR);
}
+static inline bool reshape_interrupted(struct mddev *mddev)
+{
+ /* reshape never start */
+ if (mddev->reshape_position == MaxSector)
+ return false;
+
+ /* interrupted */
+ if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
+ return true;
+
+ /* running reshape will be interrupted soon. */
+ if (test_bit(MD_RECOVERY_WAIT, &mddev->recovery) ||
+ test_bit(MD_RECOVERY_INTR, &mddev->recovery) ||
+ test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
+ return true;
+
+ return false;
+}
+
static inline int __must_check mddev_lock(struct mddev *mddev)
{
return mutex_lock_interruptible(&mddev->reconfig_mutex);
--
2.39.2
Powered by blists - more mailing lists