public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: Yu Kuai <yukuai3@huawei.com>
Cc: <agk@redhat.com>, <snitzer@kernel.org>, <mpatocka@redhat.com>,
	<song@kernel.org>, <xni@redhat.com>, <l@damenly.org>,
	<dm-devel@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-raid@vger.kernel.org>, <yukuai1@huaweicloud.com>,
	<yi.zhang@huawei.com>, <yangerkun@huawei.com>
Subject: Re: [PATCH 02/12] md: add a new enum type sync_action
Date: Tue, 11 Jun 2024 10:31:26 +0200	[thread overview]
Message-ID: <20240611103126.00003ee0@linux.intel.com> (raw)
In-Reply-To: <20240603125815.2199072-3-yukuai3@huawei.com>

On Mon, 3 Jun 2024 20:58:05 +0800
Yu Kuai <yukuai3@huawei.com> wrote:

> In order to make code related to sync_thread cleaner in following
> patches, also add detail comment about each sync action. And also
> prepare to remove the related recovery_flags in the fulture.
> 
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
>  drivers/md/md.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 56 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 170412a65b63..6b9d9246f260 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -34,6 +34,61 @@
>   */
>  #define	MD_FAILFAST	(REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT)
>  
> +/* Status of sync thread. */
> +enum sync_action {
> +	/*
> +	 * Represent by MD_RECOVERY_SYNC, start when:
> +	 * 1) after assemble, sync data from first rdev to other copies, this
> +	 * must be done first before other sync actions and will only execute
> +	 * once;
> +	 * 2) resize the array(notice that this is not reshape), sync data
> for
> +	 * the new range;
> +	 */
> +	ACTION_RESYNC,
> +	/*
> +	 * Represent by MD_RECOVERY_RECOVER, start when:
> +	 * 1) for new replacement, sync data based on the replace rdev or
> +	 * available copies from other rdev;
> +	 * 2) for new member disk while the array is degraded, sync data from
> +	 * other rdev;
> +	 * 3) reassemble after power failure or re-add a hot removed rdev,
> sync
> +	 * data from first rdev to other copies based on bitmap;
> +	 */
> +	ACTION_RECOVER,
> +	/*
> +	 * Represent by MD_RECOVERY_SYNC | MD_RECOVERY_REQUESTED |
> +	 * MD_RECOVERY_CHECK, start when user echo "check" to sysfs api
> +	 * sync_action, used to check if data copies from differenct rdev are
> +	 * the same. The number of mismatch sectors will be exported to user
> +	 * by sysfs api mismatch_cnt;
> +	 */
> +	ACTION_CHECK,
> +	/*
> +	 * Represent by MD_RECOVERY_SYNC | MD_RECOVERY_REQUESTED, start when
> +	 * user echo "repair" to sysfs api sync_action, usually paired with
> +	 * ACTION_CHECK, used to force syncing data once user found that
> there
> +	 * are inconsistent data,
> +	 */
> +	ACTION_REPAIR,
> +	/*
> +	 * Represent by MD_RECOVERY_RESHAPE, start when new member disk is
> added
> +	 * to the conf, notice that this is different from spares or
> +	 * replacement;
> +	 */
> +	ACTION_RESHAPE,
> +	/*
> +	 * Represent by MD_RECOVERY_FROZEN, can be set by sysfs api
> sync_action
> +	 * or internal usage like setting the array read-only, will forbid
> above
> +	 * actions.
> +	 */
> +	ACTION_FROZEN,
> +	/*
> +	 * All above actions don't match.
> +	 */
> +	ACTION_IDLE,
> +	NR_SYNC_ACTIONS,
> +};

I like if counter is keep in same style as rest enum values, like ACTION_COUNT.

Anyway LGTM.

Mariusz

  reply	other threads:[~2024-06-11  8:31 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 [this message]
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 ` [PATCH 08/12] md: use new helers in md_do_sync() Yu Kuai
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=20240611103126.00003ee0@linux.intel.com \
    --to=mariusz.tkaczyk@linux.intel.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=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 \
    --cc=yukuai3@huawei.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