Skip to contentSkip to conversation

fstests: generic/353 should accomodate other pwrite behaviors

PATCH In review Bill O'Donnell 3 participants 9 messages Sep 1, 2023 – Oct 24, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fstests: generic/353 should accomodate other pwrite behaviors

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
#1 lore raw

cc [email protected]

Quoted 91 lines · Bill O'Donnell

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
#2 lore raw
In reply to Bill O'Donnell

Gentle ping.

Quoted 91 lines · Bill O'Donnell

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
#3 lore raw
In reply to Bill O'Donnell

widen cc-list

Quoted 91 lines · Bill O'Donnell

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
#4 lore raw
In reply to Bill O'Donnell
Quoted 11 lines · Bill O'Donnell

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---

This patch makes sense to me, but this case looks like a regression test test for a known btrfs issue. But this test case doesn't point out which bug/fix does it test for. So I don't know if the 64k blocksize is a necessary condition to reproduce the bug.

If we can prove it still can reproduce that bug with this patch at least, then it's good to me to merge it.

Thanks,
Zorro

Quoted 80 lines
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
#5 lore raw
Quoted 13 lines · Zorro Lang
Quoted 11 lines · Bill O'Donnell

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---

Quoted 7 lines

This patch makes sense to me, but this case looks like a regression test test for a known btrfs issue. But this test case doesn't point out which bug/fix does it test for. So I don't know if the 64k blocksize is a necessary condition to reproduce the bug.

If we can prove it still can reproduce that bug with this patch at least, then it's good to me to merge it.

I'd like Qu to weigh in on this from the btrfs standpoint.

Thanks-
Bill

Quoted 85 lines

Thanks,
Zorro

Quoted 80 lines
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
#6 lore raw

ping?

Quoted 113 lines · Bill O'Donnell
Quoted 13 lines · Zorro Lang
Quoted 11 lines · Bill O'Donnell

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---

Quoted 7 lines

This patch makes sense to me, but this case looks like a regression test test for a known btrfs issue. But this test case doesn't point out which bug/fix does it test for. So I don't know if the 64k blocksize is a necessary condition to reproduce the bug.

If we can prove it still can reproduce that bug with this patch at least, then it's good to me to merge it.

I'd like Qu to weigh in on this from the btrfs standpoint.

Thanks-
Bill

Quoted 85 lines

Thanks,
Zorro

Quoted 80 lines
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
#7 lore raw
Quoted 1 line · Bill O'Donnell

ping?

Hi Bill,

Quoted 21 lines · Bill O'Donnell
Quoted 19 lines · Zorro Lang
Quoted 18 lines · Bill O'Donnell
Quoted 11 lines

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---

This patch makes sense to me, but this case looks like a regression test test for a known btrfs issue. But this test case doesn't point out which bug/fix does it test for. So I don't know if the 64k blocksize is a necessary condition to reproduce the bug.

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

If we can prove it still can reproduce that bug with this patch at least, then it's good to me to merge it.

I'd like Qu to weigh in on this from the btrfs standpoint.

If there's still not any review points from Qu or other btrfs devels, I'll merge this patch in next release. Better to make sure if the 64k (multi-blocks) is a necessary condition for this case. What's the bug fix this case trying to cover?

Thanks,
Zorro

Quoted 91 lines
Quoted 90 lines

Thanks-
Bill

Quoted 85 lines

Thanks,
Zorro

Quoted 80 lines
 tests/generic/353     | 29 ++++++++++++++++-------------
 tests/generic/353.out | 15 +--------------
 2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
 file1="$SCRATCH_MNT/file1"
 file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
 # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
 # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
 # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
 # sync and recheck, to make sure the fiemap doesn't change just
 # due to sync
 sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
 # success, all done
 status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
 QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0
Reviewed-by
#8 lore raw
Quoted 30 lines · Zorro Lang
Quoted 1 line · Bill O'Donnell

ping?

Hi Bill,

Quoted 25 lines · Bill O'Donnell
Quoted 23 lines · Zorro Lang
Quoted 13 lines · Bill O'Donnell
Quoted 11 lines

xfs_io pwrite issues a series of block size writes, but there is no guarantee that the resulting extent(s) will be singular or contiguous. This behavior is acceptable, but the test is flawed in that it expects a single extent for a pwrite.

Modify test to use actual blocksize for pwrite and reflink. Also modify it to accommodate pwrite and reflink that produce different mapping results.

---

Quoted 7 lines

This patch makes sense to me, but this case looks like a regression test test for a known btrfs issue. But this test case doesn't point out which bug/fix does it test for. So I don't know if the 64k blocksize is a necessary condition to reproduce the bug.

If we can prove it still can reproduce that bug with this patch at least, then it's good to me to merge it.

I'd like Qu to weigh in on this from the btrfs standpoint.

Weird, this is the first time this mail shows up in my suse.com mailbox, but not in my gmx one, maybe it's something wrong with my filter.

Anyway the patch looks good to me.

Quoted 8 lines

If there's still not any review points from Qu or other btrfs devels, I'll merge this patch in next release.

Better to make sure if the 64k (multi-blocks)
is a necessary condition for this case. What's the bug fix this case trying to cover?

64K is not a necessary condition, it's just here to allow all btrfs sector sizes (4K to 64K) to be covered.

In fact, 64K blocksize on a btrfs with 4K sectorsize can lead to false alerts, as there is no guarantee that 64K buffered write would lead to one single extent.

The initial bugfix is just a bug inside btrfs' SHARED flag detection code, and is completely blocksize unrelated.

So we're safe to change the IO blocksize to ensure the buffered writes only lead to a single extent.

Sorry for the late reply (and possibly bad filter setup)

Thanks,
Qu

Quoted 96 lines

Thanks,
Zorro

Quoted 91 lines
Quoted 90 lines

Thanks-
Bill

Quoted 85 lines

Thanks,
Zorro

Quoted 80 lines
  tests/generic/353     | 29 ++++++++++++++++-------------
  tests/generic/353.out | 15 +--------------
  2 files changed, 17 insertions(+), 27 deletions(-)
tests/generic/353 +16 -13
index 9a1471bd..c5639725 100755
@@ -29,31 +29,34 @@ _require_xfs_io_command "fiemap"
  _scratch_mkfs > /dev/null 2>&1
  _scratch_mount
 
-blocksize=64k
+blocksize=$(_get_file_block_size $SCRATCH_MNT)
+
  file1="$SCRATCH_MNT/file1"
  file2="$SCRATCH_MNT/file2"
+extmap1="$SCRATCH_MNT/extmap1"
+extmap2="$SCRATCH_MNT/extmap2"
 
  # write the initial file
-_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 | _filter_xfs_io
+_pwrite_byte 0xcdcdcdcd 0 $blocksize $file1 > /dev/null
 
  # reflink initial file
-_reflink_range $file1 0 $file2 0 $blocksize | _filter_xfs_io
+_reflink_range $file1 0 $file2 0 $blocksize > /dev/null
 
  # check their fiemap to make sure it's correct
-echo "before sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps before sync"
 
  # sync and recheck, to make sure the fiemap doesn't change just
  # due to sync
  sync
-echo "after sync:"
-echo "$file1" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags
-echo "$file2" | _filter_scratch
-$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags
+$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
+$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
+
+cmp -s $extmap1 $extmap2 || echo "mismatched extent maps after sync"
+
+echo "Silence is golden"
 
  # success, all done
  status=0
tests/generic/353.out +1 -14
index 4f6e0b92..16ba4f1f 100644
@@ -1,15 +1,2 @@
  QA output created by 353
-wrote 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-linked 65536/65536 bytes at offset 0
-XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-before sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
-after sync:
-SCRATCH_MNT/file1
-0: [0..127]: shared|last
-SCRATCH_MNT/file2
-0: [0..127]: shared|last
+Silence is golden
Signature · 1 line
2.41.0