From patchwork Thu Sep 21 07:44:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13394299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CE83E7D0A6 for ; Thu, 21 Sep 2023 18:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230033AbjIUSff (ORCPT ); Thu, 21 Sep 2023 14:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbjIUSfX (ORCPT ); Thu, 21 Sep 2023 14:35:23 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0983CA75F1; Thu, 21 Sep 2023 11:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1695319277; x=1726855277; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=//jgfayI2gxFATylMTHPKR4nhlup1IvXvdrWp+Uwio0=; b=ADsvVq35r8BFXsd9kUQzrlY6YXDAfeV0YqX2DkJ4YW9xPaV93ib8QQex Q1+cYRXVtu6q7FrtfKUjwP2odkY3hrPaZSmqbe8APigCfc6vjIaDF0JU0 fe1pVdYfFdAEbzlRT5elEpq3NyEsJttl9BSWo4I/4Wysq39K89iSy1mXr xnlqx133Wq9KezksBcZCkEYQ5TXhPlUR3twZDMzIPBLIZ23Ik7gPGnEo3 aPlvqDve1DmZwaKT1LtExyrD1xh8xSVW7yrinpn5MmBXyDPicwiaDbctF e2LMjcmpwAjCHVKg9u4YQ3XtQItjy6TxieMHENCnZkiBeyqHtVxN784xw w==; X-CSE-ConnectionGUID: 6L1tk2izRUOyYq4Jed+pEg== X-CSE-MsgGUID: 2s3G45f5ScmVl2tHhPm6HA== X-IronPort-AV: E=Sophos;i="6.03,164,1694707200"; d="scan'208";a="349818426" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Sep 2023 15:44:26 +0800 IronPort-SDR: IrhpCBDdBTVOU2Ck4ATeUMRN6AKUl7gF8kEroNGq6w7lWRONoGkucdaePRU8ozJZqQ2SESIxQs Ysx4QNqXnarPAr+SvepcocUigTy7A2A8Hvsewedcx4oowBgkrdPJD9rkpc398AeSzwJuq1N1qv d15k5W8P7PO6rsFKEFEWCuZAMVXjPtYxLGzR9fohcsM2Im1fpNQl5PO0zS2vqD/qA/iQ5rh6fm 8fIzvtjIqUrQllFqaMzBa+vidPvihynI31sqGElE2SB1sqSFT6Vd2AC79caOj2mhI1Fz61Y1IL XTA= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Sep 2023 23:57:00 -0700 IronPort-SDR: eqOXOmvFIOlPWL/bj9AwcCpxqzkST0fz2jjI1FCfKOs7HR47zVrnteMiczJUc0yFI/FrF4I5Tu 0le9t/oWTpoGKcUUHEiAyJlH3DB+eBCovTpLEHauQhM9PX1Bk5ecV8aihUw254fTx8Z+MUARz/ k8pBX78nrEbgwaFaJnzaBSkIF9u+43fINukTm6irWX77qRxvJM0BoMdJXuUVKSinu6V6ob0G+V 67cRSpf+0vJ1Kgd8oqA3akOb4pmpfguOZstoavpBANIEAtiHPUuurRLa1iHZM6TK+YZyndK7Ro Fhs= WDCIronportException: Internal Received: from unknown (HELO naota-xeon.wdc.com) ([10.225.163.94]) by uls-op-cesaip01.wdc.com with ESMTP; 21 Sep 2023 00:44:22 -0700 From: Naohiro Aota To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Naohiro Aota , Filipe Manana Subject: [PATCH v3 1/2] btrfs/076: support smaller extent size limit Date: Thu, 21 Sep 2023 16:44:07 +0900 Message-ID: <1e344c6d594254f68430580019b6b76d5651428c.1695282094.git.naohiro.aota@wdc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Running btrfs/076 on a zoned null_blk device will fail with the following error. - output mismatch (see /host/results/btrfs/076.out.bad) --- tests/btrfs/076.out 2021-02-05 01:44:20.000000000 +0000 +++ /host/results/btrfs/076.out.bad 2023-09-15 01:49:36.000000000 +0000 @@ -1,3 +1,3 @@ QA output created by 076 -80 -80 +83 +83 ... This is because the default value of zone_append_max_bytes is 127.5 KB which is smaller than BTRFS_MAX_UNCOMPRESSED (128K). So, the extent size is limited to 126976 (= ROUND_DOWN(127.5K, 4096)), which makes the number of extents larger, and fails the test. Instead of hard-coding the number of extents, we can calculate it using the max extent size of an extent. It is limited by either BTRFS_MAX_UNCOMPRESSED or zone_append_max_bytes. Reviewed-by: Filipe Manana Signed-off-by: Naohiro Aota --- tests/btrfs/076 | 23 +++++++++++++++++++++-- tests/btrfs/076.out | 3 +-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/tests/btrfs/076 b/tests/btrfs/076 index 89e9672d09e2..43dbff538278 100755 --- a/tests/btrfs/076 +++ b/tests/btrfs/076 @@ -28,13 +28,28 @@ _supported_fs btrfs _require_test _require_scratch +# An extent size can be up to BTRFS_MAX_UNCOMPRESSED +max_extent_size=$(( 128 * 1024 )) +if _scratch_btrfs_is_zoned; then + zone_append_max=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/zone_append_max_bytes") + if [[ $zone_append_max -gt 0 && $zone_append_max -lt $max_extent_size ]]; then + # Round down to PAGE_SIZE + max_extent_size=$(( $zone_append_max / 4096 * 4096 )) + fi +fi +file_size=$(( 10 * 1024 * 1024 )) +expect=$(( (file_size + max_extent_size - 1) / max_extent_size )) + _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount "-o compress=lzo" $XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \ $SCRATCH_MNT/data >> $seqres.full 2>&1 -_extent_count $SCRATCH_MNT/data +res=$(_extent_count $SCRATCH_MNT/data) +if [[ $res -ne $expect ]]; then + _fail "Expected $expect extents, got $res" +fi $XFS_IO_PROG -f -c "pwrite 0 $((4096*33))" -c "fsync" \ $SCRATCH_MNT/data >> $seqres.full 2>&1 @@ -42,7 +57,11 @@ $XFS_IO_PROG -f -c "pwrite 0 $((4096*33))" -c "fsync" \ $XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \ $SCRATCH_MNT/data >> $seqres.full 2>&1 -_extent_count $SCRATCH_MNT/data +res=$(_extent_count $SCRATCH_MNT/data) +if [[ $res -ne $expect ]]; then + _fail "Expected $expect extents, got $res" +fi +echo "Silence is golden" status=0 exit diff --git a/tests/btrfs/076.out b/tests/btrfs/076.out index b99f7eb10a16..248e095d91af 100644 --- a/tests/btrfs/076.out +++ b/tests/btrfs/076.out @@ -1,3 +1,2 @@ QA output created by 076 -80 -80 +Silence is golden From patchwork Thu Sep 21 07:44:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naohiro Aota X-Patchwork-Id: 13394659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C60C0E7D0AA for ; Thu, 21 Sep 2023 21:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbjIUVPm (ORCPT ); Thu, 21 Sep 2023 17:15:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233074AbjIUVPP (ORCPT ); Thu, 21 Sep 2023 17:15:15 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD039A75EF; Thu, 21 Sep 2023 11:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1695319276; x=1726855276; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J5/Mm01U/8HkGqBt2NFeAHTMA49ugVf9griRdMZM9bc=; b=OjT/9BopjpGX/QNuLb4abuT0d4KM+xdm3f9ieaUJIXwk5KptG7rXgUQG KwlBNj0GlFa6JcuiiEvsmHFwbGR0J0FzOYt5UcykpuEOHdevfYLUal3Ia mDXm8EhjOZwkN2yVVIqt1E3kdeG4GLFAiBCuJIVpXaTXBU3PKy3NNbXeL nkOhm888l2TyelQ/t64vuO8dQCiqn118auUf2+7gOYIHI2sVioq8EPETH BaoSRjP78diBsuCqfeXEejBkOnS5TnDCqf8t1IA45XfgPmuja0xwRxgOX KBJTP0vhgvxbahFgF9tsZotInxw3LFidC+FBzoKVExV8knC9Zf1lRI1fX g==; X-CSE-ConnectionGUID: KC3GDAmJQb+sCHBT0IJTIw== X-CSE-MsgGUID: W6TQwcbCS2eFrOn2iQW9kA== X-IronPort-AV: E=Sophos;i="6.03,164,1694707200"; d="scan'208";a="349818423" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 21 Sep 2023 15:44:24 +0800 IronPort-SDR: 9njPc3Ld3pehKnMA4GMgoGnwp3W5DkuYVIBxLNWbvFlyEqb3czJyp8wO5axNlL1HnV+RNSX0Lb 478Of/WrC79BO7CSOwluqDe+jekcXxdnNkK/ulLRsKsJ+N9tbyD5v62jxkQLJVd5iekEtWu6JO 8X0WHUbXznlDB712d/N0JxdLVb+d3IrGPQVp0TJf4hJAmWquBcObeM36QcLhBSJUClmicYzgD/ Skiu/ElIhp5dx2Q7wC8jXBSbVDrI016k0QszEgHciskFDrrB182mGdRellVNxprwfDVK9weTTf baA= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Sep 2023 23:51:18 -0700 IronPort-SDR: rF0sQVydsUig2QapScE+ESHXYYV/2xwQ0BDCzBhdhS8rzjf1gV4VqizBjMOauCwYwDtQqTrVbQ nMoh5LNSbWwwt0BqgTRYuwAWwU7slTTG8g7ZJBtsNin/T/8jC0+JHgzyyOH8tpV1F7cTA3CSis PUAZqIHETGziMISImKxj/viu8V4+cjl7spkF/w1eS1bYvPhp2oHild3j/ac3Iv0WgO97BgawI7 40HhuE5ewLfvsS/M+a2xTwHCJsTwKlnHRTpHYVsNXYkqAXs8SyW5kst7Iup3tnFggNLad/aR8W qvE= WDCIronportException: Internal Received: from unknown (HELO naota-xeon.wdc.com) ([10.225.163.94]) by uls-op-cesaip01.wdc.com with ESMTP; 21 Sep 2023 00:44:24 -0700 From: Naohiro Aota To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Naohiro Aota , Filipe Manana Subject: [PATCH v3 2/2] btrfs/076: use _fixed_by_kernel_commit to tell the fixing kernel commit Date: Thu, 21 Sep 2023 16:44:08 +0900 Message-ID: <74525f6b1fd645ac276b701e5032f3f913ed8ce0.1695282094.git.naohiro.aota@wdc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The fix commit is written in the comment without a commit hash. Use _fixed_by_kernel_commit command to describe it. Reviewed-by: Filipe Manana Signed-off-by: Naohiro Aota --- tests/btrfs/076 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/btrfs/076 b/tests/btrfs/076 index 43dbff538278..894a1ac7fa5d 100755 --- a/tests/btrfs/076 +++ b/tests/btrfs/076 @@ -5,10 +5,8 @@ # FS QA Test No. btrfs/076 # # Regression test for btrfs incorrect inode ratio detection. -# This was fixed in the following linux kernel patch: -# -# Btrfs: fix incorrect compression ratio detection # + . ./common/preamble _begin_fstest auto quick compress @@ -27,6 +25,8 @@ _cleanup() _supported_fs btrfs _require_test _require_scratch +_fixed_by_kernel_commit 4bcbb3325513 \ + "Btrfs: fix incorrect compression ratio detection" # An extent size can be up to BTRFS_MAX_UNCOMPRESSED max_extent_size=$(( 128 * 1024 ))