Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2637143iob; Mon, 16 May 2022 02:46:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7Y4OHxGB3K5CUgIl+TE5ryQtVXC8pD223fcQmYHXT0xKKuRO34rlR2RUYP4ruy7SDFldN X-Received: by 2002:a17:906:b50:b0:6f3:ce99:3c39 with SMTP id v16-20020a1709060b5000b006f3ce993c39mr14220655ejg.52.1652694400877; Mon, 16 May 2022 02:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652694400; cv=none; d=google.com; s=arc-20160816; b=aqHO8tlvpjy8JxWq3KgfBz8XvAYFwjlpEjcUbpbBK5KZv0mjlLp38xEbWxo/vCk4T0 zR6DzI/HLCRfmn9r3ZuALG/oU3/KXW+aMtO1FmSbQMJGaZSlz0BimmmtIbDZ9ufkthCS 6KxlfvP6nIPYGHDD3iLzbR6ZFN8qwUXFxZ0dCbFDVXCe5jIEYUy/93DjBGB1UvtLT6UA ZhGRX2e8E6L7fkiwiMTun0nFu9daCN4y0WX5c5P2+jE4RhzOEXf5wD2rO+3bKlKKHQu9 ylI75TJFfidX20giDS8f+Nq1ruWXlXz9kIGzkTVICI8PnlCQmOu7CLAITaBFF/gzXSLA e6ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=DcLL7y2N8X7R3Q4gD9zmQ+4CbjMGdyO06C1r8lZBc54=; b=g0RB9iMgckJKUurnjGZf8hjYnS2wZPvuNebWGe7GeVT7WFhmBpt7lZGnT17dE6Q7vd m1aBqmCEgeeNwDMGPWD4S7GbHsYHZIQ1hNp6ixQPxrQdWeS64CO70ObosAbftsP8YH3q H0NpblStToYhlT2jpKGUM9eDmueDo6ron+ZTnot0Z2m0/cYTiACFV0hQLsvPowYBHZGx wSU/IeZ+pO0Y1/MG5qHXBPByB7tiNgwQnP1g8zpbHAMOK0w08DkpBgPjxsz1fT4rDp7C qCVYgnYc1NcRUKpTh8eAuWcc6XTvPg4IstJQuaVzrLnpTOOYT2UXV1NPktpHZlqp52iO 1aRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=A4OWmrxl; 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=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a1709065d0f00b006e7f21f913dsi10525313ejt.233.2022.05.16.02.46.07; Mon, 16 May 2022 02:46:40 -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=@ibm.com header.s=pp1 header.b=A4OWmrxl; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240350AbiEPGkE (ORCPT + 99 others); Mon, 16 May 2022 02:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240347AbiEPGkD (ORCPT ); Mon, 16 May 2022 02:40:03 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D60B338AD; Sun, 15 May 2022 23:40:01 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24G5OEn7005015; Mon, 16 May 2022 06:40:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=DcLL7y2N8X7R3Q4gD9zmQ+4CbjMGdyO06C1r8lZBc54=; b=A4OWmrxl4EwYLoZN+DV+NyVIktOcnE3JI7neX2y9nshrEr1JoDFm8/ZtORhLR8C2Ji1c FOGlIY742etEPFbXOS7ymqlZZoKHTPBeG0lYesIeDDo3YJuQgahm5kpvjbTtNMjvXG3Z GjAaaT2MNnMOfGEbsWwX1O2JrURC503Ykrgm0XQzeX1kSqIzuaI76n0aZ1lVJVBH3mTT +M9dWmVniMbm1K1QTbG6ud3GkBjyMmJIcRTXnwFjSmjIpH5JKjPY17zmay2oGS21b6TM yLlHksWhMR2LVe3e1tuAWfm66yUsO/QnacR9mN7vYFoAEM0agQNv/gTBPV2kxOvrOfZb tg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g3ge8h771-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 May 2022 06:40:01 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24G6GnNo008856; Mon, 16 May 2022 06:40:00 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g3ge8h76g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 May 2022 06:40:00 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24G68SVB016748; Mon, 16 May 2022 06:39:58 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma05fra.de.ibm.com with ESMTP id 3g24291n56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 May 2022 06:39:58 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24G6dt2B40174078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 May 2022 06:39:55 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C854E4C044; Mon, 16 May 2022 06:39:55 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB16C4C046; Mon, 16 May 2022 06:39:53 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com (unknown [9.43.41.34]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 16 May 2022 06:39:53 +0000 (GMT) From: Ojaswin Mujoo To: fstests@vger.kernel.org Cc: zlang@redhat.com, riteshh@linux.ibm.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] common/rc: Modify _require_batched_discard to improve test coverage Date: Mon, 16 May 2022 12:09:51 +0530 Message-Id: <20220516063951.87838-1-ojaswin@linux.ibm.com> X-Mailer: git-send-email 2.27.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Fc-stSPmQNu3HczXZDnJ9etBJx865QbY X-Proofpoint-ORIG-GUID: VduchDHmEd_R5WWOixWOtniqCL0VB7JF Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-15_11,2022-05-13_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 impostorscore=0 bulkscore=0 phishscore=0 mlxlogscore=752 adultscore=0 mlxscore=0 malwarescore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205160036 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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 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" ] + then + _notrun "FITRIM not supported on $1" + fi } _require_dumpe2fs() -- 2.27.0