mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
md: use new helpers in md_do_sync()
Make code cleaner. and also use the action_name directly in kernel log: - "check" instead of "data-check" - "repair" instead of "requested-resync" Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20240611132251.1967786-9-yukuai1@huaweicloud.com
This commit is contained in:
@@ -8929,7 +8929,8 @@ void md_do_sync(struct md_thread *thread)
|
|||||||
sector_t last_check;
|
sector_t last_check;
|
||||||
int skipped = 0;
|
int skipped = 0;
|
||||||
struct md_rdev *rdev;
|
struct md_rdev *rdev;
|
||||||
char *desc, *action = NULL;
|
enum sync_action action;
|
||||||
|
const char *desc;
|
||||||
struct blk_plug plug;
|
struct blk_plug plug;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -8960,21 +8961,9 @@ void md_do_sync(struct md_thread *thread)
|
|||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
|
action = md_sync_action(mddev);
|
||||||
if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
|
desc = md_sync_action_name(action);
|
||||||
desc = "data-check";
|
mddev->last_sync_action = desc;
|
||||||
action = "check";
|
|
||||||
} else if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
|
|
||||||
desc = "requested-resync";
|
|
||||||
action = "repair";
|
|
||||||
} else
|
|
||||||
desc = "resync";
|
|
||||||
} else if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
|
|
||||||
desc = "reshape";
|
|
||||||
else
|
|
||||||
desc = "recovery";
|
|
||||||
|
|
||||||
mddev->last_sync_action = action ?: desc;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Before starting a resync we must have set curr_resync to
|
* Before starting a resync we must have set curr_resync to
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ struct mddev {
|
|||||||
* when the sync thread is "frozen" (interrupted) or "idle" (stopped
|
* when the sync thread is "frozen" (interrupted) or "idle" (stopped
|
||||||
* or finished). It is overwritten when a new sync operation is begun.
|
* or finished). It is overwritten when a new sync operation is begun.
|
||||||
*/
|
*/
|
||||||
char *last_sync_action;
|
const char *last_sync_action;
|
||||||
sector_t curr_resync; /* last block scheduled */
|
sector_t curr_resync; /* last block scheduled */
|
||||||
/* As resync requests can complete out of order, we cannot easily track
|
/* As resync requests can complete out of order, we cannot easily track
|
||||||
* how much resync has been completed. So we occasionally pause until
|
* how much resync has been completed. So we occasionally pause until
|
||||||
|
|||||||
Reference in New Issue
Block a user