From patchwork Fri Nov 5 03:41:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12604167 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DC1BC433EF for ; Fri, 5 Nov 2021 03:42:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05AD361101 for ; Fri, 5 Nov 2021 03:42:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbhKEDpA (ORCPT ); Thu, 4 Nov 2021 23:45:00 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:35807 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230395AbhKEDo7 (ORCPT ); Thu, 4 Nov 2021 23:44:59 -0400 IronPort-Data: A9a23:X53fb6rQeDtdgaHGEoAbmxdibf9eBmIEZxIvgKrLsJaIsI5as4F+vjBNWGjVPv+DazfzLdF1ao6y9E1U7Z+HzddmTgQ/pHs2QiMRo6IpJ/zDcB6oYHn6wu4v7a5fx5xHLIGGdajYd1eEzvuWGuWn/SYUOZ2gHOKmUbedYn0pHGeIdQ964f5ds79g6mJXqYjha++9kYuaT/z3YDdJ6RYtWo4nw/7rRCdUgRjHkGhwUmrSyhx8lAS2e3E9VPrzLEwqRpfyatE88uWSH44vwFwll1418SvBCvv9+lr6WkYMBLDPPwmSkWcQUK+n6vRAjnVqlP9la7xHMgEK49mKt4kZJNFlr4G5Txw4eKPKg/g1XQRaEj1lIOtN/7qvzX2X6JXNnhSYKyOyqxlpJARsVWECwc55Gn1D7uADAC4CYwrFhO+sxr+/DO52iawewGPDVG8Ekig4i2iHUrB9GtaeK5gmLORwhF8Y7v2i196FDybBVQdSUQ== IronPort-HdrOrdr: A9a23:n9iwZqPX5HHzk8BcTv2jsMiBIKoaSvp037BL7TEUdfUxSKGlfq+V8sjzqiWftN98YhAdcLO7Scy9qBHnhP1ICOAqVN/MYOCMghrLEGgN1+vf6gylMyj/28oY7q14bpV5YeeaMXFKyer8/ym0euxN/OW6 X-IronPort-AV: E=Sophos;i="5.87,210,1631548800"; d="scan'208";a="116916006" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 05 Nov 2021 11:42:19 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 44D674D10102 for ; Fri, 5 Nov 2021 11:42:16 +0800 (CST) Received: from G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Nov 2021 11:42:11 +0800 Received: from G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.85) by G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Nov 2021 11:42:10 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Fri, 5 Nov 2021 11:42:08 +0800 From: Shiyang Ruan To: Subject: [PATCH 1/5] generic/xxx: Add MMAP CoW test for 'regular' case Date: Fri, 5 Nov 2021 11:41:56 +0800 Message-ID: <20211105034200.143626-2-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> References: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 44D674D10102.ACA67 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Check what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when the second block is a regular block. (MMAP version of generic/205,206) Signed-off-by: Shiyang Ruan --- tests/generic/900 | 75 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/900.out | 6 ++++ 2 files changed, 81 insertions(+) create mode 100755 tests/generic/900 create mode 100644 tests/generic/900.out diff --git a/tests/generic/900 b/tests/generic/900 new file mode 100755 index 00000000..b608e314 --- /dev/null +++ b/tests/generic/900 @@ -0,0 +1,75 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# See what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when +# the second block is a regular block. (MMAP version of generic/205,206) +# +# This test is dependent on the system page size, so we cannot use md5 in +# the golden output; we can only compare to a check file. +# +. ./common/preamble +_begin_fstest auto quick clone + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -rf $tmp.* $testdir +} + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink + +pagesz=$(getconf PAGE_SIZE) +blksz=$((pagesz / 4)) + +echo "Format and mount" +_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +real_blksz=$(_get_file_block_size $testdir) +test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." + +echo "Create the original files" +_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full + +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full + +_pwrite_byte 0x61 $blksz $blksz $testdir/file2 >> $seqres.full +_pwrite_byte 0x61 $blksz $blksz $testdir/file2.chk >> $seqres.full + +_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2 >> $seqres.full +_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full +_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +echo "CoW and unmount" +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +# success, all done +status=0 +exit diff --git a/tests/generic/900.out b/tests/generic/900.out new file mode 100644 index 00000000..2abfd789 --- /dev/null +++ b/tests/generic/900.out @@ -0,0 +1,6 @@ +QA output created by 900 +Format and mount +Create the original files +Compare files +CoW and unmount +Compare files From patchwork Fri Nov 5 03:41:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12604165 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64830C433F5 for ; Fri, 5 Nov 2021 03:42:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48ADF61101 for ; Fri, 5 Nov 2021 03:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231709AbhKEDo7 (ORCPT ); Thu, 4 Nov 2021 23:44:59 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:47127 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229587AbhKEDo6 (ORCPT ); Thu, 4 Nov 2021 23:44:58 -0400 IronPort-Data: A9a23:M5bRGq6HWLbfLW461WTxkwxRtCTFchMFZxGqfqrLsXjdYENS1mMHmGEWXz+Pb/2MZzP3LtlzPI7j8h8D7MPdyNVrHAY5pCpnJ55ogZCbXIzGdC8cHM8zwvXrFRsht4NHAjX5BJhcokT0+1H9bdANkVEmjfvRH+OkVbadUsxMbVQMpBkJ2EsLd9ER0tYAbeiRW2thiPuqyyHtEAbNNw1cbgr435m+RCZH55wejt+3UmsWPpintHeG/5Uc4Ql2yauZdxMUSaEMdgK2qnqq8V23wo/Z109F5tKNmbC9fFAIQ6LJIE6FjX8+t6qK20AE/3JtlP1gcqd0hUR/0l1lm/hr1dxLro32RwEyIoXCheYcTwJFVSp5OMWq/ZeeeCbu6JLLlxCun3zEhq8G4FsNFYMD5utsHXpm6/MVMnYOYwqFiubwx6i0ItSALOxLwNLDZdtZ4y8/i2qCS6tOfHwKeI2Sjfcw4dv6rpkm8S7iWvck IronPort-HdrOrdr: A9a23:gthSUaN/BlwKJ8BcTv2jsMiBIKoaSvp037BL7TEUdfUxSKGlfq+V8sjzqiWftN98YhAdcLO7Scy9qBHnhP1ICOAqVN/MYOCMghrLEGgN1+vf6gylMyj/28oY7q14bpV5YeeaMXFKyer8/ym0euxN/OW6 X-IronPort-AV: E=Sophos;i="5.87,210,1631548800"; d="scan'208";a="116916005" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 05 Nov 2021 11:42:19 +0800 Received: from G08CNEXMBPEKD05.g08.fujitsu.local (unknown [10.167.33.204]) by cn.fujitsu.com (Postfix) with ESMTP id 5E35C4D10107 for ; Fri, 5 Nov 2021 11:42:16 +0800 (CST) Received: from G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.85) by G08CNEXMBPEKD05.g08.fujitsu.local (10.167.33.204) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Nov 2021 11:42:12 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Fri, 5 Nov 2021 11:42:09 +0800 From: Shiyang Ruan To: Subject: [PATCH 2/5] generic/xxx: Add MMAP CoW test for 'unwritten' case Date: Fri, 5 Nov 2021 11:41:57 +0800 Message-ID: <20211105034200.143626-3-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> References: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 5E35C4D10107.AF0CF X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Check what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when the second block is a unwritten block. (MMAP version of generic/216,217) Signed-off-by: Shiyang Ruan --- tests/generic/901 | 76 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/901.out | 6 ++++ 2 files changed, 82 insertions(+) create mode 100755 tests/generic/901 create mode 100644 tests/generic/901.out diff --git a/tests/generic/901 b/tests/generic/901 new file mode 100755 index 00000000..2aae5f6d --- /dev/null +++ b/tests/generic/901 @@ -0,0 +1,76 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# See what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when +# the second block is a unwritten block. (MMAP version of generic/216,217) +# +# This test is dependent on the system page size, so we cannot use md5 in +# the golden output; we can only compare to a check file. +# +. ./common/preamble +_begin_fstest auto quick clone + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -rf $tmp.* $testdir +} + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" + +pagesz=$(getconf PAGE_SIZE) +blksz=$((pagesz / 4)) + +echo "Format and mount" +_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +real_blksz=$(_get_file_block_size $testdir) +test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." + +echo "Create the original files" +_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full + +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full + +$XFS_IO_PROG -f -c "falloc -k $blksz $blksz" $testdir/file2 >> $seqres.full +_pwrite_byte 0x00 $blksz $blksz $testdir/file2.chk >> $seqres.full + +$XFS_IO_PROG -f -c "falloc -k $((blksz * 3)) $blksz" $testdir/file2 >> $seqres.full +_pwrite_byte 0x00 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full +_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +echo "CoW and unmount" +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +# success, all done +status=0 +exit diff --git a/tests/generic/901.out b/tests/generic/901.out new file mode 100644 index 00000000..07b9b433 --- /dev/null +++ b/tests/generic/901.out @@ -0,0 +1,6 @@ +QA output created by 901 +Format and mount +Create the original files +Compare files +CoW and unmount +Compare files From patchwork Fri Nov 5 03:41:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12604169 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60525C433EF for ; Fri, 5 Nov 2021 03:42:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CA966112D for ; Fri, 5 Nov 2021 03:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbhKEDpF (ORCPT ); Thu, 4 Nov 2021 23:45:05 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:12071 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231201AbhKEDpF (ORCPT ); Thu, 4 Nov 2021 23:45:05 -0400 IronPort-Data: A9a23:EenmT6jD2XBLClIVyMoLcdVDX161fBIKZh0ujC45NGQNrF6WrkVWx2AcCj2AMviOZjGjKo1+b9++9hgHusfczd9rGVE6qXw8FHgiRejtX4rAdhiqV8+xwmwvdGo+toNGLICowPkcFhcwnT/wdOi+xZVA/fvQHOOlUbaZYnkZqTJME0/NtzoywobVvaY42bBVMyvV0T/Di5W31G2NglaYAUpIg063ky6Didyp0N8uUvPSUtgQ1LPWvyF94JvyvshdJVOgKmVfNrbSq+ouUNiEEm3lExcFUrtJk57wdAsEX7zTIROTzHFRXsBOgDAb/mprjPl9b6FaNC+7iB3Q9zx14M9QvJqrWEEnOLbQsOoAURhECDw4NqpDkFPCCSHm753KkRWfKhMAxN0rVinaJ7Yw9P1rDHpS7tQGJz0XKBOOneS7xPS8UOYEuyiJBKEHJ6tG4jc5k26fVq1gHPj+r2zxzYcw9F8NagpmRJ4yv/YkVAc= IronPort-HdrOrdr: A9a23:xHnh2qjTiylEzwfdC4BE/1emFXBQXuYji2hC6mlwRA09TyX4rbHLoB1/73LJYVkqNk3I5urrBEDtexLhHP1OkOws1NWZLWrbUQKTRekM0WKI+UyDJ8SRzI5g/JYlW61/Jfm1NlJikPv9iTPSL/8QhPWB74Ck7N2z80tQ X-IronPort-AV: E=Sophos;i="5.87,210,1631548800"; d="scan'208";a="116916011" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 05 Nov 2021 11:42:25 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 5B6BE4D10102 for ; Fri, 5 Nov 2021 11:42:22 +0800 (CST) Received: from G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.85) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Nov 2021 11:42:17 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Fri, 5 Nov 2021 11:42:15 +0800 From: Shiyang Ruan To: Subject: [PATCH 3/5] generic/xxx: Add MMAP CoW test for 'hole' case Date: Fri, 5 Nov 2021 11:41:58 +0800 Message-ID: <20211105034200.143626-4-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> References: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 5B6BE4D10102.AE393 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Check what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when the second block is a hole. (MMAP version of generic/218,220) Signed-off-by: Shiyang Ruan --- tests/generic/902 | 70 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/902.out | 6 ++++ 2 files changed, 76 insertions(+) create mode 100755 tests/generic/902 create mode 100644 tests/generic/902.out diff --git a/tests/generic/902 b/tests/generic/902 new file mode 100755 index 00000000..3fbf6143 --- /dev/null +++ b/tests/generic/902 @@ -0,0 +1,70 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# See what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when +# the second block is a hole. (MMAP version of generic/218,220) +# +# This test is dependent on the system page size, so we cannot use md5 in +# the golden output; we can only compare to a check file. +# +. ./common/preamble +_begin_fstest auto quick clone + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -rf $tmp.* $testdir +} + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" + +pagesz=$(getconf PAGE_SIZE) +blksz=$((pagesz / 4)) + +echo "Format and mount" +_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +real_blksz=$(_get_file_block_size $testdir) +test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." + +echo "Create the original files" +_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full + +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full +_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +echo "CoW and unmount" +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +# success, all done +status=0 +exit diff --git a/tests/generic/902.out b/tests/generic/902.out new file mode 100644 index 00000000..4fb8b6cb --- /dev/null +++ b/tests/generic/902.out @@ -0,0 +1,6 @@ +QA output created by 902 +Format and mount +Create the original files +Compare files +CoW and unmount +Compare files From patchwork Fri Nov 5 03:41:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12604171 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 369BAC433F5 for ; Fri, 5 Nov 2021 03:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E09E61246 for ; Fri, 5 Nov 2021 03:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231575AbhKEDpO (ORCPT ); Thu, 4 Nov 2021 23:45:14 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:63855 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231201AbhKEDpN (ORCPT ); Thu, 4 Nov 2021 23:45:13 -0400 IronPort-Data: A9a23:P2NJIaJad5qBadyuFE+RzZclxSXFcZb7ZxGrkP8bfHC8hzsh0WYAy2YdCDzSO6nZajOneIgjPIq1pE8Du5TSm4NqS1BcGVNFFSwT8ZWfbTi6wuYcBwvLd4ubChsPA/w2MrEsF+hpCC+DzvuRGuK59yAljPnVHuOU5NPsYUideyc1EU/Ntjozw4bVsqYw6TSIK1vlVeHa+qUzC3f5s9JACV/43orYwP9ZUFsejxtD1rA2TagjUFYzDBD5BrpHTU26ByOQroW5goeHq+j/ILGRpgs1/j8mDJWrj7T6blYXBLXVOGBiiFIPA+773EcE/Xd0j87XN9JFAatToy+UltZq2ZNDs4esYQk0PKzQg/lbWB5de817FfQfpu6efyDm4aR/yGWDKRMA2c5GAloqMJYE4c5pDmxUs/8VMjYAalaEne3e/V4RYoGAnex6dI+yYtxZ4SomkFnk4T8dacira833CRVwhV/cXvxzIMs= IronPort-HdrOrdr: A9a23:/blDDqzVOA7lX50Uvx62KrPwEL1zdoMgy1knxilNoH1uA6ilfqWV8cjzuiWbtN9vYhsdcLy7WZVoIkmskKKdg7NhXotKNTOO0ASVxepZnOnfKlPbexHWx6p00KdMV+xEAsTsMF4St63HyTj9P9E+4NTvysyVuds= X-IronPort-AV: E=Sophos;i="5.87,210,1631548800"; d="scan'208";a="116916018" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 05 Nov 2021 11:42:31 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id 597944D10108 for ; Fri, 5 Nov 2021 11:42:28 +0800 (CST) Received: from G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.85) by G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Nov 2021 11:42:21 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Fri, 5 Nov 2021 11:42:21 +0800 From: Shiyang Ruan To: Subject: [PATCH 4/5] generic/xxx: Add MMAP CoW test for 'delalloc' case Date: Fri, 5 Nov 2021 11:41:59 +0800 Message-ID: <20211105034200.143626-5-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> References: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 597944D10108.AC4BB X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Check what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when the second block is delalloc. (MMAP version of generic/222,227) Signed-off-by: Shiyang Ruan --- tests/generic/903 | 76 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/903.out | 6 ++++ 2 files changed, 82 insertions(+) create mode 100755 tests/generic/903 create mode 100644 tests/generic/903.out diff --git a/tests/generic/903 b/tests/generic/903 new file mode 100755 index 00000000..1e76fc9b --- /dev/null +++ b/tests/generic/903 @@ -0,0 +1,76 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# See what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when +# the second block is delalloc. (MMAP version of generic/222,227) +# +# This test is dependent on the system page size, so we cannot use md5 in +# the golden output; we can only compare to a check file. +# +. ./common/preamble +_begin_fstest auto quick clone + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -rf $tmp.* $testdir +} + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" + +pagesz=$(getconf PAGE_SIZE) +blksz=$((pagesz / 4)) + +echo "Format and mount" +_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +real_blksz=$(_get_file_block_size $testdir) +test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." + +echo "Create the original files" +_pwrite_byte 0x61 0 $pagesz $testdir/file1 >> $seqres.full + +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "truncate $pagesz" $testdir/file2.chk >> $seqres.full + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) $blksz >> $seqres.full +_pwrite_byte 0x61 $((blksz * 2)) $blksz $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +echo "CoW and unmount" +_pwrite_byte 0x61 $blksz $blksz $testdir/file2 >> $seqres.full +_pwrite_byte 0x61 $blksz $blksz $testdir/file2.chk >> $seqres.full + +_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2 >> $seqres.full +_pwrite_byte 0x61 $((blksz * 3)) $blksz $testdir/file2.chk >> $seqres.full + +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2 >> $seqres.full +$XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "mwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $testdir/file2.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +! cmp -s $testdir/file1 $testdir/file2 || _fail "file1 and file2 don't match." +cmp -s $testdir/file2 $testdir/file2.chk || _fail "file2 and file2.chk don't match." + +# success, all done +status=0 +exit diff --git a/tests/generic/903.out b/tests/generic/903.out new file mode 100644 index 00000000..cfeeb11c --- /dev/null +++ b/tests/generic/903.out @@ -0,0 +1,6 @@ +QA output created by 903 +Format and mount +Create the original files +Compare files +CoW and unmount +Compare files From patchwork Fri Nov 5 03:42:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12604173 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9EC7C433F5 for ; Fri, 5 Nov 2021 03:42:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1F7A61246 for ; Fri, 5 Nov 2021 03:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231829AbhKEDpR (ORCPT ); Thu, 4 Nov 2021 23:45:17 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:63855 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231201AbhKEDpR (ORCPT ); Thu, 4 Nov 2021 23:45:17 -0400 IronPort-Data: A9a23:JyErhqN6HmII2onvrR25lcFynXyQoLVcMsFnjC/WdQjs0Tsg3mAEyTEcUWCDP/6ONGT1fd0jPNiz/R9VupWAm99gGjLY11k3ESsS9pCt6fd1j6vIF3rLaJWFFSqL1u1GAjX7BJ1yHiC0SiuFaOC79CAljfzQH9IQNcafUsxPbV49IMseoUI78wIJqtYAbemRW2thi/uryyHsEAPNNwpPD44hw/nrRCWDExjFkGhwUlQWPZintbJF/pUfJMp3yaqZdxMUTmTId9NWSdovzJnhlo/Y1xwrTN24kLfnaVBMSbnXVeSMoiMOHfH83V4Z/Wpvuko4HKN0hUN/kSiAmctgjttLroCYRxorP7HXhaIWVBww/yRWZPQYqeaZeSLl2SCU5wicG5f2+N1gF107JpED0vh4DHsI9vECLj0JKBeZiIqLLBiTIgV3rp17apC1Y8VE4Tc9pQw1xM0OGfjrK5gmL/cBtNvouv1zIA== IronPort-HdrOrdr: A9a23:DtOBFa1ScaIH/yAv7zD2dQqjBI4kLtp133Aq2lEZdPU1SL39qynKppkmPHDP5gr5J0tLpTntAsi9qBDnhPtICOsqTNSftWDd0QPGEGgI1/qB/9SPIU3D398Y/aJhXow7M9foEGV95PyQ3CCIV/om3/mLmZrFudvj X-IronPort-AV: E=Sophos;i="5.87,210,1631548800"; d="scan'208";a="116916022" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 05 Nov 2021 11:42:37 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id EBF5C4D10106 for ; Fri, 5 Nov 2021 11:42:34 +0800 (CST) Received: from G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) by G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Nov 2021 11:42:28 +0800 Received: from G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.85) by G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 5 Nov 2021 11:42:29 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Fri, 5 Nov 2021 11:42:27 +0800 From: Shiyang Ruan To: Subject: [PATCH 5/5] generic/xxx: Add MMAP CoW test for 'all' case Date: Fri, 5 Nov 2021 11:42:00 +0800 Message-ID: <20211105034200.143626-6-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> References: <20211105034200.143626-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: EBF5C4D10106.A1BCF X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Check what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when the surrounding blocks vary between unwritten/regular/delalloc/hole. (MMAP version of generic/229,238) Signed-off-by: Shiyang Ruan --- tests/generic/904 | 135 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/904.out | 82 +++++++++++++++++++++++++ 2 files changed, 217 insertions(+) create mode 100755 tests/generic/904 create mode 100644 tests/generic/904.out diff --git a/tests/generic/904 b/tests/generic/904 new file mode 100755 index 00000000..dee6df4e --- /dev/null +++ b/tests/generic/904 @@ -0,0 +1,135 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# See what happens if we MMAP CoW blocks 2-4 of a page's worth of blocks when +# the surrounding blocks vary between unwritten/regular/delalloc/hole. +# (MMAP version of generic/229,238) +# +# This test is dependent on the system page size, so we cannot use md5 in +# the golden output; we can only compare to a check file. +# +. ./common/preamble +_begin_fstest auto quick clone + +# Override the default cleanup function. +_cleanup() +{ + cd / + rm -rf $tmp.* $testdir +} + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" + +pagesz=$(getconf PAGE_SIZE) +blksz=$((pagesz / 4)) + +echo "Format and mount" +_scratch_mkfs_blocksized $blksz > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +real_blksz=$(_get_file_block_size $testdir) +test $real_blksz != $blksz && _notrun "Failed to format with small blocksize." + +runtest() { + echo "runtest $1 $2" + b2=$1 + b4=$2 + dir=$3 + + echo "Create the original files" + mkdir -p $dir + _pwrite_byte 0x61 0 $pagesz $dir/file1 >> $seqres.full + + $XFS_IO_PROG -f -c "truncate $pagesz" $dir/file2 >> $seqres.full + $XFS_IO_PROG -f -c "truncate $pagesz" $dir/file2.chk >> $seqres.full + + case $b2 in + "regular") + _pwrite_byte 0x61 $blksz $blksz $dir/file2 >> $seqres.full + _pwrite_byte 0x61 $blksz $blksz $dir/file2.chk >> $seqres.full + ;; + "unwritten") + $XFS_IO_PROG -f -c "falloc -k $blksz $blksz" $dir/file2 >> $seqres.full + _pwrite_byte 0x00 $blksz $blksz $dir/file2.chk >> $seqres.full + ;; + "hole") + ;; + esac + + case $b4 in + "regular") + _pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2 >> $seqres.full + _pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full + ;; + "unwritten") + $XFS_IO_PROG -f -c "falloc -k $((blksz * 3)) $blksz" $dir/file2 >> $seqres.full + _pwrite_byte 0x00 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full + ;; + "hole") + ;; + esac + + _reflink_range $dir/file1 $blksz $dir/file2 $((blksz * 2)) $blksz >> $seqres.full + _pwrite_byte 0x61 $((blksz * 2)) $blksz $dir/file2.chk >> $seqres.full + _scratch_cycle_mount + + echo "Compare files" + ! cmp -s $dir/file1 $dir/file2 || _fail "file1 and file2 don't match." + cmp -s $dir/file2 $dir/file2.chk || _fail "file2 and file2.chk don't match." + + echo "CoW and unmount" + if [ $b2 = "delalloc" ]; then + _pwrite_byte 0x61 $blksz $blksz $dir/file2 >> $seqres.full + _pwrite_byte 0x61 $blksz $blksz $dir/file2.chk >> $seqres.full + fi + + if [ $b4 = "delalloc" ]; then + _pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2 >> $seqres.full + _pwrite_byte 0x61 $((blksz * 3)) $blksz $dir/file2.chk >> $seqres.full + fi + + $XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $dir/file2 >> $seqres.full + $XFS_IO_PROG -f -c "mmap 0 $pagesz" \ + -c "pwrite -S 0x63 $((blksz + 17)) $((blksz * 3 - 34))" $dir/file2.chk >> $seqres.full + _scratch_cycle_mount + + echo "Compare files" + ! cmp -s $dir/file1 $dir/file2 || _fail "file1 and file2 don't match." + cmp -s $dir/file2 $dir/file2.chk || _fail "file2 and file2.chk don't match." +} + +runtest regular delalloc "$testdir/r-d" +runtest regular unwritten "$testdir/r-u" +runtest regular hole "$testdir/r-h" +runtest regular regular "$testdir/r-r" + +runtest hole delalloc "$testdir/h-d" +runtest hole unwritten "$testdir/h-u" +runtest hole hole "$testdir/h-h" +runtest hole regular "$testdir/h-r" + +runtest unwritten delalloc "$testdir/u-d" +runtest unwritten unwritten "$testdir/u-u" +runtest unwritten hole "$testdir/u-h" +runtest unwritten regular "$testdir/u-r" + +runtest delalloc delalloc "$testdir/d-d" +runtest delalloc unwritten "$testdir/d-u" +runtest delalloc hole "$testdir/d-h" +runtest delalloc regular "$testdir/d-r" + +# success, all done +status=0 +exit diff --git a/tests/generic/904.out b/tests/generic/904.out new file mode 100644 index 00000000..f84bbe6d --- /dev/null +++ b/tests/generic/904.out @@ -0,0 +1,82 @@ +QA output created by 904 +Format and mount +runtest regular delalloc +Create the original files +Compare files +CoW and unmount +Compare files +runtest regular unwritten +Create the original files +Compare files +CoW and unmount +Compare files +runtest regular hole +Create the original files +Compare files +CoW and unmount +Compare files +runtest regular regular +Create the original files +Compare files +CoW and unmount +Compare files +runtest hole delalloc +Create the original files +Compare files +CoW and unmount +Compare files +runtest hole unwritten +Create the original files +Compare files +CoW and unmount +Compare files +runtest hole hole +Create the original files +Compare files +CoW and unmount +Compare files +runtest hole regular +Create the original files +Compare files +CoW and unmount +Compare files +runtest unwritten delalloc +Create the original files +Compare files +CoW and unmount +Compare files +runtest unwritten unwritten +Create the original files +Compare files +CoW and unmount +Compare files +runtest unwritten hole +Create the original files +Compare files +CoW and unmount +Compare files +runtest unwritten regular +Create the original files +Compare files +CoW and unmount +Compare files +runtest delalloc delalloc +Create the original files +Compare files +CoW and unmount +Compare files +runtest delalloc unwritten +Create the original files +Compare files +CoW and unmount +Compare files +runtest delalloc hole +Create the original files +Compare files +CoW and unmount +Compare files +runtest delalloc regular +Create the original files +Compare files +CoW and unmount +Compare files