From patchwork Thu Nov 11 08:50:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12614405 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 33CE8C433F5 for ; Thu, 11 Nov 2021 08:51:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16B886162E for ; Thu, 11 Nov 2021 08:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbhKKIyE (ORCPT ); Thu, 11 Nov 2021 03:54:04 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:31067 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232357AbhKKIyE (ORCPT ); Thu, 11 Nov 2021 03:54:04 -0500 IronPort-Data: A9a23:cRcmK6P8i+cJ6jHvrR25lcFynXyQoLVcMsFnjC/WdQK5hz1xgmQOyTQaXDqBPq6PZ2qhfNsnYN+0pk5V7JTUm99gGjLY11k3ESsS9pCt6fd1j6vIF3rLaJWFFSqL1u1GAjX7BJ1yHiC0SiuFaOC79CAljPnQG9IQNcafUsxPbV49IMseoUI78wIJqtYAbemRW2thi/uryyHsEAPNNwpPD44hw/nrRCWDExjFkGhwUlQWPZintbJF/pUfJMp3yaqZdxMUTmTId9NWSdovzJnhlo/Y1xwrTN24kLfnaVBMSbnXVeSMoiMOHfH83V4Z/Wpvuko4HKN0hUN/kSiAmctgjttLroCYRxorP7HXhaIWVBww/yRWZPQZouabeSHl2SCU5wicG5f2+N1gF107JpED0vh4DHsI9vECLj0JKBeZiIqLLBiTIgV3rp17apC1Y8VE4Tc9pQw1xM0OGfjrK5gmL/cFtNvouv1zIA== IronPort-HdrOrdr: A9a23:/8vxPKgmoTybonpKZOs6JbSgFHBQXuYji2hC6mlwRA09TyX4rbHLoB1/73LJYVkqNk3I5urrBEDtexLhHP1OkOws1NWZLWrbUQKTRekM0WKI+UyDJ8SRzI5g/JYlW61/Jfm1NlJikPv9iTPSL/8QhPWB74Ck7N2z80tQ X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214012" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:12 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 9000A4D10A12 for ; Thu, 11 Nov 2021 16:51:10 +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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:08 +0800 From: Shiyang Ruan To: Subject: [PATCH 01/13] generic: add mmap CoW test for ranges of two shared files Date: Thu, 11 Nov 2021 16:50:54 +0800 Message-ID: <20211111085106.937684-2-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 9000A4D10A12.AB2F4 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 Ensuring that copy on write in mmap mode works when the CoW range originally covers multiple extents. (MMAP version of generic/185,183) Signed-off-by: Shiyang Ruan --- tests/generic/909 | 69 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/909.out | 14 +++++++++ 2 files changed, 83 insertions(+) create mode 100755 tests/generic/909 create mode 100644 tests/generic/909.out diff --git a/tests/generic/909 b/tests/generic/909 new file mode 100755 index 00000000..dc011eba --- /dev/null +++ b/tests/generic/909 @@ -0,0 +1,69 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode works when the CoW +# range originally covers multiple extents. (MMAP version of generic/185,183) +# - Create two files +# - Reflink the odd blocks of the first file into a third file. +# - Reflink the even blocks of the second file into the third file. +# - mmap CoW across the halfway mark. +# - Check that the files are now different where we say they're different. +# +. ./common/preamble +_begin_fstest auto quick clone + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_pwrite_byte 0x61 0 $filesize $testdir/file1 >> $seqres.full +_pwrite_byte 0x62 0 $filesize $testdir/file2 >> $seqres.full +seq 0 2 $((nr-1)) | while read f; do + _reflink_range $testdir/file1 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full + _pwrite_byte 0x61 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full +done +seq 1 2 $((nr-1)) | while read f; do + _reflink_range $testdir/file2 $((blksz * f)) $testdir/file3 $((blksz * f)) $blksz >> $seqres.full + _pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full +done +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file2 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file2 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/909.out b/tests/generic/909.out new file mode 100644 index 00000000..8da48a79 --- /dev/null +++ b/tests/generic/909.out @@ -0,0 +1,14 @@ +QA output created by 909 +Format and mount +Create the original files +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-909/file1 +b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-909/file2 +d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-909/file3 +d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-909/file3.chk +mmap CoW across the transition +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-909/file1 +b83f9394092e15bdcda585cd8e776dc6 SCRATCH_MNT/test-909/file2 +55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-909/file3 +55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-909/file3.chk From patchwork Thu Nov 11 08:50:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12614401 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 0E9B8C433F5 for ; Thu, 11 Nov 2021 08:51:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E829361267 for ; Thu, 11 Nov 2021 08:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232296AbhKKIyC (ORCPT ); Thu, 11 Nov 2021 03:54:02 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:34979 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229543AbhKKIyC (ORCPT ); Thu, 11 Nov 2021 03:54:02 -0500 IronPort-Data: A9a23:AdOukq4FDnnuUwmWL1luIwxRtCTFchMFZxGqfqrLsXjdYENS0WEEnGYdXzzXaPeLMzTxKNh0bN/n8hgHvcODytBjQAM5pCpnJ55ogZCbXIzGdC8cHM8zwvXrFRsht4NHAjX5BJhcokT0+1H9bdANkVEmjfvRH+OlULaZUsxMbVQMpBkJ2EsLd9ER0tYAbeiRW2thiPuqyyHtEAbNNw1cbgr435m+RCZH55wejt+3UmsWPpintHeG/5Uc4Ql2yauZdxMUSaEMdgK2qnqq8V23wo/Z109F5tKNmbC9fFAIQ6LJIE6FjX8+t6qK20AE/3JtlP1gcqd0hUR/0l1lm/hr1dxLro32RwEyIoXCheYcTwJFVSp5OMWq/ZeeeCfl6JDLlhaun3zEhq8G4FsNFYMD5utsHXpm6/MVMnYOYwqFiubwx6i0ItSALOxLwNLDZdtZ4y8/i2qCS6tOfHwKeI2Sjfcw4dv6rpom8S7iWvck IronPort-HdrOrdr: A9a23:yDeAlqyppkXre0/OvHqpKrPwEL1zdoMgy1knxilNoH1uA6ilfqWV8cjzuiWbtN9vYhsdcLy7WZVoIkmskKKdg7NhXotKNTOO0ASVxepZnOnfKlPbexHWx6p00KdMV+xEAsTsMF4St63HyTj9P9E+4NTvysyVuds= X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214013" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:12 +0800 Received: from G08CNEXMBPEKD05.g08.fujitsu.local (unknown [10.167.33.204]) by cn.fujitsu.com (Postfix) with ESMTP id AFA004D10A13 for ; Thu, 11 Nov 2021 16:51:10 +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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:09 +0800 From: Shiyang Ruan To: Subject: [PATCH 02/13] generic: add mmap CoW test for regular&destination extents Date: Thu, 11 Nov 2021 16:50:55 +0800 Message-ID: <20211111085106.937684-3-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: AFA004D10A13.AE10E 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 Ensuring that copy on write in mmap mode works when the CoW range originally covers multiple extents, some regular, some not. (MMAP version of generic/197,196) Signed-off-by: Shiyang Ruan --- tests/generic/910 | 59 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/910.out | 12 +++++++++ 2 files changed, 71 insertions(+) create mode 100755 tests/generic/910 create mode 100644 tests/generic/910.out diff --git a/tests/generic/910 b/tests/generic/910 new file mode 100755 index 00000000..4fef8e18 --- /dev/null +++ b/tests/generic/910 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode works when the CoW +# range originally covers multiple extents, some regular, some not. +# (MMAP version of generic/197,196) +# - Create two files. +# - Reflink the odd blocks of the first file into the second file. +# - mmap CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_weave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/910.out b/tests/generic/910.out new file mode 100644 index 00000000..e3933a4b --- /dev/null +++ b/tests/generic/910.out @@ -0,0 +1,12 @@ +QA output created by 910 +Format and mount +Create the original files +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-910/file1 +d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-910/file3 +d3959a68638c50af07f0258e032cb554 SCRATCH_MNT/test-910/file3.chk +mmap CoW across the transition +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-910/file1 +55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-910/file3 +55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-910/file3.chk From patchwork Thu Nov 11 08:50: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: 12614411 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 CFF40C433FE for ; Thu, 11 Nov 2021 08:51:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B60266162E for ; Thu, 11 Nov 2021 08:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231961AbhKKIyK (ORCPT ); Thu, 11 Nov 2021 03:54:10 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:32308 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232022AbhKKIyF (ORCPT ); Thu, 11 Nov 2021 03:54:05 -0500 IronPort-Data: A9a23:uUMKQ6sdCKe3YfVbIpWDdi8HAefnVEpcMUV32f8akzHdYEJGY0x3zGtJXG/UaKmNZGXxLd9yad6z8R5X7J6Ex9VlSVBk/n9gHilAwSbnLY7Hdx+vZUt+DSFioHpPtpxYMp+ZRCwNZie0SiyFb/6x8hGQ6YnSHuClUbedYngsLeNZYHxJZSxLyrdRbrFA0YDR7zOl4bsekuWHULOX82cc3lE8t8pvnChSUMHa41v0iLCRicdj5zcyn1FNZH4WyDrYw3HQGuG4FcbiLwrPIS3Qw4/Xw/stIovNfrfTeUtMTKPQPBSVlzxdXK3Kbhpq/3R0i/hkcqFHLxo/ZzahxridzP1XqJW2UhZvMKvXhMwTThtZDzpje6ZB/dcrJFDm6JPJlhGeKiuEL/JGSRte0Zcj0uhsHWxV6ecwNj8AdFaAiviwzbb9TfNj7vnPhuGD0Jg34ykmlG+GS619B82rfkkD3vcAtB9YuyyENam2ixIlVAdS IronPort-HdrOrdr: A9a23:mNT4kaArvW8Z0ErlHemQ55DYdb4zR+YMi2TDtnoBLSC9F/b0qynAppomPGDP4gr5NEtApTniAtjkfZq/z+8X3WB5B97LMzUO01HYTr2Kg7GD/xTQXwX69sN4kZxrarVCDrTLZmRSvILX5xaZHr8brOW6zA== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214018" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:12 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id 045464D10A15 for ; Thu, 11 Nov 2021 16:51:11 +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; Thu, 11 Nov 2021 16:51:09 +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; Thu, 11 Nov 2021 16:51:09 +0800 From: Shiyang Ruan To: Subject: [PATCH 03/13] generic: add mmap CoW test for unwritten&destination extents Date: Thu, 11 Nov 2021 16:50:56 +0800 Message-ID: <20211111085106.937684-4-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 045464D10A15.AE912 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 Ensuring that copy on write in mmap mode works when the CoW range originally covers multiple extents, some unwritten, some not. (MMAP version of generic/189,188) Signed-off-by: Shiyang Ruan --- tests/generic/911 | 59 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/911.out | 12 +++++++++ 2 files changed, 71 insertions(+) create mode 100755 tests/generic/911 create mode 100644 tests/generic/911.out diff --git a/tests/generic/911 b/tests/generic/911 new file mode 100755 index 00000000..962a7dac --- /dev/null +++ b/tests/generic/911 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode works when the CoW +# range originally covers multiple extents, some unwritten, some not. +# (MMAP version of generic/189,188) +# - Create a file and fallocate a second file. +# - Reflink the odd blocks of the first file into the second file. +# - mmap CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_weave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/911.out b/tests/generic/911.out new file mode 100644 index 00000000..8e41bdf6 --- /dev/null +++ b/tests/generic/911.out @@ -0,0 +1,12 @@ +QA output created by 911 +Format and mount +Create the original files +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-911/file1 +fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-911/file3 +fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-911/file3.chk +mmap CoW across the transition +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-911/file1 +09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-911/file3 +09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-911/file3.chk From patchwork Thu Nov 11 08:50: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: 12614409 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 B9911C433EF for ; Thu, 11 Nov 2021 08:51:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2CED61884 for ; Thu, 11 Nov 2021 08:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232535AbhKKIyI (ORCPT ); Thu, 11 Nov 2021 03:54:08 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:31067 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231961AbhKKIyF (ORCPT ); Thu, 11 Nov 2021 03:54:05 -0500 IronPort-Data: A9a23:0Vl9A6t7jq2i00MvVtEvClTV7OfnVEpcMUV32f8akzHdYEJGY0x3nTAcD2rSMviLN2Cmed5yOYy/908DvMLRmN4yGwo4pXpgHilAwSbnLY7Hdx+vZUt+DSFioHpPtpxYMp+ZRCwNZie0SiyFb/6x8hGQ6YnSHuClUbedYngsLeNZYHxJZSxLyrdRbrFA0YDR7zOl4bsekuWHULOX82cc3lE8t8pvnChSUMHa41v0iLCRicdj5zcyn1FNZH4WyDrYw3HQGuG4FcbiLwrPIS3Qw4/Xw/stIovNfrfTeUtMTKPQPBSVlzxdXK3Kbhpq/3R0i/hkcqFHLxo/ZzahxridzP1XqJW2UhZvMKvXhMwTThtZDzpje6ZB/dcrJFDm6JPJlhGeKiSEL/JGSRte0Zcj0uhsHWxV6ecwNj8AdFaAiviwzbb9TfNj7vnPhuGD0Jg34ykmlG+GS619B82rfkkD3vcAtB9YuyyENam2ixIlVAdS IronPort-HdrOrdr: A9a23:+j+z8aDUT/H3m5LlHemQ55DYdb4zR+YMi2TDtnoBLSC9F/b0qynAppomPGDP4gr5NEtApTniAtjkfZq/z+8X3WB5B97LMzUO01HYTr2Kg7GD/xTQXwX69sN4kZxrarVCDrTLZmRSvILX5xaZHr8brOW6zA== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214017" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:12 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 554E24D10A16 for ; Thu, 11 Nov 2021 16:51:11 +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; Thu, 11 Nov 2021 16:51:11 +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; Thu, 11 Nov 2021 16:51:09 +0800 From: Shiyang Ruan To: Subject: [PATCH 04/13] generic: add mmap CoW test for holes&destination extents Date: Thu, 11 Nov 2021 16:50:57 +0800 Message-ID: <20211111085106.937684-5-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 554E24D10A16.AD0D2 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 Ensuring that copy on write in mmap mode works when the CoW range originally covers multiple extents, some holes, some not. (MMAP version of generic/191,190) Signed-off-by: Shiyang Ruan --- tests/generic/912 | 59 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/912.out | 12 +++++++++ 2 files changed, 71 insertions(+) create mode 100755 tests/generic/912 create mode 100644 tests/generic/912.out diff --git a/tests/generic/912 b/tests/generic/912 new file mode 100755 index 00000000..53fc9e86 --- /dev/null +++ b/tests/generic/912 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode works when the CoW +# range originally covers multiple extents, some holes, some not. +# (MMAP version of generic/191,190) +# - Create a file and truncate a second file. +# - Reflink the odd blocks of the first file into the second file. +# - mmap CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/912.out b/tests/generic/912.out new file mode 100644 index 00000000..b00369b3 --- /dev/null +++ b/tests/generic/912.out @@ -0,0 +1,12 @@ +QA output created by 912 +Format and mount +Create the original files +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-912/file1 +fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-912/file3 +fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-912/file3.chk +mmap CoW across the transition +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-912/file1 +09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-912/file3 +09101629908f9bdd5d178e7ce20bb1bb SCRATCH_MNT/test-912/file3.chk From patchwork Thu Nov 11 08:50: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: 12614403 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 267FFC433EF for ; Thu, 11 Nov 2021 08:51:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CA6B61267 for ; Thu, 11 Nov 2021 08:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232446AbhKKIyE (ORCPT ); Thu, 11 Nov 2021 03:54:04 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:34979 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232022AbhKKIyD (ORCPT ); Thu, 11 Nov 2021 03:54:03 -0500 IronPort-Data: A9a23:qjFhFKCmMPhh6RVW/zXhw5YqxClBgxIJ4g17XOLfVwO80WxzhjAFmmMaUGiBaf2Da2f9fNggat/n9UxSuJKAx9UxeLYW3SszFioV86IpJjg4wn/YZnrUdouaJK5ex512huLocYZkERcwmj/3auK49CAljfnVLlbBILWs1h5ZFFYMpBgJ2UoLd94R2uaEsPDha++/kYqaT/73ZDdJ7wVJ3lc8sMpvnv/AUMPa41v0tnRmDRxCUcS3e3M9VPrzLonpR5f0rxU9IwK0ewrD5OnREmLx9BFrBM6nk6rgbwsBRbu60Qqm0yIQAvb9xEMZ4HFaPqUTbZLwbW9NljyPhME3xtNWqbS+VAUoIrbR3u8aVnG0FgknZPIcoeOfeCTXXcu7iheun2HX6/t1EEwtIZYw5Ol6GydN+OYeJTRLaQqM799aaprTpvJE35xldZe0ethE/CwI8N0QNt5+KbirfkkAzYIwMO8Mu/1z IronPort-HdrOrdr: A9a23:NPWU/K8VqD+2vAlzmIpuk+DkI+orL9Y04lQ7vn2ZKCYlFvBw8vrCoB1173HJYUkqMk3I9ergBEDiewK4yXcW2/hzAV7KZmCP11dAR7sSj7cKrQeBJwTOssZZ1YpFN5N1EcDMCzFB5vrS0U2VFMkBzbC8nJyVuQ== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214014" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:12 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 9F6FD4D10A18 for ; Thu, 11 Nov 2021 16:51:11 +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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:10 +0800 From: Shiyang Ruan To: Subject: [PATCH 05/13] generic: add mmap CoW test for delalloc&destination extents Date: Thu, 11 Nov 2021 16:50:58 +0800 Message-ID: <20211111085106.937684-6-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 9F6FD4D10A18.A0F1D 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 Ensuring that copy on write in mmap mode works when the CoW range originally covers multiple extents, some delalloc, some not. (MMAP version of generic/195,194) Also, add a check to make sure the delalloc block accutally exists. Signed-off-by: Shiyang Ruan --- common/reflink | 3 +++ tests/generic/913 | 61 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/913.out | 12 +++++++++ 3 files changed, 76 insertions(+) create mode 100755 tests/generic/913 create mode 100644 tests/generic/913.out diff --git a/common/reflink b/common/reflink index ee60398e..38210673 100644 --- a/common/reflink +++ b/common/reflink @@ -296,6 +296,9 @@ _weave_reflink_holes_delalloc() { _pwrite_byte 0x62 $((blksz * i)) $blksz $dfile _pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk done + # make sure we actually got delalloc block + $FILEFRAG_PROG -v $dfile 2>&1 | grep -q delalloc || \ + _notrun "test requires delayed allocation writes" } # Create a file of interleaved regular blocks and reflinked blocks diff --git a/tests/generic/913 b/tests/generic/913 new file mode 100755 index 00000000..c02886fa --- /dev/null +++ b/tests/generic/913 @@ -0,0 +1,61 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode works when the CoW +# range originally covers multiple extents, some delalloc, some not. +# (MMAP version of generic/195,194) +# - Create a file. +# - Reflink the odd blocks of the first file into the second file. +# - Buffered write the even blocks of the second file. +# - mmap CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_weave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +_weave_reflink_holes_delalloc $blksz $nr $testdir/file3 >> $seqres.full +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/913.out b/tests/generic/913.out new file mode 100644 index 00000000..1f08400e --- /dev/null +++ b/tests/generic/913.out @@ -0,0 +1,12 @@ +QA output created by 913 +Format and mount +Create the original files +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-913/file1 +fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-913/file3 +fa50dba51826899c372464a153cb2117 SCRATCH_MNT/test-913/file3.chk +mmap CoW across the transition +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-913/file1 +55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-913/file3 +55968a95dfc0120df4e8485576514320 SCRATCH_MNT/test-913/file3.chk From patchwork Thu Nov 11 08:50: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: 12614421 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 E828EC433EF for ; Thu, 11 Nov 2021 08:51:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D61F961989 for ; Thu, 11 Nov 2021 08:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232619AbhKKIyW (ORCPT ); Thu, 11 Nov 2021 03:54:22 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:31067 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232618AbhKKIyS (ORCPT ); Thu, 11 Nov 2021 03:54:18 -0500 IronPort-Data: A9a23:AH44QKs+DKBKktUKUFIjk8QGFufnVEpcMUV32f8akzHdYEJGY0x3nzBLXG+HP/iJNmagKtgnb9iz9xgE75HdztA1GlRupXhgHilAwSbnLY7Hdx+vZUt+DSFioHpPtpxYMp+ZRCwNZie0SiyFb/6x8hGQ6YnSHuClUbedYngsLeNZYHxJZSxLyrdRbrFA0YDR7zOl4bsekuWHULOX82cc3lE8t8pvnChSUMHa41v0iLCRicdj5zcyn1FNZH4WyDrYw3HQGuG4FcbiLwrPIS3Qw4/Xw/stIovNfrfTeUtMTKPQPBSVlzxdXK3Kbhpq/3R0i/hkcqFHLxo/ZzahxridzP1XqJW2UhZvMKvXhMwTThtZDzpje6ZB/dcrJFDm6JPJlhGeKCKEL/JGSRte0Zcj0uhsHWxV6ecwNj8AdFaAiviwzbb9TfNj7vnPhuGD0Jg34ykmlG+GS619B82rfkkD3vcAtB9YuyyENam2ixIlVAdS IronPort-HdrOrdr: A9a23:QtLwoKBTxF5uutjlHemQ55DYdb4zR+YMi2TDtnoBLSC9F/b0qynAppomPGDP4gr5NEtApTniAtjkfZq/z+8X3WB5B97LMzUO01HYTr2Kg7GD/xTQXwX69sN4kZxrarVCDrTLZmRSvILX5xaZHr8brOW6zA== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214031" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id 290EF4D10A10 for ; Thu, 11 Nov 2021 16:51:12 +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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:10 +0800 From: Shiyang Ruan To: Subject: [PATCH 06/13] generic: add mmap CoW test for mixed&destination extents Date: Thu, 11 Nov 2021 16:50:59 +0800 Message-ID: <20211111085106.937684-7-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 290EF4D10A10.ADE8B 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 Ensuring that copy on write in mmap mode works when the CoW range originally covers multiple extents, mixed with reflinked, unwritten, hole, regular and delalloc blocks. (MMAP version of generic/200,199) Also, add a check to make sure the delalloc block accutally exists. Signed-off-by: Shiyang Ruan --- common/reflink | 3 ++ tests/generic/914 | 68 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/914.out | 12 ++++++++ 3 files changed, 83 insertions(+) create mode 100755 tests/generic/914 create mode 100644 tests/generic/914.out diff --git a/common/reflink b/common/reflink index 38210673..84173d59 100644 --- a/common/reflink +++ b/common/reflink @@ -362,6 +362,9 @@ _weave_reflink_rainbow_delalloc() { _pwrite_byte 0x62 $((blksz * i)) $blksz $dfile _pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk done + # make sure we actually got delalloc block + $FILEFRAG_PROG -v $dfile 2>&1 | grep -q delalloc || \ + _notrun "test requires delayed allocation writes" } # Make the source file have interleaved regular blocks and reflinked blocks diff --git a/tests/generic/914 b/tests/generic/914 new file mode 100755 index 00000000..211f6f26 --- /dev/null +++ b/tests/generic/914 @@ -0,0 +1,68 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode works when the CoW +# range originally covers multiple extents, mixed with reflinked, unwritten, +# hole, regular and delalloc blocks. +# (MMAP version of generic/200,199) +# - Create a file with the following repeating sequence of blocks: +# 1. reflinked +# 2. unwritten +# 3. hole +# 4. regular block +# 5. delalloc +# - mmap CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./common/preamble +_begin_fstest auto quick clone punch + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" +_require_xfs_io_command "fpunch" +_require_cp_reflink +_require_odirect + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_weave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +_weave_reflink_rainbow_delalloc $blksz $nr $testdir/file3 >> $seqres.full +# now cow +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file3.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file3.chk | _filter_scratch + +# success, all done +status=0 diff --git a/tests/generic/914.out b/tests/generic/914.out new file mode 100644 index 00000000..a8118a02 --- /dev/null +++ b/tests/generic/914.out @@ -0,0 +1,12 @@ +QA output created by 914 +Format and mount +Create the original files +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-914/file1 +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-914/file3 +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-914/file3.chk +mmap CoW across the transition +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-914/file1 +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-914/file3 +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-914/file3.chk From patchwork Thu Nov 11 08:51: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: 12614427 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 5B979C433EF for ; Thu, 11 Nov 2021 08:51:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 393E8619E1 for ; Thu, 11 Nov 2021 08:51:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232679AbhKKIyZ (ORCPT ); Thu, 11 Nov 2021 03:54:25 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:34979 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232587AbhKKIyV (ORCPT ); Thu, 11 Nov 2021 03:54:21 -0500 IronPort-Data: A9a23:QhHqCqq0rj+9wTXfIhqq+rrUXwheBmIEZxIvgKrLsJaIsI5as4F+vjAeDGHSO/bZNjP3c9x0b9vg9kIF7MWDytc1SwI5qH9mQiMRo6IpJ/zDcB6oYHn6wu4v7a5fx5xHLIGGdajYd1eEzvuWGuWn/SYUOZ2gHOKmUbedY3gpGGeIdQ964f5ds79g6mJXqYjha++9kYuaT/z3YDdJ6RYtWo4nw/7rRCdUgRjHkGhwUmrSyhx8lAS2e3E9VPrzLEwqRpfyatE88uWSH44vwFwll1418SvBCvv9+lr6WkYMBLDPPwmSkWcQUK+n6vRAjnVqlP9la7xHMgEK49mKt4kZJNFlr4G5Txw4eKPKg/g1XQRaEj1lIOtN/7qvzX2X6JXMlRSaKyCxqxlpJARsVWECwc55Gn1D7uADAC4CYwrFhO+sxr+/DO52iawewGPDVG8Ekig4i2iHUrB9GtaeK5gmLORwhF8Y7v2i196PDybBVQdSUQ== IronPort-HdrOrdr: A9a23:i9DAla0o3SfpL8bdW+XySgqjBI4kLtp133Aq2lEZdPU1SL39qynKppkmPHDP5gr5J0tLpTntAsi9qBDnhPtICOsqTNSftWDd0QPGEGgI1/qB/9SPIU3D398Y/aJhXow7M9foEGV95PyQ3CCIV/om3/mLmZrFudvj X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214035" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD05.g08.fujitsu.local (unknown [10.167.33.204]) by cn.fujitsu.com (Postfix) with ESMTP id 4636C4D0DC96 for ; Thu, 11 Nov 2021 16:51:12 +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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:10 +0800 From: Shiyang Ruan To: Subject: [PATCH 07/13] generic: add mmap CoW test for regular&source extents Date: Thu, 11 Nov 2021 16:51:00 +0800 Message-ID: <20211111085106.937684-8-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 4636C4D0DC96.ADC12 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 Ensuring that copy on write in mmap mode to the source file when the CoW range covers regular unshared and regular shared blocks. (MMAP version of generic/284,287) Signed-off-by: Shiyang Ruan --- tests/generic/915 | 60 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/915.out | 12 +++++++++ 2 files changed, 72 insertions(+) create mode 100755 tests/generic/915 create mode 100644 tests/generic/915.out diff --git a/tests/generic/915 b/tests/generic/915 new file mode 100755 index 00000000..2829a190 --- /dev/null +++ b/tests/generic/915 @@ -0,0 +1,60 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode to the source file when the +# CoW range covers regular unshared and regular shared blocks. +# (MMAP version of generic/284,287) +# - Create two files. +# - Reflink the odd blocks of the first file into the second file. +# - mmap CoW the first file across the halfway mark, starting with the +# regular extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_sweave_reflink_regular $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/915.out b/tests/generic/915.out new file mode 100644 index 00000000..178fc665 --- /dev/null +++ b/tests/generic/915.out @@ -0,0 +1,12 @@ +QA output created by 915 +Format and mount +Create the original files +Compare files +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-915/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-915/file3 +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-915/file1.chk +mmap CoW across the transition +Compare files +2dc2b131303b2f70ddb480778caac8b7 SCRATCH_MNT/test-915/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-915/file3 +2dc2b131303b2f70ddb480778caac8b7 SCRATCH_MNT/test-915/file1.chk From patchwork Thu Nov 11 08:51:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12614413 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 12D6CC433EF for ; Thu, 11 Nov 2021 08:51:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E88F761267 for ; Thu, 11 Nov 2021 08:51:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232431AbhKKIyR (ORCPT ); Thu, 11 Nov 2021 03:54:17 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:34979 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232520AbhKKIyI (ORCPT ); Thu, 11 Nov 2021 03:54:08 -0500 IronPort-Data: A9a23:NoR3qK2NEiauRFCmzvbD5c9zkn2cJEfYwER7XOPLsXnJhjojgTFRmGJKWWGAOa6LMWGgLo92OYSw9kJX65aHzYc2QQE+nZ1PZygU8JKaX7x1DatR0xu6d5SFFAQ+hyknQoGowPscEzmM+X9BDpC79SMljPjRHuKhYAL5EnsZqTFMGX5JZS1Ly7ZRbr5A2bBVMivV0T/Ai5S31GyNh1aYBlkpB5er83uDihhdVAQw5TTSbdgT1LPXeuJ84Jg3fcldJFOgKmVY83LTegrN8F251juxExYFAdXjnKv5c1ERX/jZOg3mZnh+AvDk20Yd4HdplPtT2Pk0MC+7jx2Tgtl308QLu5qrVS8nI6/NhP8AFRJfFkmSOIUfoeCdeCTn6537I0ruNiGEL+9VJE8tIYAD5v1fH25D77obJSoLYxTFgPi5qI9X4MEEat8LdZGtZd1A/Co7i2yxMBrveribK42i2DOS9GpYahhyIMvj IronPort-HdrOrdr: A9a23:n4hY0q91szYbtGHymQ9uk+DkI+orL9Y04lQ7vn2ZKCYlFvBw8vrCoB1173HJYUkqMk3I9ergBEDiewK4yXcW2/hzAV7KZmCP11dAR7sSj7cKrQeBJwTOssZZ1YpFN5N1EcDMCzFB5vrS0U2VFMkBzbC8nJyVuQ== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214029" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 961E24D10A0F for ; Thu, 11 Nov 2021 16:51:12 +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; Thu, 11 Nov 2021 16:51:13 +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; Thu, 11 Nov 2021 16:51:11 +0800 From: Shiyang Ruan To: Subject: [PATCH 08/13] generic: add mmap CoW test for unwritten&source extents Date: Thu, 11 Nov 2021 16:51:01 +0800 Message-ID: <20211111085106.937684-9-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 961E24D10A0F.AEA97 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 Ensuring that copy on write in mmap mode to the source file when the CoW range covers unwritten and regular shared blocks. (MMAP version of generic/289,290) Signed-off-by: Shiyang Ruan --- tests/generic/916 | 62 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/916.out | 12 +++++++++ 2 files changed, 74 insertions(+) create mode 100755 tests/generic/916 create mode 100644 tests/generic/916.out diff --git a/tests/generic/916 b/tests/generic/916 new file mode 100755 index 00000000..0e5d532d --- /dev/null +++ b/tests/generic/916 @@ -0,0 +1,62 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode to the source file when the +# CoW range covers unwritten and regular shared blocks. +# (MMAP version of generic/289,290) +# - Create two files. +# - fallocate the first file. +# - Write the odd blocks of the first file. +# - Reflink the odd blocks of the first file into the second file. +# - mmap CoW the first file across the halfway mark, starting with the +# regular extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_sweave_reflink_unwritten $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/916.out b/tests/generic/916.out new file mode 100644 index 00000000..3a34410f --- /dev/null +++ b/tests/generic/916.out @@ -0,0 +1,12 @@ +QA output created by 916 +Format and mount +Create the original files +Compare files +b8a8a88d4c143f79900c4b4e79aa3e37 SCRATCH_MNT/test-916/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-916/file3 +b8a8a88d4c143f79900c4b4e79aa3e37 SCRATCH_MNT/test-916/file1.chk +mmap CoW across the transition +Compare files +e8cf59797f0b3758c8878c368bb4cf7e SCRATCH_MNT/test-916/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-916/file3 +e8cf59797f0b3758c8878c368bb4cf7e SCRATCH_MNT/test-916/file1.chk From patchwork Thu Nov 11 08:51:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12614419 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 72A54C433F5 for ; Thu, 11 Nov 2021 08:51:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59C906162E for ; Thu, 11 Nov 2021 08:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232604AbhKKIyV (ORCPT ); Thu, 11 Nov 2021 03:54:21 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:34979 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232619AbhKKIyS (ORCPT ); Thu, 11 Nov 2021 03:54:18 -0500 IronPort-Data: A9a23:mKyyB6MjWTr0UpXvrR25lcFynXyQoLVcMsFnjC/WdVa91zN0gjcGymoZWD+GOazbZjH3f991aIWyphkB6pXVm99gGjLY11k3ESsS9pCt6fd1j6vIF3rLaJWFFSqL1u1GAjX7BJ1yHiC0SiuFaOC79CAljPnQG9IQNcafUsxPbV49IMseoUI78wIJqtYAbemRW2thi/uryyHsEAPNNwpPD44hw/nrRCWDExjFkGhwUlQWPZintbJF/pUfJMp3yaqZdxMUTmTId9NWSdovzJnhlo/Y1xwrTN24kLfnaVBMSbnXVeSMoiMOHfH83V4Z/Wpvuko4HKN0hUN/kSiAmctgjttLroCYRxorP7HXhaIWVBww/yRWZPQZouabeSPl2SCU5wicG5f2+N1gF107JpED0vh4DHsI9vECLj0JKBeZiIqLLBiTIgV3rp17apC1Y8VE4Tc9pQw1xM0OGfjrK5gmL/cItNvouv1zIA== IronPort-HdrOrdr: A9a23:DNR3aKzJkhVZ3mPeC2gPKrPwEL1zdoMgy1knxilNoH1uA6ilfqWV8cjzuiWbtN9vYhsdcLy7WZVoIkmskKKdg7NhXotKNTOO0ASVxepZnOnfKlPbexHWx6p00KdMV+xEAsTsMF4St63HyTj9P9E+4NTvysyVuds= X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214032" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD05.g08.fujitsu.local (unknown [10.167.33.204]) by cn.fujitsu.com (Postfix) with ESMTP id 62E264D10A12 for ; Thu, 11 Nov 2021 16:51:13 +0800 (CST) Received: from G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) by G08CNEXMBPEKD05.g08.fujitsu.local (10.167.33.204) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Thu, 11 Nov 2021 16:51:13 +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; Thu, 11 Nov 2021 16:51:13 +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; Thu, 11 Nov 2021 16:51:11 +0800 From: Shiyang Ruan To: Subject: [PATCH 09/13] generic: add mmap CoW test for holes&source extents Date: Thu, 11 Nov 2021 16:51:02 +0800 Message-ID: <20211111085106.937684-10-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 62E264D10A12.AD06D 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 Ensuring that copy on write in mmap mode to the source file when the CoW range covers holes and regular shared blocks. (MMAP version of generic/291,292) Signed-off-by: Shiyang Ruan --- tests/generic/917 | 62 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/917.out | 12 +++++++++ 2 files changed, 74 insertions(+) create mode 100755 tests/generic/917 create mode 100644 tests/generic/917.out diff --git a/tests/generic/917 b/tests/generic/917 new file mode 100755 index 00000000..74e5d345 --- /dev/null +++ b/tests/generic/917 @@ -0,0 +1,62 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode to the source file when the +# CoW range covers holes and regular shared blocks. +# (MMAP version of generic/291,292) +# - Create two files. +# - Truncate the first file. +# - Write the odd blocks of the first file. +# - Reflink the odd blocks of the first file into the second file. +# - mmap CoW the first file across the halfway mark, starting with the +# regular extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/917.out b/tests/generic/917.out new file mode 100644 index 00000000..13c77935 --- /dev/null +++ b/tests/generic/917.out @@ -0,0 +1,12 @@ +QA output created by 917 +Format and mount +Create the original files +Compare files +b8a8a88d4c143f79900c4b4e79aa3e37 SCRATCH_MNT/test-917/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-917/file3 +b8a8a88d4c143f79900c4b4e79aa3e37 SCRATCH_MNT/test-917/file1.chk +mmap CoW across the transition +Compare files +e8cf59797f0b3758c8878c368bb4cf7e SCRATCH_MNT/test-917/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-917/file3 +e8cf59797f0b3758c8878c368bb4cf7e SCRATCH_MNT/test-917/file1.chk From patchwork Thu Nov 11 08:51:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12614417 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 38206C433FE for ; Thu, 11 Nov 2021 08:51:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23C2761267 for ; Thu, 11 Nov 2021 08:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232543AbhKKIyS (ORCPT ); Thu, 11 Nov 2021 03:54:18 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:31067 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232530AbhKKIyI (ORCPT ); Thu, 11 Nov 2021 03:54:08 -0500 IronPort-Data: A9a23:gbwtM6nBCpbZwXTv0HZNCoDo5gydJERdPkR7XQ2eYbTBsI5bp2EAyzYZWWyFb/qIYWOnKoxzYITj/EkGuMTczoBgGVFt+CA2RRqmi+KfW43BcR2Y0wB+jyH7ZBs+qZ1YM7EsFehsJpPnjkrrYueJQUVUj/nSH+OlUbacZ0ideCc/IMsfoUM68wIGqt4w6TSJK1vlVeLa+6UzCnf8s9JHGj58B5a4lf9alK+aVAX0EbAJTasjUFf2zxH5BX+ETE27ByOQroJ8RoZWSwtfpYxV8F81/z91Yj+kur39NEMXQL/OJhXIgX1TM0SgqkEa4HVsjeBgb7xBAatUo2zhc9RZ0shEs4ehDwkvJbHklvkfUgVDDmd1OqguFLrveCHg65XPlxaeG5fr67A0ZK0sBqUW4fp6Gn1V3eIXJSpLbR2Zge+yhrWhRYFRam4LRCXwFNpH/Cg+kneCVrB7Ka0vip7ivbdwtArcTOgTdRoGW/ckVA== IronPort-HdrOrdr: A9a23:TIeHc6uUXQ7mz6KlUawfYdvW7skDStV00zEX/kB9WHVpm62j5qSTdZEguCMc5wx+ZJheo7q90cW7IE80lqQFhLX5X43SPzUO0VHARO5fBODZsl/d8kPFltJ15ONJdqhSLJnKB0FmsMCS2mKFOudl7N6Z0K3Av4vj80s= X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214030" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD05.g08.fujitsu.local (unknown [10.167.33.204]) by cn.fujitsu.com (Postfix) with ESMTP id 8BCC84D10A13 for ; Thu, 11 Nov 2021 16:51:13 +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; Thu, 11 Nov 2021 16:51:13 +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; Thu, 11 Nov 2021 16:51:12 +0800 From: Shiyang Ruan To: Subject: [PATCH 10/13] generic: add mmap CoW test for delalloc&source extents Date: Thu, 11 Nov 2021 16:51:03 +0800 Message-ID: <20211111085106.937684-11-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 8BCC84D10A13.AF6EA 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 Ensuring that copy on write in mmap mode to the source file when the CoW range covers delalloc blocks and regular shared blocks. (MMAP version of generic/293,295) Signed-off-by: Shiyang Ruan --- common/reflink | 3 ++ tests/generic/918 | 64 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/918.out | 12 ++++++++ 3 files changed, 79 insertions(+) create mode 100755 tests/generic/918 create mode 100644 tests/generic/918.out diff --git a/common/reflink b/common/reflink index 84173d59..e304ddc8 100644 --- a/common/reflink +++ b/common/reflink @@ -431,4 +431,7 @@ _sweave_reflink_holes_delalloc() { _pwrite_byte 0x64 $((blksz * i)) $blksz $sfile _pwrite_byte 0x64 $((blksz * i)) $blksz $sfile.chk done + # make sure we actually got delalloc block + $FILEFRAG_PROG -v $sfile 2>&1 | grep -q delalloc || \ + _notrun "test requires delayed allocation writes" } diff --git a/tests/generic/918 b/tests/generic/918 new file mode 100755 index 00000000..f7767a8e --- /dev/null +++ b/tests/generic/918 @@ -0,0 +1,64 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode to the source file when the +# CoW range covers delalloc blocks and regular shared blocks. +# (MMAP version of generic/293,295) +# - Create two files. +# - Truncate the first file. +# - Write the odd blocks of the first file. +# - Reflink the odd blocks of the first file into the second file. +# - Write the even blocks of the first file. +# - mmap CoW the first file across the halfway mark, starting with the +# regular extent. +# - Check that the files are now different where we say they're different. +# +. ./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" + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_sweave_reflink_holes $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +_sweave_reflink_holes_delalloc $blksz $nr $testdir/file1 >> $seqres.full +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +# success, all done +status=0 +exit diff --git a/tests/generic/918.out b/tests/generic/918.out new file mode 100644 index 00000000..465ade08 --- /dev/null +++ b/tests/generic/918.out @@ -0,0 +1,12 @@ +QA output created by 918 +Format and mount +Create the original files +Compare files +b8a8a88d4c143f79900c4b4e79aa3e37 SCRATCH_MNT/test-918/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-918/file3 +b8a8a88d4c143f79900c4b4e79aa3e37 SCRATCH_MNT/test-918/file1.chk +mmap CoW across the transition +Compare files +35e2170e14665b780c6dec328d6a263b SCRATCH_MNT/test-918/file1 +ce2023f765eba19677517c511886d5c9 SCRATCH_MNT/test-918/file3 +35e2170e14665b780c6dec328d6a263b SCRATCH_MNT/test-918/file1.chk From patchwork Thu Nov 11 08:51:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12614423 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 BF1D2C433FE for ; Thu, 11 Nov 2021 08:51:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8C956162E for ; Thu, 11 Nov 2021 08:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232519AbhKKIyX (ORCPT ); Thu, 11 Nov 2021 03:54:23 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:32308 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232357AbhKKIyS (ORCPT ); Thu, 11 Nov 2021 03:54:18 -0500 IronPort-Data: A9a23:pTWVKK0M3ohXIzpq9PbD5c9zkn2cJEfYwER7XOPLsXnJhjMghTMBnTQYUDqHOviIZmvwKYp1YI6zoUoHsJ7dz942QQE+nZ1PZygU8JKaX7x1DatR0xu6d5SFFAQ+hyknQoGowPscEzmM+X9BDpC79SMljPjRHuKhYAL5EnsZqTFMGX5JZS1Ly7ZRbr5A2bBVMivV0T/Ai5S31GyNh1aYBlkpB5er83uDihhdVAQw5TTSbdgT1LPXeuJ84Jg3fcldJFOgKmVY83LTegrN8F251juxExYFAdXjnKv5c1ERX/jZOg3mZnh+AvDk20Yd4HdplPtT2Pk0MC+7jx2Tgtl308QLu5qrVS8nI6/NhP8AFRJfFkmSOIUfoeCdeCTn65P7I0ruNiGEL+9VJE8tIYAD5v1fH25D77obJSoLYxTFgPi5qI9X4MEEat8LdZGtZd1A/Co7i2yxMBrveribK42i2DOS9GhYahhyIMvj IronPort-HdrOrdr: A9a23:Z4I8T6oowfuCpZ9+nmTcGe8aV5oXeYIsimQD101hICG9E/bo8/xG+c536faaslgssQ4b8+xoVJPgfZq+z+8R3WByB8bAYOCOggLBQ72KhrGSoQEIdRefysdtkY9kc4VbTOb7FEVGi6/BizWQIpINx8am/cmT6dvj8w== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214027" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id D99F44D10A15 for ; Thu, 11 Nov 2021 16:51:13 +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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:12 +0800 From: Shiyang Ruan To: Subject: [PATCH 11/13] generic: add buffered-io CoW test for mixed&source extents Date: Thu, 11 Nov 2021 16:51:04 +0800 Message-ID: <20211111085106.937684-12-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: D99F44D10A15.AEFD2 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 Ensuring that copy on write in buffered mode works when the CoW range originally covers multiple extents, mixed with reflinked, unwritten, hole, regular and delalloc blocks. Signed-off-by: Shiyang Ruan --- common/reflink | 54 +++++++++++++++++++++++++++++++++++ tests/generic/919 | 66 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/919.out | 12 ++++++++ 3 files changed, 132 insertions(+) create mode 100755 tests/generic/919 create mode 100644 tests/generic/919.out diff --git a/common/reflink b/common/reflink index e304ddc8..85b586cb 100644 --- a/common/reflink +++ b/common/reflink @@ -435,3 +435,57 @@ _sweave_reflink_holes_delalloc() { $FILEFRAG_PROG -v $sfile 2>&1 | grep -q delalloc || \ _notrun "test requires delayed allocation writes" } + +# Create a file of interleaved holes, unwritten blocks, regular blocks, and +# reflinked blocks +_sweave_reflink_rainbow() { + blksz=$1 + nr=$2 + sfile=$3 + dfile=$4 + + $XFS_IO_PROG -f -c "truncate $((blksz * nr))" $sfile + _pwrite_byte 0x00 0 $((blksz * nr)) $sfile.chk + _pwrite_byte 0x61 0 $((blksz * nr)) $dfile + seq 0 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x61 $((blksz * i)) $blksz $sfile + _pwrite_byte 0x61 $((blksz * i)) $blksz $sfile.chk + done + # 0 blocks are reflinked + seq 0 5 $((nr - 1)) | while read i; do + _reflink_range $sfile $((blksz * i)) $dfile $((blksz * i)) $blksz + _pwrite_byte 0x61 $((blksz * i)) $blksz $sfile.chk + done + # 1 blocks are unwritten + seq 1 5 $((nr - 1)) | while read i; do + $XFS_IO_PROG -f -c "falloc $((blksz * i)) $blksz" $sfile + _pwrite_byte 0x00 $((blksz * i)) $blksz $sfile.chk + done + # 2 blocks are holes + seq 2 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x00 $((blksz * i)) $blksz $sfile.chk + done + # 3 blocks are regular + seq 3 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x71 $((blksz * i)) $blksz $sfile + _pwrite_byte 0x71 $((blksz * i)) $blksz $sfile.chk + done + # 4 blocks will be delalloc later +} + +# For a file created with _weave_reflink_rainbow, fill the holes with delalloc +# extents +_sweave_reflink_rainbow_delalloc() { + blksz=$1 + nr=$2 + dfile=$3 + + # 4 blocks are delalloc (do later) + seq 4 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x62 $((blksz * i)) $blksz $sfile + _pwrite_byte 0x62 $((blksz * i)) $blksz $sfile.chk + done + # make sure we actually got delalloc block + $FILEFRAG_PROG -v $sfile 2>&1 | grep -q delalloc || \ + _notrun "test requires delayed allocation writes" +} diff --git a/tests/generic/919 b/tests/generic/919 new file mode 100755 index 00000000..932c98d7 --- /dev/null +++ b/tests/generic/919 @@ -0,0 +1,66 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in buffered mode works when the CoW +# range originally covers multiple extents, mixed with reflinked, unwritten, +# hole, regular and delalloc blocks. +# - Create a file with the following repeating sequence of blocks: +# 1. reflinked +# 2. unwritten +# 3. hole +# 4. regular block +# 5. delalloc +# - CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./common/preamble +_begin_fstest auto quick clone punch + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" +_require_xfs_io_command "fpunch" +_require_cp_reflink +_require_odirect + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_sweave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +echo "CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +_sweave_reflink_rainbow_delalloc $blksz $nr $testdir/file1 >> $seqres.full +# now cow +$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full +_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +# success, all done +status=0 diff --git a/tests/generic/919.out b/tests/generic/919.out new file mode 100644 index 00000000..a8eb7d6b --- /dev/null +++ b/tests/generic/919.out @@ -0,0 +1,12 @@ +QA output created by 919 +Format and mount +Create the original files +Compare files +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-919/file1 +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-919/file3 +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-919/file1.chk +CoW across the transition +Compare files +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-919/file1 +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-919/file3 +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-919/file1.chk From patchwork Thu Nov 11 08:51:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiyang Ruan X-Patchwork-Id: 12614415 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 D70F9C4332F for ; Thu, 11 Nov 2021 08:51:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBDEE61994 for ; Thu, 11 Nov 2021 08:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232530AbhKKIyT (ORCPT ); Thu, 11 Nov 2021 03:54:19 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:32308 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232537AbhKKIyJ (ORCPT ); Thu, 11 Nov 2021 03:54:09 -0500 IronPort-Data: A9a23:Is+DiqgWxBNIVUH1yZLgU1AmX161fBIKZh0ujC45NGQNrF6WrkUOm2RMXm3UO/eJZTSkL9pwYY2z8htUvpSDmIBmSwA+/Hw8FHgiRejtX4rAdhiqV8+xwmwvdGo+toNGLICowPkcFhcwnT/wdOi+xZVA/fvQHOOlUbecYn0ZqTJME0/NtzoywobVvaY42bBVMyvV0T/Di5W31G2NglaYAUpIg063ky6Didyp0N8uUvPSUtgQ1LPWvyF94JvyvshdJVOgKmVfNrbSq+ouUNiEEm3lExcFUrtJk57wdAsEX7zTIROTzHFRXsBOgDAb/mprjPl9b6FaNC+7iB3Q9zx14M9QvJqrWEEnOLbQsOoAURhECDw4NqpDkFPCCSHm7pbKkxWcIxMAxN0rVinaJ7Yw9P1rDHpS7tQGJz0XKBOOneS7xPS8UOYEuyiJBKEHJ6tG4jc5k26fVq1gHPj+r2zxzYcw9F8NagpmQJ4yv/YkVAc= IronPort-HdrOrdr: A9a23:wzvYAK8C8mYrvekKw/xuk+DkI+orL9Y04lQ7vn2ZKCYlFvBw8vrCoB1173HJYUkqMk3I9ergBEDiewK4yXcW2/hzAV7KZmCP11dAR7sSj7cKrQeBJwTOssZZ1YpFN5N1EcDMCzFB5vrS0U2VFMkBzbC8nJyVuQ== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214028" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 39EA04D10A16 for ; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:12 +0800 From: Shiyang Ruan To: Subject: [PATCH 12/13] generic: add direct-io CoW test for mixed&source extents Date: Thu, 11 Nov 2021 16:51:05 +0800 Message-ID: <20211111085106.937684-13-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 39EA04D10A16.AE6BE 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 Ensuring that copy on write in buffered mode works when the CoW range originally covers multiple extents, mixed with reflinked, unwritten, hole, regular and delalloc blocks. Signed-off-by: Shiyang Ruan --- tests/generic/920 | 66 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/920.out | 12 ++++++++ 2 files changed, 78 insertions(+) create mode 100755 tests/generic/920 create mode 100644 tests/generic/920.out diff --git a/tests/generic/920 b/tests/generic/920 new file mode 100755 index 00000000..ec533e37 --- /dev/null +++ b/tests/generic/920 @@ -0,0 +1,66 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in direct-io mode works when the CoW +# range originally covers multiple extents, mixed with reflinked, unwritten, +# hole, regular and delalloc blocks. +# - Create a file with the following repeating sequence of blocks: +# 1. reflinked +# 2. unwritten +# 3. hole +# 4. regular block +# 5. delalloc +# - directio CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./common/preamble +_begin_fstest auto quick clone punch + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" +_require_xfs_io_command "fpunch" +_require_cp_reflink +_require_odirect + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_sweave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +echo "directio CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +_sweave_reflink_rainbow_delalloc $blksz $nr $testdir/file1 >> $seqres.full +# now cow +$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $cowsz $cowoff $cowsz" $testdir/file1 >> $seqres.full +_pwrite_byte 0x63 $cowoff $cowsz $testdir/file1.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +# success, all done +status=0 diff --git a/tests/generic/920.out b/tests/generic/920.out new file mode 100644 index 00000000..e499460c --- /dev/null +++ b/tests/generic/920.out @@ -0,0 +1,12 @@ +QA output created by 920 +Format and mount +Create the original files +Compare files +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-920/file1 +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-920/file3 +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-920/file1.chk +directio CoW across the transition +Compare files +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-920/file1 +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-920/file3 +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-920/file1.chk From patchwork Thu Nov 11 08:51: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: 12614425 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 CD4FDC433FE for ; Thu, 11 Nov 2021 08:51:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5B3361989 for ; Thu, 11 Nov 2021 08:51:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232565AbhKKIyY (ORCPT ); Thu, 11 Nov 2021 03:54:24 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:31067 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232513AbhKKIyV (ORCPT ); Thu, 11 Nov 2021 03:54:21 -0500 IronPort-Data: A9a23:LHGxKqJkJY+zuy2EFE+RzZclxSXFcZb7ZxGrkP8bfHC90D921jMDzDMfW2qFP/uKYDf2f9ggPI+38x4OvsDcmoNqS1BcGVNFFSwT8ZWfbTi6wuYcBwvLd4ubChsPA/w2MrEsF+hpCC+DzvuRGuK59yAljPjQHueU5NPsYUideyc1EU/Ntjozw4bVsqYw6TSIK1vlVeHa+qUzC3f5s9JACV/43orYwP9ZUFsejxtD1rA2TagjUFYzDBD5BrpHTU26ByOQroW5goeHq+j/ILGRpgs1/j8mDJWrj7T6blYXBLXVOGBiiFIPA+773EcE/Xd0j87XN9JFAatToy+UltZq2ZNDs4esYQk0PKzQg/lbWB5de817FfQfp+WefSDk7aR/yGWDKRMA2c5GAloqMJYE4c5pDmxUs/8VMjYAalaEne3e/V4RYoGAnex6dI+yYtxZ4SomkFnk4T8dacira833CRVwjV/cXvxzIMs= IronPort-HdrOrdr: A9a23:MofVJa9dKZvi8K21cdduk+DkI+orL9Y04lQ7vn2ZKCYlFvBw8vrCoB1173HJYUkqMk3I9ergBEDiewK4yXcW2/hzAV7KZmCP11dAR7sSj7cKrQeBJwTOssZZ1YpFN5N1EcDMCzFB5vrS0U2VFMkBzbC8nJyVuQ== X-IronPort-AV: E=Sophos;i="5.87,225,1631548800"; d="scan'208";a="117214034" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2021 16:51:18 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 8A9D84D10A19 for ; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51: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; Thu, 11 Nov 2021 16:51:13 +0800 From: Shiyang Ruan To: Subject: [PATCH 13/13] generic: add mmap CoW test for mixed&source extents Date: Thu, 11 Nov 2021 16:51:06 +0800 Message-ID: <20211111085106.937684-14-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> References: <20211111085106.937684-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: 8A9D84D10A19.AF3C2 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 Ensuring that copy on write in buffered mode works when the CoW range originally covers multiple extents, mixed with reflinked, unwritten, hole, regular and delalloc blocks. Signed-off-by: Shiyang Ruan --- tests/generic/921 | 67 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/921.out | 12 ++++++++ 2 files changed, 79 insertions(+) create mode 100755 tests/generic/921 create mode 100644 tests/generic/921.out diff --git a/tests/generic/921 b/tests/generic/921 new file mode 100755 index 00000000..7c463143 --- /dev/null +++ b/tests/generic/921 @@ -0,0 +1,67 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# FS QA Test No. xxx +# +# Ensuring that copy on write in mmap mode works when the CoW +# range originally covers multiple extents, mixed with reflinked, unwritten, +# hole, regular and delalloc blocks. +# - Create a file with the following repeating sequence of blocks: +# 1. reflinked +# 2. unwritten +# 3. hole +# 4. regular block +# 5. delalloc +# - mmap CoW across the halfway mark, starting with the unwritten extent. +# - Check that the files are now different where we say they're different. +# +. ./common/preamble +_begin_fstest auto quick clone punch + +# Import common functions. +. ./common/filter +. ./common/reflink + +# real QA test starts here +_require_scratch_reflink +_require_xfs_io_command "falloc" +_require_xfs_io_command "fpunch" +_require_cp_reflink +_require_odirect + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +echo "Create the original files" +blksz=65536 +nr=64 +filesize=$((blksz * nr)) +_sweave_reflink_rainbow $blksz $nr $testdir/file1 $testdir/file3 >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +echo "mmap CoW across the transition" +cowoff=$((filesize / 4)) +cowsz=$((filesize / 2)) +_sweave_reflink_rainbow_delalloc $blksz $nr $testdir/file1 >> $seqres.full +# now cow +mmapsz=$((cowoff + cowsz)) +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1 >> $seqres.full +_mwrite_byte 0x63 $cowoff $cowsz $mmapsz $testdir/file1.chk >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file3 | _filter_scratch +md5sum $testdir/file1.chk | _filter_scratch + +# success, all done +status=0 diff --git a/tests/generic/921.out b/tests/generic/921.out new file mode 100644 index 00000000..3405a4df --- /dev/null +++ b/tests/generic/921.out @@ -0,0 +1,12 @@ +QA output created by 921 +Format and mount +Create the original files +Compare files +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-921/file1 +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-921/file3 +6366fd359371414186688a0ef6988893 SCRATCH_MNT/test-921/file1.chk +mmap CoW across the transition +Compare files +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-921/file1 +bdbcf02ee0aa977795a79d25fcfdccb1 SCRATCH_MNT/test-921/file3 +26aa3a0749b867ec58363c8539ee5471 SCRATCH_MNT/test-921/file1.chk