Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp396227rdb; Sat, 19 Aug 2023 06:13:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGDb5OoEgSipn/6iRGZpZDweKyay+aZuJicf4vYOsnLtkNgejRQotQTmRkLg+u/HO2MZ1S X-Received: by 2002:a05:6871:809:b0:1bb:81a1:f44e with SMTP id q9-20020a056871080900b001bb81a1f44emr2328164oap.3.1692450826358; Sat, 19 Aug 2023 06:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692450826; cv=none; d=google.com; s=arc-20160816; b=wjVjORWIetTncMNDSD7HXfi47OY/kcGdjA1yYTlkQ49D64B1T2dElCNNLcKzOvUrBP y1OGb8kHT1vCss/yospOjLo3TBkdOVyxtz/Yi4/TvnMqWgvfGhHoBtaTCGRVlvHXBTzC bwVcq4HE64BrA1dkD8TNs7JxDodka0+rX4ePN+b0XfcGqrdQerWlAdn7oOcnMxhrAKDh rFebSHGNvEjbajwfB78Y0073PiC51DnQjlM5mSwK1SRL2iwWBoHUodAWSNFmsoQmNuN+ ik1svXWLNRRbYdLDL5NNOTHrzsfba2ihG+Cd13HWdN2D9JEfcWJOEhzzUaaGWtUQCx7Z uGJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uYruoBQxQfLgAAcZfVl+77FVQ2sfNVhXvnA0V/vZQfs=; fh=ryX8xHD9Hz0MOivE76CTTeChrg7If4QQEs+QxDIySSo=; b=EyjKJhm6G7Z7g1Y1XxtQHf68gGgKqsNGGmDW3fcAfff/gM/AYD9ovomJM3flElrKP4 3Kp4K0WnIhON1OK3IFj19LVXQ+j91/hSqwJwayqRmblfRBenvQ/OWNkQ3WCYbsT5IYnu b/vUMBXhYnEBlgKxrOFI8A65qrZrapdO22kIYiqDsWG6Qbfkn44hdQ1Ov0kivYSUH8jv XGsIfTwVQXFf57EYbiDFxnmtTtc3DALNr0nX2u1Orw+L1WwkYnMOleKs/joMxxCyMssA o5he8+iZx5FLnjYKMDJqt5mNWbryMAq62fRr0l2RYlxlCA7mMwGgHhiiFsogaJyxb5po tuLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sMJs4cvF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mj3-20020a17090b368300b00268414272d1si3424310pjb.156.2023.08.19.06.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 06:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sMJs4cvF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3ACF59C5E0; Sat, 19 Aug 2023 01:39:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355435AbjHQVt4 (ORCPT + 99 others); Thu, 17 Aug 2023 17:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355463AbjHQVtc (ORCPT ); Thu, 17 Aug 2023 17:49:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF38123; Thu, 17 Aug 2023 14:49:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 28E726340A; Thu, 17 Aug 2023 21:49:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C074C433C9; Thu, 17 Aug 2023 21:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692308970; bh=Vh7ns8nXAs6t160DrytAoo4IiSGWxufrYdnLXab9+3E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sMJs4cvFuiuLTXFmInpnmeR5WxEX8KInYEzqK7ckfyvBPzE/dFtzdYTTpr+BuUc5+ w/FBRS+WbB0i4G4v30ig8W2SgATGpPFSu4+eHUuCn/Idma8Zob0PPBgiOVZGSu8GzC RvnqA6NdjXoVF3u7KAGI5/sZu4532Vtr+h4Hz+xxibz3QyN2xKCsrIrJwK3gI0KWCE sElRKiHjoP7WbCOQCRYUFBkifjBAFHs+EI9Z+pNmkMMKojfJfM/KsuCJg0oxQHsGkG XVCKNUbk1OfGiDnoXTiXYKKgATRnR7QSAz6nlaAk5Bn/YW4F7lVb8fABbQRBeghuNm D67/5LPfkZQYA== Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-4fe21e7f3d1so300111e87.3; Thu, 17 Aug 2023 14:49:30 -0700 (PDT) X-Gm-Message-State: AOJu0Yw6GBM1oYVwCis5zu/SwNn9RwAj8PZbzfsOxa82ww2WToSNHArm yS1qCB8trYVXx5VOiRdUV1a/7sKEpAj8jIFd/cI= X-Received: by 2002:a05:6512:2822:b0:4f6:2317:f387 with SMTP id cf34-20020a056512282200b004f62317f387mr443850lfb.35.1692308968522; Thu, 17 Aug 2023 14:49:28 -0700 (PDT) MIME-Version: 1.0 References: <20230815030957.509535-1-yukuai1@huaweicloud.com> <20230815030957.509535-3-yukuai1@huaweicloud.com> <20230817095814.00005530@linux.intel.com> In-Reply-To: <20230817095814.00005530@linux.intel.com> From: Song Liu Date: Thu, 17 Aug 2023 14:49:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH -next v2 2/7] md: factor out a helper to choose sync direction from md_check_recovery() To: Mariusz Tkaczyk Cc: Yu Kuai , 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 17, 2023 at 12:58=E2=80=AFAM Mariusz Tkaczyk wrote: > > On Tue, 15 Aug 2023 11:09:52 +0800 > Yu Kuai wrote: > > > From: Yu Kuai > > > > There are no functional changes, on the one hand make the code cleaner, > > on the other hand prevent following checkpatch error in the next patch = to > > delay choosing sync direction to md_start_sync(). > > > > ERROR: do not use assignment in if condition > > + } else if ((spares =3D remove_and_add_spares(mddev, NULL))) { > > > > Signed-off-by: Yu Kuai > > --- > > drivers/md/md.c | 68 +++++++++++++++++++++++++++++++------------------ > > 1 file changed, 43 insertions(+), 25 deletions(-) > > > > diff --git a/drivers/md/md.c b/drivers/md/md.c > > index 90815be1e80f..4846ff6d25b0 100644 > > --- a/drivers/md/md.c > > +++ b/drivers/md/md.c > > @@ -9246,6 +9246,48 @@ static int remove_and_add_spares(struct mddev *m= ddev, > > return spares; > > } > > > > +static bool md_choose_sync_direction(struct mddev *mddev, int *spares) > > The naming is little confusing because as a direction I would expect forw= ard or > backward - from end to start or or from start to end. In this case you ar= e > determining the type of the background operation needed. Assuming that re= shape > is a kind of "sync" operation I would say "md_choose_sync_action". Yeah, md_choose_sync_direction is indeed confusing. Thanks, Song