From patchwork Tue Nov 9 03:21:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12609649 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 030D0C433F5 for ; Tue, 9 Nov 2021 03:21:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2D6F61288 for ; Tue, 9 Nov 2021 03:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236956AbhKIDYE (ORCPT ); Mon, 8 Nov 2021 22:24:04 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:60417 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231910AbhKIDYD (ORCPT ); Mon, 8 Nov 2021 22:24:03 -0500 IronPort-Data: A9a23:TmG6X6ykcIiNZAmkVy56t+cexCrEfRIJ4+MujC/XYbTApD52hDBUyjcZXmzUOPzcZWfxft0kYYrl9UgE6pGGxtUxHQtv/xmBbVoQ95OdWo7xwmQcns+qBpSaChohtq3yU/GYRCwPZiKa9kjF3oTJ9yEmjPjRHuukUYYoBwgqLeNaYHZ44f5cs75h6mJYqYDR7zKl4bsekeWGULOW82Ic3lYv1k62gEgHUMIeF98vlgdWifhj5DcynpSOZX4VDfnZw3DQGuG4EgMmLtsvwo1V/kuBl/ssItij1LjmcEwWWaOUNg+L4pZUc/H6xEEc+WppieBmXBYfQR4/ZzGhhc14zs5c85K2UhsBMLDOmfgGTl9TFCQW0ahuoeaYeSnm4JTKp6HBWz62qxl0N2k6P5If/OlfAmxU8/EcbjcXYXirifmqzamnUcFyick5asrmJoUSvjdn1z6xMBqMafgvWI2TvZkBgmh23ZsIQJ7jiwMiQWIHRHz9j9dnYz/70K4Dodo= IronPort-HdrOrdr: A9a23:vr4+5aFFRXTHaDrxpLqE1MeALOsnbusQ8zAXPiFKOHhom6mj+vxG88506faKslwssR0b+OxoW5PwJE80l6QFgrX5VI3KNGbbUQCTXeNfBOXZowHIKmnX8+5x8eNaebFiNduYNzNHpPe/zA6mM9tI+rW6zJw= X-IronPort-AV: E=Sophos;i="5.87,219,1631548800"; d="scan'208";a="117091901" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Nov 2021 11:21:16 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id C6D304D10A07; Tue, 9 Nov 2021 11:21:14 +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; Tue, 9 Nov 2021 11:21:14 +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; Tue, 9 Nov 2021 11:21:13 +0800 From: Shiyang Ruan To: CC: "Darrick J . Wong" Subject: [PATCH v3 1/5] generic: add mmap CoW test for 'regular' case Date: Tue, 9 Nov 2021 11:21:06 +0800 Message-ID: <20211109032110.499427-2-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> References: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: C6D304D10A07.AE80F 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 Reviewed-by: Darrick J. Wong --- tests/generic/900 | 68 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/900.out | 6 ++++ 2 files changed, 74 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..bee3a785 --- /dev/null +++ b/tests/generic/900 @@ -0,0 +1,68 @@ +#! /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 + +# 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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 Tue Nov 9 03:21:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12609653 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 316F3C433EF for ; Tue, 9 Nov 2021 03:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 083FE61284 for ; Tue, 9 Nov 2021 03:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237350AbhKIDYH (ORCPT ); Mon, 8 Nov 2021 22:24:07 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:51208 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231910AbhKIDYF (ORCPT ); Mon, 8 Nov 2021 22:24:05 -0500 IronPort-Data: A9a23:vUvCpKvF7feQ1UofWndUBJU8aefnVH9cMUV32f8akzHdYEJGY0x3z2FMCz3VPPzcMTake9h/Poi//EkHvMWGmtdnTwI+/yxgHilAwSbnLY7Hdx+vZUt+DSFioHpPtpxYMp+ZRCwNZie0SiyFb/6x8hGQ6YnSHuClUbeca3goLeNZYHxJZSxLyrdRbrFA0YDR7zOl4bsekuWHULOX82cc3lE8t8pvnChSUMHa41v0iLCRicdj5zcyn1FNZH4WyDrYw3HQGuG4FcbiLwrPIS3Qw4/Xw/stIovNfrfTeUtMTKPQPBSVlzxdXK3Kbhpq/3R0i/hkcqFHLxo/ZzahxridzP1XqJW2UhZvMKvXhMwTThtZDzpje6ZB/dcrJFDm6JPLnhSXKyCEL/JGSRte0Zcj0up1HmZI+tQbJSoLYxTFgPi5qJq1UfVhndg4BNfkMZlZuXx6yzzdS/E8Tvj+rw/ijTND9G5owJkQQrCFPIxEAQeDpS/oO3VnUmr7wrpk9AtwukTCTg== IronPort-HdrOrdr: A9a23:ovluFa+WzU64wTYMbZhuk+DkI+orL9Y04lQ7vn2ZKCYlFvBw8vrCoB1173HJYUkqMk3I9ergBEDiewK4yXcW2/hzAV7KZmCP11dAR7sSj7cKrQeBJwTOssZZ1YpFN5N1EcDMCzFB5vrS0U2VFMkBzbC8nJyVuQ== X-IronPort-AV: E=Sophos;i="5.87,219,1631548800"; d="scan'208";a="117091903" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Nov 2021 11:21:17 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 5ABF74D10A08; Tue, 9 Nov 2021 11:21:15 +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; Tue, 9 Nov 2021 11:21:15 +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; Tue, 9 Nov 2021 11:21:14 +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; Tue, 9 Nov 2021 11:21:13 +0800 From: Shiyang Ruan To: CC: "Darrick J . Wong" Subject: [PATCH v3 2/5] generic: add mmap CoW test for 'unwritten' case Date: Tue, 9 Nov 2021 11:21:07 +0800 Message-ID: <20211109032110.499427-3-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> References: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 5ABF74D10A08.AF53C 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 Reviewed-by: Darrick J. Wong --- tests/generic/901 | 69 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/901.out | 6 ++++ 2 files changed, 75 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..0e402227 --- /dev/null +++ b/tests/generic/901 @@ -0,0 +1,69 @@ +#! /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 + +# 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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 Tue Nov 9 03:21:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12609655 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 7C599C433F5 for ; Tue, 9 Nov 2021 03:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53BEA6115A for ; Tue, 9 Nov 2021 03:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231910AbhKIDYI (ORCPT ); Mon, 8 Nov 2021 22:24:08 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:60417 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237201AbhKIDYF (ORCPT ); Mon, 8 Nov 2021 22:24:05 -0500 IronPort-Data: A9a23:3fKzkqvOL+chtKeSfxuDoaIkiufnVH9cMUV32f8akzHdYEJGY0x3mmYfDDjVOP3ea2XyeNF0aY7j/U8H7MDTmtYySwJs/31gHilAwSbnLY7Hdx+vZUt+DSFioHpPtpxYMp+ZRCwNZie0SiyFb/6x8hGQ6YnSHuClUbeca3goLeNZYHxJZSxLyrdRbrFA0YDR7zOl4bsekuWHULOX82cc3lE8t8pvnChSUMHa41v0iLCRicdj5zcyn1FNZH4WyDrYw3HQGuG4FcbiLwrPIS3Qw4/Xw/stIovNfrfTeUtMTKPQPBSVlzxdXK3Kbhpq/3R0i/hkcqFHLxo/ZzahxridzP1XqJW2UhZvMKvXhMwTThtZDzpje6ZB/dcrJFDm6JPLnhSXKyaEL/JGSRte0Zcj0up1HmZI+tQbJSoLYxTFgPi5qJq1UfVhndg4BNfkMZlZuXx6yzzdS/E8Tvj+rw/ijTND9G5owJkQQrCFPIxEAQeDpS/oO3VnUmr7wrpk9AtwukTCTg== IronPort-HdrOrdr: A9a23:04Jr/6q83Eiky6hEqUehr/0aV5oXeYIsimQD101hICG9E/bo8/xG+c536faaslgssQ4b8+xoVJPgfZq+z+8R3WByB8bAYOCOggLBQ72KhrGSoQEIdRefysdtkY9kc4VbTOb7FEVGi6/BizWQIpINx8am/cmT6dvj8w== X-IronPort-AV: E=Sophos;i="5.87,219,1631548800"; d="scan'208";a="117091905" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Nov 2021 11:21:17 +0800 Received: from G08CNEXMBPEKD05.g08.fujitsu.local (unknown [10.167.33.204]) by cn.fujitsu.com (Postfix) with ESMTP id 7A41C4D10A09; Tue, 9 Nov 2021 11:21:15 +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; Tue, 9 Nov 2021 11:21:15 +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; Tue, 9 Nov 2021 11:21:13 +0800 From: Shiyang Ruan To: CC: "Darrick J . Wong" Subject: [PATCH v3 3/5] generic: add mmap CoW test for 'hole' case Date: Tue, 9 Nov 2021 11:21:08 +0800 Message-ID: <20211109032110.499427-4-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> References: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 7A41C4D10A09.ACA4B 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 Reviewed-by: Darrick J. Wong --- tests/generic/902 | 63 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/902.out | 6 +++++ 2 files changed, 69 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..3968f1e6 --- /dev/null +++ b/tests/generic/902 @@ -0,0 +1,63 @@ +#! /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 + +# 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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 Tue Nov 9 03:21:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12609657 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 C4556C433FE for ; Tue, 9 Nov 2021 03:21:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A822461284 for ; Tue, 9 Nov 2021 03:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237201AbhKIDYK (ORCPT ); Mon, 8 Nov 2021 22:24:10 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:8149 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236908AbhKIDYG (ORCPT ); Mon, 8 Nov 2021 22:24:06 -0500 IronPort-Data: A9a23:opCKqan/mIqnuJgLXYpTbK/o5gydJERdPkR7XQ2eYbTBsI5bp2QBn2cYCG3XM/jYa2r3e95wadjn9U8G6JSDndZgQQpk+CA2RRqmi+KfW43BcR2Y0wB+jyH7ZBs+qZ1YM7EsFehsJpPnjkrrYueJQUVUj/nSH+OlUL+cY0ideCc/IMsfoUM68wIGqt4w6TSJK1vlVeLa+6UzCnf8s9JHGj58B5a4lf9alK+aVAX0EbAJTasjUFf2zxH5BX+ETE27ByOQroJ8RoZWSwtfpYxV8F81/z91Yj+kur39NEMXQL/OJhXIgX1TM0SgqkEa4HVsjeBgb7xBAatUo2zhc9RZ0shEs4ehDwkvJbHklvkfUgVDDmd1OqguFLrveCHg6Z3KnhWZG5fr67A0ZK0sBqUW4fp6Gn1V3eIXJSpLbR2Zge+yhrWhRYFRam4LRCXwFNpH/Cg+kneCVrB7Ka0vip7ivbdwtArcTOgUdRoGW/ckVA== IronPort-HdrOrdr: A9a23:rgGAIKqNqZcdcQidkYgkrZEaV5oXeYIsimQD101hICG9E/bo8/xG+c536faaslgssQ4b8+xoVJPgfZq+z+8R3WByB8bAYOCOggLBQ72KhrGSoQEIdRefysdtkY9kc4VbTOb7FEVGi6/BizWQIpINx8am/cmT6dvj8w== X-IronPort-AV: E=Sophos;i="5.87,219,1631548800"; d="scan'208";a="117091907" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Nov 2021 11:21:17 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id C1F0B4D10A0A for ; Tue, 9 Nov 2021 11:21:15 +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; Tue, 9 Nov 2021 11:21:14 +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; Tue, 9 Nov 2021 11:21:14 +0800 From: Shiyang Ruan To: Subject: [PATCH v3 4/5] generic: add mmap CoW test for 'delalloc' case Date: Tue, 9 Nov 2021 11:21:09 +0800 Message-ID: <20211109032110.499427-5-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> References: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: C1F0B4D10A0A.A03AE 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 | 73 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/903.out | 6 ++++ 2 files changed, 79 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..7ab93bf7 --- /dev/null +++ b/tests/generic/903 @@ -0,0 +1,73 @@ +#! /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 + +# 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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 + +# make sure we actually got delalloc block +$FILEFRAG_PROG -v $testdir/file2 2>&1 | grep -q delalloc || \ + _notrun "test requires delayed allocation writes" + +$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 && echo "file1 and file2 should not match." +cmp -s $testdir/file2 $testdir/file2.chk || echo "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 Tue Nov 9 03:21:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12609659 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 2FE8DC4332F for ; Tue, 9 Nov 2021 03:21:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1909C61284 for ; Tue, 9 Nov 2021 03:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236908AbhKIDYK (ORCPT ); Mon, 8 Nov 2021 22:24:10 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:51208 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237336AbhKIDYG (ORCPT ); Mon, 8 Nov 2021 22:24:06 -0500 IronPort-Data: A9a23:ShzNZ6oDQ3qOZI/w/oaoNzWeNBNeBmIEZxIvgKrLsJaIsI5as4F+vmYeWGuEb67fYmX1c4snaYq/oBtUsMKDnIVhT1E9pX82QiMRo6IpJ/zDcB6oYHn6wu4v7a5fx5xHLIGGdajYd1eEzvuWGuWn/SYUOZ2gHOKmUbedYnEpHGeIdQ964f5ds79g6mJXqYjha++9kYuaT/z3YDdJ6RYtWo4nw/7rRCdUgRjHkGhwUmrSyhx8lAS2e3E9VPrzLEwqRpfyatE88uWSH44vwFwll1418SvBCvv9+lr6WkYMBLDPPwmSkWcQUK+n6vRAjnVqlP9la7xHMgEK49mKt4kZJNFlr4G5Txw4eKPKg/g1XQRaEj1lIOtN/7qvzX2X6JXMlxyfIiO8qxlpJARsVWECwc55Gn1D7uADAC4CYwrFhO+sxr+/DO52iawewGPDVG8Ekig4i2iHUrB9GtaeK5gmLORwhF8Y7v2i196EDybBVQdSUQ== IronPort-HdrOrdr: A9a23:3N9QoKBOhc4tAo3lHemQ55DYdb4zR+YMi2TDtnoBLSC9F/b0qynAppomPGDP4gr5NEtApTniAtjkfZq/z+8X3WB5B97LMzUO01HYTr2Kg7GD/xTQXwX69sN4kZxrarVCDrTLZmRSvILX5xaZHr8brOW6zA== X-IronPort-AV: E=Sophos;i="5.87,219,1631548800"; d="scan'208";a="117091908" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 Nov 2021 11:21:17 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 1B0314D10A0B for ; Tue, 9 Nov 2021 11:21:16 +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; Tue, 9 Nov 2021 11:21:15 +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; Tue, 9 Nov 2021 11:21:14 +0800 From: Shiyang Ruan To: Subject: [PATCH v3 5/5] generic: add mmap CoW test for 'mixed' case Date: Tue, 9 Nov 2021 11:21:10 +0800 Message-ID: <20211109032110.499427-6-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> References: <20211109032110.499427-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 1B0314D10A0B.AD8A5 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 | 132 ++++++++++++++++++++++++++++++++++++++++++ tests/generic/904.out | 62 ++++++++++++++++++++ 2 files changed, 194 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..a11b4377 --- /dev/null +++ b/tests/generic/904 @@ -0,0 +1,132 @@ +#! /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 + +# 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 && echo "file1 and file2 should not match." + cmp -s $dir/file2 $dir/file2.chk || echo "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 + + # make sure we actually got delalloc block + $FILEFRAG_PROG -v $dir/file2 2>&1 | grep -q delalloc || \ + _notrun "test requires delayed allocation writes" + 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 + + # make sure we actually got delalloc block + $FILEFRAG_PROG -v $dir/file2 2>&1 | grep -q delalloc || \ + _notrun "test requires delayed allocation writes" + 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 && echo "file1 and file2 should not match." + cmp -s $dir/file2 $dir/file2.chk || echo "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 hole delalloc "$testdir/h-d" +runtest hole unwritten "$testdir/h-u" +runtest hole regular "$testdir/h-r" + +runtest unwritten delalloc "$testdir/u-d" +runtest unwritten hole "$testdir/u-h" +runtest unwritten regular "$testdir/u-r" + +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..bc45481d --- /dev/null +++ b/tests/generic/904.out @@ -0,0 +1,62 @@ +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 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 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 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 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