Skip to content

Commit 0476d09

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
md: rearrange recovery_flags
Currently there are lots of flags with the same confusing prefix "MD_REOCVERY_", and there are two main types of flags, sync thread runnng status, I prefer prefix "SYNC_THREAD_", and sync thread action, I perfer prefix "SYNC_ACTION_". For now, rearrange and update comment to improve code readability, there are no functional changes. Signed-off-by: Yu Kuai <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ab99a87 commit 0476d09

File tree

1 file changed

+38
-14
lines changed

1 file changed

+38
-14
lines changed

drivers/md/md.h

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -551,22 +551,46 @@ struct mddev {
551551
};
552552

553553
enum recovery_flags {
554+
/* flags for sync thread running status */
555+
556+
/*
557+
* set when one of sync action is set and new sync thread need to be
558+
* registered, or just add/remove spares from conf.
559+
*/
560+
MD_RECOVERY_NEEDED,
561+
/* sync thread is running, or about to be started */
562+
MD_RECOVERY_RUNNING,
563+
/* sync thread needs to be aborted for some reason */
564+
MD_RECOVERY_INTR,
565+
/* sync thread is done and is waiting to be unregistered */
566+
MD_RECOVERY_DONE,
567+
/* running sync thread must abort immediately, and not restart */
568+
MD_RECOVERY_FROZEN,
569+
/* waiting for pers->start() to finish */
570+
MD_RECOVERY_WAIT,
571+
/* interrupted because io-error */
572+
MD_RECOVERY_ERROR,
573+
574+
/* flags determines sync action */
575+
576+
/* if just this flag is set, action is resync. */
577+
MD_RECOVERY_SYNC,
578+
/*
579+
* paired with MD_RECOVERY_SYNC, if MD_RECOVERY_CHECK is not set,
580+
* action is repair, means user requested resync.
581+
*/
582+
MD_RECOVERY_REQUESTED,
554583
/*
555-
* If neither SYNC or RESHAPE are set, then it is a recovery.
584+
* paired with MD_RECOVERY_SYNC and MD_RECOVERY_REQUESTED, action is
585+
* check.
556586
*/
557-
MD_RECOVERY_RUNNING, /* a thread is running, or about to be started */
558-
MD_RECOVERY_SYNC, /* actually doing a resync, not a recovery */
559-
MD_RECOVERY_RECOVER, /* doing recovery, or need to try it. */
560-
MD_RECOVERY_INTR, /* resync needs to be aborted for some reason */
561-
MD_RECOVERY_DONE, /* thread is done and is waiting to be reaped */
562-
MD_RECOVERY_NEEDED, /* we might need to start a resync/recover */
563-
MD_RECOVERY_REQUESTED, /* user-space has requested a sync (used with SYNC) */
564-
MD_RECOVERY_CHECK, /* user-space request for check-only, no repair */
565-
MD_RECOVERY_RESHAPE, /* A reshape is happening */
566-
MD_RECOVERY_FROZEN, /* User request to abort, and not restart, any action */
567-
MD_RECOVERY_ERROR, /* sync-action interrupted because io-error */
568-
MD_RECOVERY_WAIT, /* waiting for pers->start() to finish */
569-
MD_RESYNCING_REMOTE, /* remote node is running resync thread */
587+
MD_RECOVERY_CHECK,
588+
/* recovery, or need to try it */
589+
MD_RECOVERY_RECOVER,
590+
/* reshape */
591+
MD_RECOVERY_RESHAPE,
592+
/* remote node is running resync thread */
593+
MD_RESYNCING_REMOTE,
570594
};
571595

572596
enum md_ro_state {

0 commit comments

Comments
 (0)