diff options
author | Yu Kuai <[email protected]> | 2024-03-05 15:23:01 +0800 |
---|---|---|
committer | Song Liu <[email protected]> | 2024-03-05 12:53:32 -0800 |
commit | 503f9d43790fdd0c6e6ae2f4dd3f70b146ac4159 (patch) | |
tree | eda82a1919b4218def8f042b6b2ec2463ecc503b | |
parent | 314e9af065513ff86ec9e32eaa96b9bd275cf51d (diff) |
md: add a new helper reshape_interrupted()
The helper will be used for dm-raid456 later to detect the case that
reshape can't make progress.
Cc: [email protected] # v6.7+
Signed-off-by: Yu Kuai <[email protected]>
Signed-off-by: Xiao Ni <[email protected]>
Acked-by: Mike Snitzer <[email protected]>
Signed-off-by: Song Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
-rw-r--r-- | drivers/md/md.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index a40e898fe57e..d5721bd77f63 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -581,6 +581,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); |