Skip to content

Commit 503f9d4

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
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]
1 parent 314e9af commit 503f9d4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/md/md.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,25 @@ static inline bool md_is_rdwr(struct mddev *mddev)
581581
return (mddev->ro == MD_RDWR);
582582
}
583583

584+
static inline bool reshape_interrupted(struct mddev *mddev)
585+
{
586+
/* reshape never start */
587+
if (mddev->reshape_position == MaxSector)
588+
return false;
589+
590+
/* interrupted */
591+
if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
592+
return true;
593+
594+
/* running reshape will be interrupted soon. */
595+
if (test_bit(MD_RECOVERY_WAIT, &mddev->recovery) ||
596+
test_bit(MD_RECOVERY_INTR, &mddev->recovery) ||
597+
test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
598+
return true;
599+
600+
return false;
601+
}
602+
584603
static inline int __must_check mddev_lock(struct mddev *mddev)
585604
{
586605
return mutex_lock_interruptible(&mddev->reconfig_mutex);

0 commit comments

Comments
 (0)