Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp8783rdd; Mon, 8 Jan 2024 15:39:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHa6GAKUPU6J4fV5xFcjY1TbRh/+Fm3ycLFPPidj3KO2r24XAi95cw2+wLqdHtEuxSudZaz X-Received: by 2002:a17:906:2b53:b0:a2a:6ff5:ac79 with SMTP id b19-20020a1709062b5300b00a2a6ff5ac79mr77614ejg.150.1704757150498; Mon, 08 Jan 2024 15:39:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704757150; cv=none; d=google.com; s=arc-20160816; b=T5oUDcAurFa9sSCqhI2a+BSHS5S80EaoLaAiG4LDCJhHsW5raPZIhkJY8FPSGsz71N OwHRLiR/9SunjZNFWz3dPA+8CbqsXa9EI2FnaygZJqQScfQg5D+fXbef34Y/4PkK++KD 7hyxv6JqUAQ8CFJA0OMG92ugkTK2U2Zv+4bu1jc9cAmmMNfzTqG1SfbQnJNI3S6rqSTm s0YZjCrkoJKT5IVr1vr/EY3F6Z9O6q+w+4okWfSbSJe2ZCjyTt9tKVTcz8/L8MKUSk7i arYgL4Ewz8hk2BDdE4kQySXL1c8bQ2suPSArKEVBw1e5R6rwIaUKAc8ji7Hui23y8WLq Ld8Q== ARC-Message-Signature: i=1; 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=O3RdfilGcrGZ4KUQFADcPBBu77P7ASqCUFMp09ah60A=; fh=1ZQzoRqTVujMrMQvqbS60Jjo8Alq+FzhfX8iaxIMWGI=; b=BRGZT8DakSw/nuvPAWJMeS5fBDGgBLksXGVYtFL7Lqif3wzh3QdTUy6OTOFepTTbU2 Rd6W6FNEUp6NDm6y1zVJDdG9nLd5ev0JqMzI408X2sdAhlXBekXLPkVEYoQ9enElK7MH 9uW4XNei/H5GgdLNaAhFhnqShaLqsxwByEd/Jz5qiD3C/Smc6av4K8gr07d0F5glC0Qm RwaRNmGFD/metU3Zufd6hNU+KAo3aPVfLtzy9tkNsBDni8knNOMSzqPNURWekQw9D56i EnmaEvZ8xk2JWtedcfk5pNtkPY22/YsEWGq7DkNbzajiE0KfwFugG0kwrulh2GSyOPG9 HwyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZYah3iZg; spf=pass (google.com: domain of linux-kernel+bounces-20191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m11-20020a17090607cb00b00a236e119480si309567ejc.644.2024.01.08.15.39.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 15:39:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20191-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=@kernel.org header.s=k20201202 header.b=ZYah3iZg; spf=pass (google.com: domain of linux-kernel+bounces-20191-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 2BFB51F24075 for ; Mon, 8 Jan 2024 23:39:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE9915647D; Mon, 8 Jan 2024 23:38:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZYah3iZg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2ABC9611A; Mon, 8 Jan 2024 23:38:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9AAFC433A6; Mon, 8 Jan 2024 23:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704757137; bh=O3RdfilGcrGZ4KUQFADcPBBu77P7ASqCUFMp09ah60A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZYah3iZgaBzUvPXExfCgs7qO4qhqij/8ybf6JmCOIZ3ILw9TCDOUbFnzmtMHjrjFP T4pXUq/SBX8lZYs6cOG62PmQ3UMqCuXSRBSX7nh++rBogZniJienSfmw6zNXhl9W15 LNq5lC4smK1B3z/od9YYWVPPG3O9k4eClNs5r93GHKVoDurcME2hyEGJm//1vAehdx G7jUIxgLsDaMRvHEH+Fc4U6JdboNsO2yOpvXrOnc6f0TtQ7cYzE/uTBh0uEfPx9+Z5 ixO16Q22+IQFKE2Cu/E/vpPCuiz9QwW09/8lA8QGgbYa8xQsEG7hwtGvYGSmjJwhHf 8vrtJHSx0HJGQ== Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-50e7dd8bce8so2612590e87.1; Mon, 08 Jan 2024 15:38:56 -0800 (PST) X-Gm-Message-State: AOJu0YyYTXZ/yWb/Jh+L37aQZSAtQFD4ykEMzPGObboDGvBr+abTEv+q lMql5UItvim7pb9CPtGwCe8V3y13KGxYno556Jg= X-Received: by 2002:a05:6512:219:b0:50e:9c17:24d2 with SMTP id a25-20020a056512021900b0050e9c1724d2mr1756873lfo.18.1704757135177; Mon, 08 Jan 2024 15:38:55 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20230927061241.1552837-1-yukuai1@huaweicloud.com> <20230927061241.1552837-3-yukuai1@huaweicloud.com> In-Reply-To: <20230927061241.1552837-3-yukuai1@huaweicloud.com> From: Song Liu Date: Mon, 8 Jan 2024 15:38:43 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 2/2] md: simplify md_seq_ops To: Yu Kuai Cc: mariusz.tkaczyk@linux.intel.com, xni@redhat.com, linux-raid@vger.kernel.org, linux-kernel@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 Tue, Sep 26, 2023 at 11:19=E2=80=AFPM Yu Kuai = wrote: > > From: Yu Kuai > > Before this patch, the implementation is hacky and hard to understand: > > 1) md_seq_start set pos to 1; > 2) md_seq_show found pos is 1, then print Personalities; > 3) md_seq_next found pos is 1, then it update pos to the first mddev; > 4) md_seq_show found pos is not 1 or 2, show mddev; > 5) md_seq_next found pos is not 1 or 2, update pos to next mddev; > 6) loop 4-5 until the last mddev, then md_seq_next update pos to 2; > 7) md_seq_show found pos is 2, then print unused devices; > 8) md_seq_next found pos is 2, stop; > > This patch remove the magic value and use seq_list_start/next/stop() > directly, and move printing "Personalities" to md_seq_start(), > "unsed devices" to md_seq_stop(): > > 1) md_seq_start print Personalities, and then set pos to first mddev; > 2) md_seq_show show mddev; > 3) md_seq_next update pos to next mddev; > 4) loop 2-3 until the last mddev; > 5) md_seq_stop print unsed devices; > > Signed-off-by: Yu Kuai Just realized this introduced a behavior change: When there is not md devices, before this patch, we have [root@eth50-1 ~]# cat /proc/mdstat Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] unused devices: After this patch, "cat /proc/mdstat" returns nothing. This causes some confusion for users who want to read "Personalities" line, for example, the mdadm test suite reads it. I haven't figured out the best fix yet. Thanks, Song