Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp944028lqj; Mon, 3 Jun 2024 06:00:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHoUORssE5VMkukYVnT9zbAPwu/RNcdnL9FuMIMVSBgcvtumyHuB+UrDOcRxngT27r57Fa7wOIX/dfe5NMxGIz6ORrFc1ipCwv0+0NtA== X-Google-Smtp-Source: AGHT+IGeISYyo1SCSFz6jnKLri8zfSFxoL2HmQVkGI0geFySATmQLYC3aLt4my7uvsYo2DYy827M X-Received: by 2002:a17:906:a0cc:b0:a5a:896e:d0b4 with SMTP id a640c23a62f3a-a6820516d07mr594779966b.26.1717419623875; Mon, 03 Jun 2024 06:00:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717419623; cv=pass; d=google.com; s=arc-20160816; b=H/CRReuq7d8xccsizv7MPwaHXVdyLFlqwuitRwbFd7cPubmeSQHWGjVPRRfOgXC/NI zNjHPPLAj/ZioRhNXrQEX8mHr6O+AvBt7s939CxGwfbEgkq6RqaNktywP/+0Wglh2nSq d8RyabnN3TJ3sCNbetp1V/qq01WBHA9ps8PpnhNh/xF0EaUOu94Q3eLkbgWeNN7dfQi+ 0zZHoDwN3kbd5qrftUn1NjfdG2oBXRo2YLgSWIiIhpZEngM0vLrgg36R+eAAtzewqtGl e/cH3rU8MFxGQg01vsCytFpv6Y394i2b+jOGuDj3zkTQrWuxfmkVqNr7VIGjClrdR1ht esqw== 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=Y90TPq9o37HWr7JmYIkqIhISuUp2spwAYMGJY7jbOCg=; fh=1LhuwRtrwnHwkJ8SSfr9g2yPev2+fxl/FqZerKdeGVc=; b=WyR6X1zgKq5jMgHP6i00Lr07aRSSXNOUfaEHpFFNgn1t/PFV4P41g6mWtYCcHKT28K qhvm9pNhRThGRRrhRJXh3iarX029/D+EWMoe1hW8sPyF/r+yHkTb6bjlnMGA4lLmjXFb fuF3KSmG2e09krhsSnNf6EVZ7l4r2Gxz4vaq1aRvq8hxqQQLyzgT3qHmZ5AmodSnminH kNfMnY9fnAfG49oupZLr9Vel3byfRlSZ907bP/YOkyvOGSqrcQsmEufVe1wQMkaEJXyH /3NA53Hh9VJDzibOQ3rAtaJjqREIh9EnJh65t9NSZIDIgcNOjaOLC4IsA2Lxge/eRDW6 +26Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-199149-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199149-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68f178d220si164419766b.995.2024.06.03.06.00.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 06:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199149-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-199149-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199149-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 412CF1F25EB6 for ; Mon, 3 Jun 2024 12:58:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DDD612D214; Mon, 3 Jun 2024 12:58:17 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 C91DB12C54D; Mon, 3 Jun 2024 12:58:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717419496; cv=none; b=PSScjCAbO0u/TshJzjFwAZAULtrMUHC0dS1QRJkpLlAgygXyEuJs66cE6LWMCTNM5LprUYoJBjhMJuPhjNsdGR0kN/BMd8kWUO9TOo9/FSijzDqxfPg9XIMzGM31580KuQ58M90YEVR60VV89qex+4DArp4X7Gf/yhbbqqf4bgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717419496; c=relaxed/simple; bh=gdmUcErX0vsOeRarPKhA1OeJyebQSfVxmZsfIBoqpRg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ej+uc+7+vy1WwZa7D2SKqvt+tWrwBbQkv90mEx0U04FEUq5918YXD1LVymoZTJvbKGTgBgqp//+f1/o0K0cFlzg3dwGeaKt2q1u4fBkX4mHP0Jzhu2zn7c5hoOLzFGJ6eI4RR9cBNZk9uY6emIzwcpfjawR/snrpGuchWb4vmVk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VtDFP1lqYzwRLd; Mon, 3 Jun 2024 20:54:17 +0800 (CST) Received: from kwepemm600009.china.huawei.com (unknown [7.193.23.164]) by mail.maildlp.com (Postfix) with ESMTPS id 5B033140417; Mon, 3 Jun 2024 20:58:11 +0800 (CST) Received: from huawei.com (10.175.104.67) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 3 Jun 2024 20:58:10 +0800 From: Yu Kuai To: , , , , , , CC: , , , , , , Subject: [PATCH 01/12] md: rearrange recovery_flags Date: Mon, 3 Jun 2024 20:58:04 +0800 Message-ID: <20240603125815.2199072-2-yukuai3@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240603125815.2199072-1-yukuai3@huawei.com> References: <20240603125815.2199072-1-yukuai3@huawei.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 Content-Type: text/plain X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600009.china.huawei.com (7.193.23.164) 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 --- 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 ca085ecad504..170412a65b63 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