Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp858188lqo; Wed, 8 May 2024 18:29:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX63cbUhigVbqD7SyUnlcWvpEeWfbs5GZERjt4BD6AGOAH4KwbbsRdOA/geo83tDkFt5t35QIdZif1icOVE1MPQtuvLsOu04Tt2kyJplg== X-Google-Smtp-Source: AGHT+IGdUkZxP9Lga1QRAQ7FYnPrFjkJ33eunTj5puRJmDkGECrgJmeIrvLlJU1NuxHkoH2Grmbm X-Received: by 2002:a05:6358:5904:b0:17b:602f:24c6 with SMTP id e5c5f4694b2df-192d356beddmr513663455d.24.1715218185832; Wed, 08 May 2024 18:29:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715218185; cv=pass; d=google.com; s=arc-20160816; b=qqRTx+eWEgJQjHBklXdPaQMi+QjE0nafYnrReDZCrJsAsrfjDYonYEmjfw6XiBIljd etj7Mb9E1p4c8u3hWjbRD2YZQU0I70jazpY2kZLR4havLoh2n2SIqudSYKwUXF5H9Wul +ttQlbW1pXpa6qdd8CpQgLaw5hoWpQxwOjoQL5GcQKs/C6pb3emv0gcII5USC+6L4vaD l4d85RcH90dqV/0Zbj8EPLPD9GsoUzebFgJMggI+NaHx3OARvhj/i1ODoRHBIdyRIssi oa15fwLxAlkWYi840b9SVIpQp3VSwSQ2MaH1PALwcnEUxa+he3tXKsAvA6vhqVV7jHjh cQPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=j5q5LaJTu8X38pHzRrFbGIlLwb9OhWfy3ds57PuuIPA=; fh=vFj2LZCfsSjQyBW6TnUaUIAX9ceL72Bl/t9ngqXepOM=; b=0S6FcWBupK2vhbxTBlxNUX9AWmcP15L2QHfVPII9IJqqTYtkPApW7pEtfbL1uCcy03 V9r37hedKj2cmWd9FvUn1SrKbdFhpTK0XNV00rF7+ofkooto/dX5E2nyODL3eaDRhQwd Ufgtu+Vvl+jTxSUPS18F+o7zoOB0GI2sPYcZkvWkMI7QGwNRJirBaajqYOsB6sBWV7YN aKRsHKZMecY9IH/dO2zTNFrvO2sp5KiXgtsK38UFlZ2D0U3BS0bRHNsTLX452qUCALwE Z1KSBPXaJFyPV2EWeffy3Thrwj6tftw+tymO4f2ea20aDsIqB5JVEE6RUACFYsou5qog INwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-174006-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174006-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-634103f568bsi354026a12.362.2024.05.08.18.29.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 18:29:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174006-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-174006-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174006-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3234F2822AD for ; Thu, 9 May 2024 01:29:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0413813C918; Thu, 9 May 2024 01:29:11 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BADAC13C668; Thu, 9 May 2024 01:29:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715218150; cv=none; b=bfWuDmxr9CZeQkiFR+7moGOvZGxcnVq1G2adRnLW+hxKYcLLDEUpa0Ysu7ZU0Xg76wrrXMN+xwyNEl5DizYsiQ0aMK2GtVGU/e75N0Xp57uz6vBwqIYD4MSNw3zlPoeIY/ykazdDd5z0OL/nUqmmMlq9zjZ1EVaj47Ca49/N4tE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715218150; c=relaxed/simple; bh=qGYdxANQG8fi9Ws+cMkljJA+iEqhORjVzl9kgebQQj4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mAhT9jLBOnjVqjL4e4ZB5DRoCOE8bquzcjrwZDEr2zgyP51nB34b0m+jgeF+3MTpelxZadqaPhDGqdakQe0d9kd72xOJDXLQCwTSddt1Zo4kaIiK1vsFS1PBIMSTPJ2vDi2tn0KcwNX8psAPhyDcx84FtAIzeuPT44ywdRyJnzg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VZZD62wR2z4f3nKS; Thu, 9 May 2024 09:28:54 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 465151A017F; Thu, 9 May 2024 09:29:04 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgDHlxDeJjxm5MuXMA--.59814S5; Thu, 09 May 2024 09:29:04 +0800 (CST) From: Yu Kuai To: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, song@kernel.org, xni@redhat.com 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 md-6.10 1/9] md: rearrange recovery_flage Date: Thu, 9 May 2024 09:18:52 +0800 Message-Id: <20240509011900.2694291-2-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240509011900.2694291-1-yukuai1@huaweicloud.com> References: <20240509011900.2694291-1-yukuai1@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgDHlxDeJjxm5MuXMA--.59814S5 X-Coremail-Antispam: 1UD129KBjvJXoWxuF4UWFW3Cw47urWfXFy7ZFb_yoW5WFyrpF W0k3Z3Xr4UAry7ZrZxKayDX395ArW0qFy3Ar9xWr98tasYka1fAF4UWa4UJFWkt347ta12 qF1DJF13uF4jvw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBE14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jr4l82xGYIkIc2 x26xkF7I0E14v26r4j6ryUM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2 xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v2 6r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2 Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_ Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMI IF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUSYLPUUUUU = X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ From: Yu Kuai Currently there are lots of flags and the names are confusing, since there are two main types of flags, sync thread runnng status and sync thread action, rearrange and update comment to improve code readability, there are no functional changes. Signed-off-by: Yu Kuai --- drivers/md/md.h | 52 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/drivers/md/md.h b/drivers/md/md.h index 029dd0491a36..2a1cb7b889e5 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -551,22 +551,46 @@ struct mddev { }; enum recovery_flags { + /* flags for sync thread running status */ + + /* + * set when one of sync action is set and new sync thread need to be + * registered, or just add/remove spares from conf. + */ + MD_RECOVERY_NEEDED, + /* sync thread is running, or about to be started */ + MD_RECOVERY_RUNNING, + /* sync thread needs to be aborted for some reason */ + MD_RECOVERY_INTR, + /* sync thread is done and is waiting to be unregistered */ + MD_RECOVERY_DONE, + /* running sync thread must abort immediately, and not restart */ + MD_RECOVERY_FROZEN, + /* waiting for pers->start() to finish */ + MD_RECOVERY_WAIT, + /* interrupted because io-error */ + MD_RECOVERY_ERROR, + + /* flags determines sync action */ + + /* if just this flag is set, action is resync. */ + MD_RECOVERY_SYNC, + /* + * paired with MD_RECOVERY_SYNC, if MD_RECOVERY_CHECK is not set, + * action is repair, means user requested resync. + */ + MD_RECOVERY_REQUESTED, /* - * If neither SYNC or RESHAPE are set, then it is a recovery. + * paired with MD_RECOVERY_SYNC and MD_RECOVERY_REQUESTED, action is + * check. */ - MD_RECOVERY_RUNNING, /* a thread is running, or about to be started */ - MD_RECOVERY_SYNC, /* actually doing a resync, not a recovery */ - MD_RECOVERY_RECOVER, /* doing recovery, or need to try it. */ - MD_RECOVERY_INTR, /* resync needs to be aborted for some reason */ - MD_RECOVERY_DONE, /* thread is done and is waiting to be reaped */ - MD_RECOVERY_NEEDED, /* we might need to start a resync/recover */ - MD_RECOVERY_REQUESTED, /* user-space has requested a sync (used with SYNC) */ - MD_RECOVERY_CHECK, /* user-space request for check-only, no repair */ - MD_RECOVERY_RESHAPE, /* A reshape is happening */ - MD_RECOVERY_FROZEN, /* User request to abort, and not restart, any action */ - MD_RECOVERY_ERROR, /* sync-action interrupted because io-error */ - MD_RECOVERY_WAIT, /* waiting for pers->start() to finish */ - MD_RESYNCING_REMOTE, /* remote node is running resync thread */ + MD_RECOVERY_CHECK, + /* recovery, or need to try it */ + MD_RECOVERY_RECOVER, + /* reshape */ + MD_RECOVERY_RESHAPE, + /* remote node is running resync thread */ + MD_RESYNCING_REMOTE, }; enum md_ro_state { -- 2.39.2