Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp957710pxb; Fri, 22 Apr 2022 15:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNWgxbLIgI+lr8HBgv1KrRD/Ya4UOLe8O7xda6l29SFoKXBkHouxaUgLtgfd7LXJpN95gl X-Received: by 2002:a65:6657:0:b0:381:1b99:3f04 with SMTP id z23-20020a656657000000b003811b993f04mr5590707pgv.512.1650665888089; Fri, 22 Apr 2022 15:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650665888; cv=none; d=google.com; s=arc-20160816; b=do9rlVvoMGLO+Yt5Cjzoue+Bndft+n1N/TBRVPZqeNOx1RQSDRFalML6crECySb9xW MVllN74qitIv9DCCAyU9LIJJ5zId/LA2EVf97WnbFNX0SmPxIGLnRirJbQM4E9uX89hM cL+jzBMTatkhvQypR5EFGTJ9fU5Xzhyc7OYlp6BGwiVZ9IEa/MNKmqDFzHz340i9ubtv esy7Yon3Qbe2fbuM14nvk8kOCrw09bcdp81ojlQIrhfc3vbkov2PB58i9Zp1qGowoG5p jr0mIDxjs8h3l4Nphg1qd0IEQyGT7g0dOtZNpC/vq5BgX5wFe4KJjycdm9WcyifEXSOw AxMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:in-reply-to :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=Yo/kFI+BSfldD1V/KUKvSXECNFfrV5oLt6IFn1wNU9Q=; b=JNUIcPB8/xlMum9/A/Pkd3lhWZEaTT2ybqUIbZqhMNk4gO61J7dMPhF7FjErowAWQT ojR3rUxW61HEa8lViLlAqss6NwJYM8uF1x/OMDSWCHHY0ZaF9+eJX/868JePsWPMV/8u lNVpJbAmO5Uo1tGpe00bWmhlpRtyvHknmORPviFJfkK4ZLomw5vT90EXfTaa/Tkx/JH2 fyiqBxlUPia6tzs01Xv6LXHNbf5oYxTVXKeD2CyJ3Ec9Hjz/MT5MvA9NSIP/invMph01 k+nQwvghyUV6ew+ha9MhevLcpmeUkC+/VClnk5bR6gYOgvMECoPgwbAu2ZWD5VrWvSWo vGAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=JcGWzJ7V; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d192-20020a6336c9000000b003816043f0b8si10059688pga.685.2022.04.22.15.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:18:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=JcGWzJ7V; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deltatee.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 603B225FFFA; Fri, 22 Apr 2022 13:22:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390458AbiDUQIP (ORCPT + 99 others); Thu, 21 Apr 2022 12:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346240AbiDUQIN (ORCPT ); Thu, 21 Apr 2022 12:08:13 -0400 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A1FDDD7; Thu, 21 Apr 2022 09:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:From:References:Cc:To: MIME-Version:Date:Message-ID:content-disposition; bh=Yo/kFI+BSfldD1V/KUKvSXECNFfrV5oLt6IFn1wNU9Q=; b=JcGWzJ7VcxQJJqc9+OF8ur1idR wchgmE+8ce0wMT7T6S0qgdOdwUJX+lhg1kJAP4L+aDqhPb/+UJ51j+Ici4TRvHTypRTDTce+2Ksbl u8IOSnjhKMXbHVIRoApwE/Z8WcpNHObd9BZskXIuUj1SnP0prTn+rqUA+iEWVFyp3o3h3NEbOfGR8 RFx+LOsYgK6nHUOQuge4wQzQHEQTbDxxfvpdfMzdJ85rzbedk6Fa2UVyWtly+PjmqC8LAHwaLlNO7 3BMVhJNGNeyOlQ3vyOERFbgL9zxnClXER9V1Q78SH9TMZXIniFHanEhsHzsVfrmsd/iaow6TkUslI OTqX1Szw==; Received: from s0106a84e3fe8c3f3.cg.shawcable.net ([24.64.144.200] helo=[192.168.0.10]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nhZJ3-00DBQI-QP; Thu, 21 Apr 2022 10:05:22 -0600 Message-ID: <3252df44-5856-c1ed-174e-18748387cdd2@deltatee.com> Date: Thu, 21 Apr 2022 10:05:19 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-CA To: Paul Menzel Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, Song Liu , Christoph Hellwig , Guoqing Jiang , Stephen Bates , Martin Oliveira , David Sloan , Christoph Hellwig References: <20220420195425.34911-1-logang@deltatee.com> <20220420195425.34911-2-logang@deltatee.com> From: Logan Gunthorpe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 24.64.144.200 X-SA-Exim-Rcpt-To: pmenzel@molgen.mpg.de, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, song@kernel.org, hch@infradead.org, guoqing.jiang@linux.dev, sbates@raithlin.com, Martin.Oliveira@eideticom.com, David.Sloan@eideticom.com, hch@lst.de X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 Subject: Re: [PATCH v2 01/12] md/raid5: Factor out ahead_of_reshape() function X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-04-21 03:17, Paul Menzel wrote: > Dear Logan, > > > Thank you for these patches. > > > Am 20.04.22 um 21:54 schrieb Logan Gunthorpe: >> There are a few uses of an ugly ternary operator in raid5_make_request() >> to check if a sector is a head of a reshape sector. >> >> Factor this out into a simple helper called ahead_of_reshape(). >> >> This appears to fix the first bio_wouldblock_error() check which appears >> to have comparison operators that didn't match the check below which >> causes a schedule. Besides this, no functional changes intended. > > If there is an error, could that be fixed in a separate commit, which > could be applied to the stable series? Yes, sure. Though, I'm not 100% sure there's an error or noticeable bug. It's just that the logic didn't match and it made cleaning up the code overly complicated. > >> Suggested-by: Christoph Hellwig >> Signed-off-by: Logan Gunthorpe >> --- >>   drivers/md/raid5.c | 29 +++++++++++++++++------------ >>   1 file changed, 17 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c >> index 7f7d1546b9ba..97b23c18402b 100644 >> --- a/drivers/md/raid5.c >> +++ b/drivers/md/raid5.c >> @@ -5787,6 +5787,15 @@ static void make_discard_request(struct mddev >> *mddev, struct bio *bi) >>       bio_endio(bi); >>   } >>   +static bool ahead_of_reshape(struct mddev *mddev, sector_t sector, >> +                 sector_t reshape_sector) >> +{ >> +    if (mddev->reshape_backwards) >> +        return sector < reshape_sector; >> +    else >> +        return sector >= reshape_sector; > > I like the ternary operator. ;-) > >     return mddev->reshape_backwards ? (return sector < reshape_sector) : > (sector >= reshape_sector) > > Sorry, does not matter. Yeah, I think plenty of people do not, though; it's harder to read with the long line and awkward to wrap. > Reviewed-by: Paul Menzel Thanks, Logan