Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2691348iob; Mon, 16 May 2022 04:13:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeq3Y5+j9YzpQdogpiv/zgEvzSna1WoZZh9S6OTPlMhFAsLk4Vabf/v6yDtfQxhYvyrxu/ X-Received: by 2002:a17:906:5d05:b0:6f6:6353:c325 with SMTP id g5-20020a1709065d0500b006f66353c325mr14760443ejt.749.1652699639428; Mon, 16 May 2022 04:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652699639; cv=none; d=google.com; s=arc-20160816; b=x4y9rJvPX+y9ffbdOS6v4UGt0l6hJsegQGEW2pKIW0E1dXFhw0rh8rX/fkwnTh7T5T JwRxxDhHlvQkplfFmcg1daTrxmuLcWkq5hHX5WY9VHrfmBixcGJEo/vUIVcSde6mQtHq rBZcQ//4pbEnW9/33igeDOp26/EOCB5TBLFtrb7PsdsZtqKjfpUXE30YPWkvep3DA9aS /QNdcriDObm8TNNApLdXsag0PRdJ2mX+6qciQRvMQ6BSOiaKL4rL5O6OtBg6hL3VNAiD 5SIRIcQIiS84eolyGSh90eklHRiY9BX9dEK3b3WZ8As6/JHOs6pf2KANUb69f9PWUWJ0 FStg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=HBr6RsK832/kNhjiBHy048AvZza2SX5/1dw9zvCd9GU=; b=aasR0Dbcw5pDtdvLpZQuKD9hlCO2z0BHp+ljIiENPvV6mo7YSQeKNkHyp4Vu5k09lQ IKE5sJ4M7thht7zzHKKjcgyfaH/RWONihX5JSGUPtuD6J6fvgEEuEW5HcgZ+56cwt0Ye l4V1jEniwSwzMTOHkUs6hLVSnq6lH1u7A4XV4sa9wWvWSMp+YI++5TkG8AcxFk8KhvEL 5XEZ8bay9gQb6SaM/izvd8puHM3sE8gOBwKh86n1aZy4E97xIb4oltPkWjbWtv0Ww3PN 1WyuKoAc/YmOvSAU1myMklAiJotui4TWjLvMGaeUADT5/VGnz+DSZPfbumdP5elqapty Cxlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HKRwNLZs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji13-20020a170907980d00b006fa88dad76dsi10600176ejc.193.2022.05.16.04.13.29; Mon, 16 May 2022 04:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HKRwNLZs; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239260AbiEPHgo (ORCPT + 99 others); Mon, 16 May 2022 03:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241393AbiEPHg3 (ORCPT ); Mon, 16 May 2022 03:36:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0516DDE0 for ; Mon, 16 May 2022 00:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652686584; 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: in-reply-to:in-reply-to:references:references; bh=HBr6RsK832/kNhjiBHy048AvZza2SX5/1dw9zvCd9GU=; b=HKRwNLZsOOXEe3AKQxiKlksCMAASv2JIRaiH8xsbXo2KIeTQ1QwEdaF99e6fSa0tUl3KOo 3WrTfszg13RiArw+89O6ackXmHm410JR/v4kRqHPEgfmo5ZIU40sshEaMCU3ZfvBjN67N8 VwUux17td6g4a70kFMaL5S2akj2JdOs= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-401-G2WsWnUDMvKiskE2BhqAqw-1; Mon, 16 May 2022 03:36:23 -0400 X-MC-Unique: G2WsWnUDMvKiskE2BhqAqw-1 Received: by mail-qk1-f197.google.com with SMTP id z12-20020ae9e60c000000b006a0e769f9caso10061903qkf.5 for ; Mon, 16 May 2022 00:36:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=HBr6RsK832/kNhjiBHy048AvZza2SX5/1dw9zvCd9GU=; b=hS0x0TeMF4ooYv41mwT/JrwrgPd8wxKodm7UAFwOfIAo98zQlDDKCHdYgb3CbU3OgH DWTINJKguTh6rSf2Mq06ZIqFwoj8Pu1g3/TuARne1FsV9knqd8TGGUWIgkEJt/qp0OcK VBn8pGHzTuXnchr2sS4YnQ5j+SjD7JhI4FKyGtsMeXHNABD4xt6Ie2hs9WpXb3tgloZO YfzLsnswH/nUD5DDQWDbDTdbLunQtVeJ+ZnK4zQiUsJPndenFmHo1tIjwgdvzKhWK7/6 q053Pkt/BL42YUGo6/IyAaVtJQYOAPeY94iggY/jdZq5artyF5SHy3XKu49jDXVPBWQO nANg== X-Gm-Message-State: AOAM530xRvqUM+BbChXWJ0cldCUhg2dMYcdbHOsru9Tct9o+EUeikbT3 YRoLhQWk9g82+RwxplpZ3D5yphgrTu1Ksve+/5yJgb+1zFQVrasGrm7bwJjh8kh9vKtuabCNpAP JcuAag/LwgX53ebEnYEG9dw== X-Received: by 2002:ac8:4e8c:0:b0:2f3:d53a:add3 with SMTP id 12-20020ac84e8c000000b002f3d53aadd3mr14235510qtp.300.1652686583192; Mon, 16 May 2022 00:36:23 -0700 (PDT) X-Received: by 2002:ac8:4e8c:0:b0:2f3:d53a:add3 with SMTP id 12-20020ac84e8c000000b002f3d53aadd3mr14235496qtp.300.1652686582917; Mon, 16 May 2022 00:36:22 -0700 (PDT) Received: from zlang-mailbox ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v6-20020ae9e306000000b0069fc13ce23esm5424130qkf.111.2022.05.16.00.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 00:36:22 -0700 (PDT) Date: Mon, 16 May 2022 15:36:16 +0800 From: Zorro Lang To: Ojaswin Mujoo Cc: fstests@vger.kernel.org, riteshh@linux.ibm.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] common/rc: Modify _require_batched_discard to improve test coverage Message-ID: <20220516073616.x3sauzctypcxstet@zlang-mailbox> Mail-Followup-To: Ojaswin Mujoo , fstests@vger.kernel.org, riteshh@linux.ibm.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220516063951.87838-1-ojaswin@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220516063951.87838-1-ojaswin@linux.ibm.com> X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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-ext4@vger.kernel.org On Mon, May 16, 2022 at 12:09:51PM +0530, Ojaswin Mujoo wrote: > A recent ext4 patch discussed [1] that some devices (eg LVMs) can > have a discard granularity as big as 42MB which makes it larger > than the group size of ext4 FS with 1k BS. This causes the FITRIM > IOCTL to fail. > > This case was not correctly handled by this test since > "_require_batched_discard" incorrectly interpreted the FITRIM > failure as SCRATCH_DEV not supporting the IOCTL. This caused the test > to report "not run" instead of "failed" in case of large discard granularity. > > Fix "_require_batched_discard" to use a more accurate method > to determine if discard is supported. > > [1] commit 173b6e383d2 > ext4: avoid trim error on fs with small groups > > Signed-off-by: Ojaswin Mujoo > Reviewed-by: Ritesh Harjani > --- > > Changes since v1 [1] > > * Changed $RET to a local variable > * Fixed the grep command > > [1] > https://lore.kernel.org/all/20220401055713.634842-1-ojaswin@linux.ibm.com/ > > common/rc | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/common/rc b/common/rc > index e2d3d72a..f366e409 100644 > --- a/common/rc > +++ b/common/rc > @@ -3858,7 +3858,13 @@ _require_batched_discard() > exit 1 > fi > _require_fstrim > - $FSTRIM_PROG $1 > /dev/null 2>&1 || _notrun "FITRIM not supported on $1" > + > + grep -q "not supported" <($FSTRIM_PROG $1 2>&1) > + local ret=$? > + if [ "$ret" = "0" ] Oh I forgot to ask why we need to add a variable (ret), to record the return value at here. Why can't use "$?" directly? e.g. grep -q "not supported" <($FSTRIM_PROG $1 2>&1) if [ $? -eq 0 ] Others look good to me. Thanks, Zorro > + then > + _notrun "FITRIM not supported on $1" > + fi > } > > _require_dumpe2fs() > -- > 2.27.0 >