Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2402249lqo; Mon, 13 May 2024 18:36:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmvUrOxNwgy/XGoHFI9uZ7J3Um5kC3Vpn5XCqYwbeSNik7hs3pHLdnLCeA2D4bU3w1GiRGJFvxaJgRZWUMSEsQpPYDh2fpHleW54p1/g== X-Google-Smtp-Source: AGHT+IFvwOn/QnNLQ9ifExxbNRRmYSdTTH88n+0yK9dt49ASPdb4nGbCSJ1yl6tid8g7Vnd7UV65 X-Received: by 2002:adf:f342:0:b0:350:4670:8aa4 with SMTP id ffacd0b85a97d-3504a954db7mr7433401f8f.46.1715650584623; Mon, 13 May 2024 18:36:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715650584; cv=pass; d=google.com; s=arc-20160816; b=d9hlT/SK3wbfNgOMdlBU4O2NbPSafHmHciTzUmuhpK9JT15uYG2VRS2ACk+4YBVS3S 7S1PlldHcAGpK/Md7dAMy6EK9DrCG+Zf+B6zW1/B4+EIyRzKSDbaona8BxDlDszc9Ui6 vI+S2xj0gdWkuKEeqH6Tb+xDuchHCmBP9Z94qFsBreIwvLA8ndgpLeD/EkO9ObV7mrud r8wcTKumS1IG0rruNG1izy6sh4SOyQmT7xkfjQZ1wlmPaA75FW5eHTh8LFTgAUScoSdD d2EndZbwxQLvt2fW/UHahN1jNUXfHun7SjiOIBBYIGJvyCusF+IpBaQ7XMwqB9JyqmN4 5Vfw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=pIMeMpTid1JQEB6chSLBCh1HuPkCmNZ++phinJtCapQ=; fh=xgRDKIMDcLgXaVuZYpdlfGeZYlROWW2E4LLPXP8w88c=; b=1BGGyGIFkFMKKmWsEQcByRHg+fHWTEM/f6Y4UoeH2RaF7zmVh8Iq5yXZX2hfqfRJj/ 2ntEL2BDHK1SfHd0NQ2TqQgrWeY2PzwqwyFAdu18MMr0e44Nx8+0Hd+CtD38agQq0lT3 9bV+AiDLBGMb5B0PuoWzL2X7DqrordLBehwxEYbaoVn0GDB470igmHsX1umINVam3OvM vJ8Q+NJMGlyFCpfn2l5HPnz0/vZDFCJWH33M4UWHNGvXdaH7TomYsbrAi/Qy1UlgIEGO 0ns6R9eWi0M/5+ViFaAiObAosnkBbXw7hXFp5Gt0w1u2IVn166Y4ZJgQEwNDvkSAyEQZ Q0dg==; 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-178241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178241-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17c2cd4fsi584375566b.1051.2024.05.13.18.36.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 18:36:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-178241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178241-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 04E001F239B6 for ; Tue, 14 May 2024 01:36:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2A266FBE; Tue, 14 May 2024 01:36:12 +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 CA44117C2; Tue, 14 May 2024 01:36:08 +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=1715650572; cv=none; b=Arb/mYHemJOelXDqdolVfxOAHyz3asJjz8Bt/Kc1EFGGLKHvjcboz7M7CINm2NdWOjIiFnl8G0g1GpYWmGGXWCv4Fe6Gy0ZpZit3ifxFdVsU71xTGE+GV1lpqeqLe+zp24sd0gvhNG+Ph0VXpshXeH43sY1ISQBhADqvamIANX8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715650572; c=relaxed/simple; bh=Upsul9NcofEKR67TbzR1JI6SV64CmPDbuIlZIz0tIg8=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=L2i3piMWhEX43vQdjskcAKlLhKDH5pr6nTOaXI9fYFLWIqrGNpl1rp09EyLbDJBJux8AQBi8WdrvERDl+V6Ffg9w2l0NIO2f7Wly4L2R/RvwqfPMstnT5KeWziODPT4Mm5TrkscFveTprasrrDothaJKmGOMnnXApDIfqVbptks= 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 4Vdf7t4QCcz4f3l1s; Tue, 14 May 2024 09:35:54 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id B69421A016E; Tue, 14 May 2024 09:36:04 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgBnOBECwEJm7mVnMg--.15054S3; Tue, 14 May 2024 09:36:04 +0800 (CST) Subject: Re: [PATCH md-6.10 1/9] md: rearrange recovery_flage To: Mariusz Tkaczyk , Yu Kuai Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, song@kernel.org, xni@redhat.com, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20240509011900.2694291-1-yukuai1@huaweicloud.com> <20240509011900.2694291-2-yukuai1@huaweicloud.com> <20240513170958.00002282@linux.intel.com> From: Yu Kuai Message-ID: <46448c77-894a-1ddc-30b3-42ca00b6ecd4@huaweicloud.com> Date: Tue, 14 May 2024 09:36:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240513170958.00002282@linux.intel.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBnOBECwEJm7mVnMg--.15054S3 X-Coremail-Antispam: 1UD129KBjvJXoWxAFykGrWxAr1xJF4DtFykuFg_yoWrXry5pF W0kFn5Zr4UZr12yry7ta4rX39Y934FvFy5ArW3WF98JasYk3Zayr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ai wrote: > > There is typo in subject. Yes, :) > >> 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 { > > I don't know if it is better readable but I know that Kernel coding style comes > with different approach. I used it for enum mddev_flags in md.h please take a > look. 1) There are two kinds of flags here, for sync thread running status and for sync action, I think it's better to distinguish them. 2) The names are confusing, for sync thread status I prefer SYNC_THREAD_xxx and for sync action I prefer SYNC_ACTION_xxx, I plan to remove the flags to sync action and replace them with enum type in patch 2. > > Also, I get used to comment above, not below enum values but I don't have strong > justification here. I do comment above here. Thanks, Kuai > > Thanks, > Mariusz > > > . >