generic: test accurate shared extent reporting
PATCH 1/1 generic: test accurate shared extent reporting
Ensure that we can create a file with a single extent, reflink two blocks out of the middle of that extent, and the resulting fiemap reports two shared extents, instead of lazily reporting the entire huge extent as shared.
--- tests/generic/929 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/929.out | 17 +++++++++ tests/generic/group | 1 + 3 files changed, 107 insertions(+) create mode 100755 tests/generic/929 create mode 100644 tests/generic/929.out
tests/generic/929 new file +89 -0
@@ -0,0 +1,89 @@ +#! /bin/bash +# FS QA Test No. 929 +# +# Check that bmap/fiemap accurately report shared extents. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_require_scratch_reflink +_require_fiemap + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +blocks=5 +blksz=65536 +sz=$((blocks * blksz)) + +echo "Create the original files" +$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1 >> $seqres.full +_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full +_scratch_cycle_mount + +echo "file1 extents and holes" +_count_extents $testdir/file1 +_count_holes $testdir/file1 + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 3)) $blksz >> $seqres.full +_reflink_range $testdir/file1 $((blksz * 3)) $testdir/file2 $blksz $blksz >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file2 | _filter_scratch + +echo "file1 extents and holes" +_count_extents $testdir/file1 +_count_holes $testdir/file1 +echo "file2 extents and holes" +_count_extents $testdir/file2 +_count_holes $testdir/file2 +echo "file1 shared extents" +$XFS_IO_PROG -c 'fiemap -v' $testdir/file1 | awk '{print $5}' | grep '0x.*[2367aAbBfF]...$' -c + +# success, all done +status=0 +exit
tests/generic/929.out new file +17 -0
@@ -0,0 +1,17 @@ +QA output created by 929 +Format and mount +Create the original files +file1 extents and holes +1 +0 +Compare files +17af09af790a9b4c79cddf72f6b642cb SCRATCH_MNT/test-929/file1 +79418df9c55ab7f58781cb7b9e7d5d91 SCRATCH_MNT/test-929/file2 +file1 extents and holes +5 +0 +file2 extents and holes +2 +2 +file1 shared extents +2
tests/generic/group +1 -0
@@ -375,3 +375,4 @@ 370 auto quick richacl 927 auto quick clone 928 auto quick clone dedupe +929 auto quick clone
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 56 lines · Darrick J. Wong
Ensure that we can create a file with a single extent, reflink two blocks out of the middle of that extent, and the resulting fiemap reports two shared extents, instead of lazily reporting the entire huge extent as shared.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/generic/929 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/929.out | 17 +++++++++ tests/generic/group | 1 + 3 files changed, 107 insertions(+) create mode 100755 tests/generic/929 create mode 100644 tests/generic/929.outtests/generic/929 new file +36
-0@@ -0,0 +1,89 @@ +#! /bin/bash +# FS QA Test No. 929 +# +# Check that bmap/fiemap accurately report shared extents. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.*
tests/generic/929 line 46
Quoted 10 lines
tests/generic/929 new file +10
-0+ wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux
Need "_supported_fs generic"
Quoted 29 lines
tests/generic/929 new file +29
-0+_require_scratch_reflink +_require_fiemap + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +blocks=5 +blksz=65536 +sz=$((blocks * blksz)) + +echo "Create the original files" +$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1 >> $seqres.full +_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full +_scratch_cycle_mount + +echo "file1 extents and holes" +_count_extents $testdir/file1 +_count_holes $testdir/file1 + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 3)) $blksz >> $seqres.full +_reflink_range $testdir/file1 $((blksz * 3)) $testdir/file2 $blksz $blksz >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch
tests/generic/929 line 85
Quoted 10 lines
tests/generic/929 new file +10
-0+md5sum $testdir/file2 | _filter_scratch + +echo "file1 extents and holes" +_count_extents $testdir/file1 +_count_holes $testdir/file1 +echo "file2 extents and holes" +_count_extents $testdir/file2 +_count_holes $testdir/file2 +echo "file1 shared extents" +$XFS_IO_PROG -c 'fiemap -v' $testdir/file1 | awk '{print $5}' | grep '0x.*[2367aAbBfF]...$' -c
Missing a command at the end?
Thanks,
Eryu
Quoted 36 lines
tests/generic/929 new file +4
-0+ +# success, all done +status=0 +exittests/generic/929.out new file +17
-0@@ -0,0 +1,17 @@ +QA output created by 929 +Format and mount +Create the original files +file1 extents and holes +1 +0 +Compare files +17af09af790a9b4c79cddf72f6b642cb SCRATCH_MNT/test-929/file1 +79418df9c55ab7f58781cb7b9e7d5d91 SCRATCH_MNT/test-929/file2 +file1 extents and holes +5 +0 +file2 extents and holes +2 +2 +file1 shared extents +2tests/generic/group +1
-0@@ -375,3 +375,4 @@ 370 auto quick richacl 927 auto quick clone 928 auto quick clone dedupe +929 auto quick clone
Quoted 61 lines · Eryu Guan
Quoted 60 lines · Darrick J. Wong
Ensure that we can create a file with a single extent, reflink two blocks out of the middle of that extent, and the resulting fiemap reports two shared extents, instead of lazily reporting the entire huge extent as shared.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/generic/929 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/929.out | 17 +++++++++ tests/generic/group | 1 + 3 files changed, 107 insertions(+) create mode 100755 tests/generic/929 create mode 100644 tests/generic/929.outtests/generic/929 new file +40
-0@@ -0,0 +1,89 @@ +#! /bin/bash +# FS QA Test No. 929 +# +# Check that bmap/fiemap accurately report shared extents. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* + wait +} + +# get standard environment, filters and checks
Quoted 8 lines
tests/generic/929 line 46
Quoted 6 lines
tests/generic/929 new file +6
-0+. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os LinuxNeed "
_supported_fsgeneric"
Ok.
Quoted 33 lines
Quoted 33 lines
tests/generic/929 new file +33
-0+_require_scratch_reflink +_require_fiemap + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +blocks=5 +blksz=65536 +sz=$((blocks * blksz)) + +echo "Create the original files" +$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1 >> $seqres.full +_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full +_scratch_cycle_mount + +echo "file1 extents and holes" +_count_extents $testdir/file1 +_count_holes $testdir/file1 + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 3)) $blksz >> $seqres.full +_reflink_range $testdir/file1 $((blksz * 3)) $testdir/file2 $blksz $blksz >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file2 | _filter_scratch + +echo "file1 extents and holes" +_count_extents $testdir/file1
Quoted 8 lines
tests/generic/929 line 85
Quoted 6 lines
tests/generic/929 new file +6
-0+_count_holes $testdir/file1 +echo "file2 extents and holes" +_count_extents $testdir/file2 +_count_holes $testdir/file2 +echo "file1 shared extents" +$XFS_IO_PROG -c 'fiemap -v' $testdir/file1 | awk '{print $5}' | grep '0x.*[2367aAbBfF]...$' -cMissing a command at the end?
Nope, it echoes the number of shared extents (that's what that awk and grep globule does), which /should/ be exactly 2.
(Unless I'm missing something?)
--D
Quoted 44 lines
Thanks,
EryuQuoted 32 lines
tests/generic/929 new file +4
-0+ +# success, all done +status=0 +exittests/generic/929.out new file +17
-0@@ -0,0 +1,17 @@ +QA output created by 929 +Format and mount +Create the original files +file1 extents and holes +1 +0 +Compare files +17af09af790a9b4c79cddf72f6b642cb SCRATCH_MNT/test-929/file1 +79418df9c55ab7f58781cb7b9e7d5d91 SCRATCH_MNT/test-929/file2 +file1 extents and holes +5 +0 +file2 extents and holes +2 +2 +file1 shared extents +2tests/generic/group +0
-0tests/generic/group line 378
Quoted 4 lines
tests/generic/group +1
-0@@ -375,3 +375,4 @@ 370 auto quick richacl 927 auto quick clone 928 auto quick clone dedupe +929 auto quick clone--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Darrick J. Wong
Quoted 7 lines · Eryu Guan
tests/generic/929 line 85
Quoted 3 lines · Darrick J. Wong
tests/generic/929 new file +3
-0+_count_holes $testdir/file2 +echo "file1 shared extents" +$XFS_IO_PROG -c 'fiemap -v' $testdir/file1 | awk '{print $5}' | grep '0x.*[2367aAbBfF]...$' -cMissing a command at the end?
Quoted 4 lines
Nope, it echoes the number of shared extents (that's what that awk and grep globule does), which /should/ be exactly 2.
(Unless I'm missing something?)
Ah, thanks! I saw "-c" at the end and thought it was part of xfs_io command without looking at it carefully.
Thanks,
Eryu
PATCH v2 1/1 generic: test accurate shared extent reporting
In reply to Darrick J. WongEnsure that we can create a file with a single extent, reflink two blocks out of the middle of that extent, and the resulting fiemap reports two shared extents, instead of lazily reporting the entire huge extent as shared.
v2: add _supported_fs
--- tests/generic/929 | 90 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/929.out | 17 +++++++++ tests/generic/group | 1 + 3 files changed, 108 insertions(+) create mode 100755 tests/generic/929 create mode 100644 tests/generic/929.out
tests/generic/929 new file +90 -0
@@ -0,0 +1,90 @@ +#! /bin/bash +# FS QA Test No. 929 +# +# Check that bmap/fiemap accurately report shared extents. +# +#----------------------------------------------------------------------- +# Copyright (c) 2016 Oracle, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 7 15 + +_cleanup() +{ + cd / + rm -rf $tmp.* + wait +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/reflink + +# real QA test starts here +_supported_os Linux +_supported_fs generic +_require_scratch_reflink +_require_fiemap + +echo "Format and mount" +_scratch_mkfs > $seqres.full 2>&1 +_scratch_mount >> $seqres.full 2>&1 + +testdir=$SCRATCH_MNT/test-$seq +mkdir $testdir + +blocks=5 +blksz=65536 +sz=$((blocks * blksz)) + +echo "Create the original files" +$XFS_IO_PROG -f -c "falloc 0 $sz" $testdir/file1 >> $seqres.full +_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full +_scratch_cycle_mount + +echo "file1 extents and holes" +_count_extents $testdir/file1 +_count_holes $testdir/file1 + +_reflink_range $testdir/file1 $blksz $testdir/file2 $((blksz * 3)) $blksz >> $seqres.full +_reflink_range $testdir/file1 $((blksz * 3)) $testdir/file2 $blksz $blksz >> $seqres.full +_scratch_cycle_mount + +echo "Compare files" +md5sum $testdir/file1 | _filter_scratch +md5sum $testdir/file2 | _filter_scratch + +echo "file1 extents and holes" +_count_extents $testdir/file1 +_count_holes $testdir/file1 +echo "file2 extents and holes" +_count_extents $testdir/file2 +_count_holes $testdir/file2 +echo "file1 shared extents" +$XFS_IO_PROG -c 'fiemap -v' $testdir/file1 | awk '{print $5}' | grep -c '0x.*[2367aAbBfF]...$' + +# success, all done +status=0 +exit
tests/generic/929.out new file +17 -0
@@ -0,0 +1,17 @@ +QA output created by 929 +Format and mount +Create the original files +file1 extents and holes +1 +0 +Compare files +17af09af790a9b4c79cddf72f6b642cb SCRATCH_MNT/test-929/file1 +79418df9c55ab7f58781cb7b9e7d5d91 SCRATCH_MNT/test-929/file2 +file1 extents and holes +5 +0 +file2 extents and holes +2 +2 +file1 shared extents +2
tests/generic/group +1 -0
@@ -375,3 +375,4 @@ 370 auto quick richacl 927 auto quick clone 928 auto quick clone dedupe +929 auto quick clone
Looks fine,