From: Yu Kuai <yukuai3@huawei.com>
To: <agk@redhat.com>, <snitzer@kernel.org>, <mpatocka@redhat.com>,
<song@kernel.org>, <xni@redhat.com>,
<mariusz.tkaczyk@linux.intel.com>, <l@damenly.org>
Cc: <dm-devel@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<linux-raid@vger.kernel.org>, <yukuai3@huawei.com>,
<yukuai1@huaweicloud.com>, <yi.zhang@huawei.com>,
<yangerkun@huawei.com>
Subject: [PATCH 08/12] md: use new helers in md_do_sync()
Date: Mon, 3 Jun 2024 20:58:11 +0800 [thread overview]
Message-ID: <20240603125815.2199072-9-yukuai3@huawei.com> (raw)
In-Reply-To: <20240603125815.2199072-1-yukuai3@huawei.com>
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>
---
drivers/md/md.c | 21 +++++----------------
drivers/md/md.h | 2 +-
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 3890ae86449a..e44016055b56 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8934,7 +8934,8 @@ void md_do_sync(struct md_thread *thread)
sector_t last_check;
int skipped = 0;
struct md_rdev *rdev;
- char *desc, *action = NULL;
+ enum sync_action action;
+ const char *desc;
struct blk_plug plug;
int ret;
@@ -8965,21 +8966,9 @@ void md_do_sync(struct md_thread *thread)
goto skip;
}
- if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
- if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
- desc = "data-check";
- 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;
+ action = md_sync_action(mddev);
+ desc = md_sync_action_name(action);
+ mddev->last_sync_action = desc;
/*
* Before starting a resync we must have set curr_resync to
diff --git a/drivers/md/md.h b/drivers/md/md.h
index f7afc5a46031..614011651f79 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -432,7 +432,7 @@ struct mddev {
* when the sync thread is "frozen" (interrupted) or "idle" (stopped
* 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 */
/* As resync requests can complete out of order, we cannot easily track
* how much resync has been completed. So we occasionally pause until
--
2.39.2
next prev parent reply other threads:[~2024-06-03 12:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 12:58 [PATCH 00/12] md: refacotor and some fixes related to sync_thread Yu Kuai
2024-06-03 12:58 ` [PATCH 01/12] md: rearrange recovery_flags Yu Kuai
2024-06-03 12:58 ` [PATCH 02/12] md: add a new enum type sync_action Yu Kuai
2024-06-11 8:31 ` Mariusz Tkaczyk
2024-06-11 13:30 ` Yu Kuai
2024-06-03 12:58 ` [PATCH 03/12] md: add new helpers for sync_action Yu Kuai
2024-06-03 12:58 ` [PATCH 04/12] md: factor out helper to start reshape from action_store() Yu Kuai
2024-06-03 12:58 ` [PATCH 05/12] md: replace sysfs api sync_action with new helpers Yu Kuai
2024-06-03 12:58 ` [PATCH 06/12] md: remove parameter check_seq for stop_sync_thread() Yu Kuai
2024-06-03 12:58 ` [PATCH 07/12] md: don't fail action_store() if sync_thread is not registered Yu Kuai
2024-06-03 12:58 ` Yu Kuai [this message]
2024-06-03 12:58 ` [PATCH 09/12] md: replace last_sync_action with new enum type Yu Kuai
2024-06-03 12:58 ` [PATCH 10/12] md: factor out helpers for different sync_action in md_do_sync() Yu Kuai
2024-06-03 12:58 ` [PATCH 11/12] md: pass in max_sectors for pers->sync_request() Yu Kuai
2024-06-03 12:58 ` [PATCH 12/12] md/raid5: avoid BUG_ON() while continue reshape after reassembling Yu Kuai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240603125815.2199072-9-yukuai3@huawei.com \
--to=yukuai3@huawei.com \
--cc=agk@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=l@damenly.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=mariusz.tkaczyk@linux.intel.com \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
--cc=song@kernel.org \
--cc=xni@redhat.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai1@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®