Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1159560rdb; Sun, 20 Aug 2023 21:14:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1zrzJzp2iEOWya92loY8dIrrTqOLM3vkhdSLD7+jP71WAjg7A6ed9ewj/VQScBB6KwcBI X-Received: by 2002:a17:90a:e393:b0:268:6ed5:117c with SMTP id b19-20020a17090ae39300b002686ed5117cmr2739558pjz.18.1692591250193; Sun, 20 Aug 2023 21:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692591250; cv=none; d=google.com; s=arc-20160816; b=rACdqxz9mqJKOqPge0y7kP9cXJsUUn99j+9Sf5gP8GCzNsPzm3SDQSnOwSJwHg3D2R KzpDZLums9GCSJIHOXshtJXiUcApi8DEjzKt/l16xEug3g7StjeBU3V/R/pF0zwlL7kZ mqzvggTays8VrimvD3aALcGXWZgMgPEY9KU9iTUhQvoPR9Ed4/1CtMEqebwZxdQjGTk2 BeBpS9xcQed3/A85roBLHnSg8obbtlDnD091UEf5O+8I+TuxFANw8XhmhbToHE7EokLS z9qWiyc/rtelJJ0e9gEA9UNNFJs6igYURf/oC5um/9Zvjw2i9tW16jMbjsUFqO4zDMUi oUCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=xUlCQHTA43slzGg7Y0hJCuTufaGzbyS7uiMimh778sQ=; fh=Wpy5ALp+Ll2G2+HuAyQWIwGSh+duSJIjCgurxaKSusM=; b=H0KniVdbT44u8vUFvi6dzcbJg9AvwaxPtIZTeHWwBwr9UonIYaHaiEvK8Yb/N40inY Oi9+Nh4z/PtLjrZkpDHZTwTUMvAOjbixllaum+OHPtTo7J6SoFEt15B+gD12WtGPjjQl QPFlLFmki14JwGdPcGvahw0+MSxaupW+A8y+tmRt+VSuLjDNmqpsBKXrIRT90D3roqMO vDr0usGU+KsvnCauIkcXXdTA2lGHKAeYUHULDewb2nqAi/hjj7KPXEpKciAF9VWQ1uTl 9szeeetmG0krirGRAtSPXpSoOmtRdBbWrWMd1gtvfFrw7oDot9N+JaMRwb1sK62rg4t0 0SoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fv19-20020a17090b0e9300b00267bb4cfaa7si8272695pjb.88.2023.08.20.21.13.57; Sun, 20 Aug 2023 21:14:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229949AbjHTCn6 (ORCPT + 99 others); Sat, 19 Aug 2023 22:43:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229799AbjHTCnq (ORCPT ); Sat, 19 Aug 2023 22:43:46 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AA59399D1; Sat, 19 Aug 2023 18:44:21 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RSz1C1mV5z4f3jZd; Sun, 20 Aug 2023 09:44:15 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP4 (Coremail) with SMTP id gCh0CgBH1qjub+Fka8+BBA--.16221S3; Sun, 20 Aug 2023 09:44:15 +0800 (CST) Subject: Re: [PATCH -next v2 2/7] md: factor out a helper to choose sync direction from md_check_recovery() To: Song Liu , Mariusz Tkaczyk Cc: Yu Kuai , xni@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20230815030957.509535-1-yukuai1@huaweicloud.com> <20230815030957.509535-3-yukuai1@huaweicloud.com> <20230817095814.00005530@linux.intel.com> From: Yu Kuai Message-ID: <716511c3-9252-dba6-0902-a8231bf444fa@huaweicloud.com> Date: Sun, 20 Aug 2023 09:44:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgBH1qjub+Fka8+BBA--.16221S3 X-Coremail-Antispam: 1UD129KBjvJXoW7tFWDCrW5ZFWDKF43WrW7Jwb_yoW8WF1DpF 47Ga13Cr4UJ3y7Jw1Sqw1kCa4Fkw4xtrWUtry7J3W8XFn8ZryvgFyfKF4vgr95Cry3Gr15 ur4UtFyfCF10yrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkC14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07AlzVAY IcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14 v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkG c2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_ Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUoOJ5UU UUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 Hi, 在 2023/08/18 5:49, Song Liu 写道: > On Thu, Aug 17, 2023 at 12:58 AM 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 = 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 *mddev, >>> 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 forward or >> backward - from end to start or or from start to end. In this case you are >> determining the type of the background operation needed. Assuming that reshape >> is a kind of "sync" operation I would say "md_choose_sync_action". > > Yeah, md_choose_sync_direction is indeed confusing. > Thanks for the suggestion, I'll update this in the new version. Kuai, > Thanks, > Song > . >