Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2478772lqo; Mon, 13 May 2024 22:51:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3SOSWEuIvhnbTEl+zfwO4yWoB1d39b/XYgZEckcKYxStg7V+EIzd605KJJzodjPDFSctBpmuhxn2xyW+5BYbM2HxIrldOd1341LTicQ== X-Google-Smtp-Source: AGHT+IG1mGCb4E3hXHkFWPx23xH26tXDdBeQtn5ABPgO9g6HnX99yazbuPn3QLU7V7XwrwX47R9c X-Received: by 2002:a50:9fc9:0:b0:572:7c97:6c58 with SMTP id 4fb4d7f45d1cf-5734d5be310mr7677658a12.5.1715665894836; Mon, 13 May 2024 22:51:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715665894; cv=pass; d=google.com; s=arc-20160816; b=rNuju5LkQmWz+YA5Mfe5qXNOiCMApFNzymysNPrclTLEW7AVcecU//lFYO6GQyR/M3 9GemQjN4LqEj6z9DDsnpyD99Qr6EwS8FxB4lAzZKTJXRunNjiIi8tKDt52dS/w1msfNN IKMv7q26Vlm/SJdTNKZy6cYHIuBGj2MBqnnxmhG9ffyytgE70RW3PpfcOGLHyjRrdRpP 7EyTPJv4n+v31n5a2CjZjqt6MHhLf8QMV/LMxoJO5lHVhOdPgQm/LFLJ/Wdx1vLU0x37 pKY+N7p+2JPjMV3o0YY8sxG05RsKRc0JJBorobAndJ7U2oqRHniWQn3J60SoDjGgqgey 4SQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=FiYLFnKZivRpeJ4PWERZJck4xmYEwFKMbyVtwgpr9ws=; fh=x67MeGgbe29PvdwlHFxeoH+t0FzNZEfKft72LKj1XAY=; b=ChyZYY3su3pOWKW1FhzR74w6Knnn1EmxnXeTwpl69XhJI/okZaZsQxElLcHaLnofbP 01X1UMcYsZ7ed+MCZzledzjJga0M8LawL8OVOnJab/TOnZ6PHUe76FxmV/eSLH8r4Y2w ETF8TQfPCmC9kKdMmPxeeuSGyOpSgL1HOxpCXijo5L2B8xgogNlQV3nYYU6ttGkJn97B l2ZUO8oUnkxbQEhIEMkQF+bwwbopOiMTXb+9QJSma/XTb1VxZ1KG+/dpWaa0wLX5xxVs R6f/dpI+g9UmlafYT2taaKF+a7zO1VpHgX1vPydngk1jHs7W3cqRf897BdCknUYh/qLX criw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JNdtdLAt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-178336-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-574e0a7db44si698762a12.266.2024.05.13.22.51.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 22:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178336-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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JNdtdLAt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-178336-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 65F321F24EF9 for ; Tue, 14 May 2024 05:51:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A94711BF3F; Tue, 14 May 2024 05:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JNdtdLAt" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 217FD1862C for ; Tue, 14 May 2024 05:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715665885; cv=none; b=R4MtmJPDtT/fIpSfeiG4nqX+rxuihGO+IxrMWUxjBaXloHcA8Qu6lIUlBYT8IwL98RP1Qhzn2qUhgIfdBgay80toRgxa8k5uYePv5i/0DMH6CPcXKVZOi8bG17LxtjR1E10FNKUBLhEmclHmhsP/zixPqtozBUWYKuwn7lnE36Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715665885; c=relaxed/simple; bh=OF8o9YDp1xbXXS9pK3U5R7wgQQr0jKjnEAPulQ1fMhg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TDFso+klLiS9iQanMsalXwSvQ4Fqe3fJjAZIhmv4onGoY7j4uUpe5Da1x+b4wELa2NKeRAvWuKMjujCVhhajeauDYXpy91EHFIwbzrRvzL8px80HDSGrAkuYTBSvnnA5+3IMY4YRS/xbIkqyXdZiun45OYcM116Zy7Ib460Dn3I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JNdtdLAt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715665883; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FiYLFnKZivRpeJ4PWERZJck4xmYEwFKMbyVtwgpr9ws=; b=JNdtdLAtKaHHA9AQZiE1aJz/Dd7t7urHw7fKFfEvaGGTYa26ZtplO+wPWcnX2fE60bIGx6 Q0RHj6Rw+rYfzltS51guCYkZW78crNP2R81X3HCC3j63/8F+v5JxotOwhUPffMODzQBPRi POUmw0h6EcLRO8JmHpmTkLaZ8Ydw5Jo= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-PfFsiAmQNgu9AMQxf2CRIQ-1; Tue, 14 May 2024 01:51:21 -0400 X-MC-Unique: PfFsiAmQNgu9AMQxf2CRIQ-1 Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-635f5006685so3533714a12.3 for ; Mon, 13 May 2024 22:51:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715665881; x=1716270681; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FiYLFnKZivRpeJ4PWERZJck4xmYEwFKMbyVtwgpr9ws=; b=Rv9sALptXA7SHVFQP2lpLYPOqktmIcDjhBd4vLDeYNzXoIH13//s/DaNaOVMSp5bzS 50BV0IGobLuyjlNdMB0Dqh5faBCl+0/LtcmptOwD7y/h2dVjeVr0vmtQKc4SdbN0Mrwn vdDQkf/B86XECVueLFJx4AYLHMW9RNI64ZPbDtH/APeEOmAmVPFArQ1GZVnW9uq0E9+T 9ADZN5P3b6PAkgDUhS4dA3PrUJUWJHSmcyTn1nivUeC4j7YYOJGRr1547PGVTQ/fssIf KTL17qwBTOw45FXS79yAWYMymkg+NN5j0S1qaKMctW38jgQjNI7Sr66c3QJqJ8Z6WE3F rDrQ== X-Forwarded-Encrypted: i=1; AJvYcCXbAEFZpKh4G0e0LMqCKnEbEZT6H70ir/YJj/yzO8hxifkEwjFb8g+ho2jBNDuj16prPWPV63PaqW5/IYo9G7pYq6k7mrubMNsJEaub X-Gm-Message-State: AOJu0YxMFkyWH0a+aHF9YuMVb2lXhUc4mFWQPOxIKDBGRuscOh2xFiLh BNF882vO33hHSre4sq0jnc6sxNbpPPTj4EuXBTdNMSfQgBonW1FjabU6eVjJgJ6vVXqxLBMszKl Oy8nYL9EgXLOjfLL6J6/9ArUj1QqqvVgog+CqqxNiuDOD18GeYICVOpv8KLr6SJgKJlaycDHoZf sxhaZ8/0CBn1yZp7chYaVy0FB9vZJ8d6LQrnv3 X-Received: by 2002:a05:6a21:9207:b0:1af:fbab:cfba with SMTP id adf61e73a8af0-1affbabd1e5mr3839099637.27.1715665880386; Mon, 13 May 2024 22:51:20 -0700 (PDT) X-Received: by 2002:a05:6a21:9207:b0:1af:fbab:cfba with SMTP id adf61e73a8af0-1affbabd1e5mr3839080637.27.1715665880007; Mon, 13 May 2024 22:51:20 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240509011900.2694291-1-yukuai1@huaweicloud.com> <20240509011900.2694291-2-yukuai1@huaweicloud.com> In-Reply-To: <20240509011900.2694291-2-yukuai1@huaweicloud.com> From: Xiao Ni Date: Tue, 14 May 2024 13:51:08 +0800 Message-ID: Subject: Re: [PATCH md-6.10 1/9] md: rearrange recovery_flage To: Yu Kuai Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, song@kernel.org, dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 13, 2024 at 9:57=E2=80=AFAM Yu Kuai w= rote: > > 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. Hi Kuai I did a test as follows: echo check > /sys/block/md0/md/sync_action I added some logs in md_do_sync to check these bits. It only prints MD_RECOVERY_SYNC and MD_RECOVERY_CHECK without MD_RECOVERY_SYNC. So the comment is not right? Best Regards Xiao > */ > - MD_RECOVERY_RUNNING, /* a thread is running, or about to be st= arted */ > - MD_RECOVERY_SYNC, /* actually doing a resync, not a recover= y */ > - MD_RECOVERY_RECOVER, /* doing recovery, or need to try it. */ > - MD_RECOVERY_INTR, /* resync needs to be aborted for some re= ason */ > - MD_RECOVERY_DONE, /* thread is done and is waiting to be re= aped */ > - MD_RECOVERY_NEEDED, /* we might need to start a resync/recove= r */ > - 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-err= or */ > - 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 >