tools/mvtest: call out to the correct group sort program
PATCH 1/5 tools/mvtest: call out to the correct group sort program
mvtest should call the actual name of the sort-group program. Fix a cut-paste error in finding the destination group file.
--- tools/mvtest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/mvtest +2 -2
@@ -33,7 +33,7 @@ sgroup="$(basename "$(dirname "tests/${src}")")" dgroup="$(basename "$(dirname "tests/${dest}")")" sgroupfile="tests/${sgroup}/group" -dgroupfile="tests/${sgroup}/group" +dgroupfile="tests/${dgroup}/group" git mv "tests/${src}" "tests/${dest}" git mv "tests/${src}.out" "tests/${dest}.out"
@@ -47,7 +47,7 @@ newgrpline="$(echo "${grpline}" | sed -e "s/^${sid} /${did} /g")" sed -e "/^${sid}.*$/d" -i "${sgroupfile}" cp "${dgroupfile}" "${dgroupfile}.new" append "${dgroupfile}.new" "${newgrpline}" -"${dir}/sort-group.py" "${dgroupfile}.new" +"${dir}/sort-group" "${dgroupfile}.new" mv "${dgroupfile}.new" "${dgroupfile}" echo "Moved \"${src}\" to \"${dest}\"."
PATCH 2/5 reflink: fix off-by-one errors when iterating file blocks in a loop
When we're iterating file blocks in a loop (via seq), we have to end at $nr-1, not $nr.
--- tests/generic/183 | 2 +- tests/generic/185 | 2 +- tests/generic/186 | 2 +- tests/generic/187 | 2 +- tests/generic/194 | 2 +- tests/generic/195 | 2 +- tests/xfs/129 | 6 +++--- tests/xfs/140 | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)
tests/generic/183 +1 -1
@@ -69,7 +69,7 @@ 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 | while read f; do +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
tests/generic/185 +1 -1
@@ -69,7 +69,7 @@ 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 | while read f; do +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
tests/generic/186 +1 -1
@@ -112,7 +112,7 @@ 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 | while read f; do +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
tests/generic/187 +1 -1
@@ -112,7 +112,7 @@ 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 | while read f; do +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
tests/generic/194 +1 -1
@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "directio CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" done
tests/generic/195 +1 -1
@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" done
tests/xfs/129 +3 -3
@@ -65,9 +65,9 @@ NR_BLKS=$((4 * BLKSZ / 12)) _pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/file1" >> "$seqres.full" echo "Reflink every other block" -seq 1 $((NR_BLKS / 2)) | while read nr; do - _reflink_range "$TESTDIR/file1" $((nr * 2 * BLKSZ)) \ - "$TESTDIR/file2" $((nr * 2 * BLKSZ)) $BLKSZ >> "$seqres.full" +seq 1 2 $((NR_BLKS - 1)) | while read nr; do + _reflink_range "$TESTDIR/file1" $((nr * BLKSZ)) \ + "$TESTDIR/file2" $((nr * BLKSZ)) $BLKSZ >> "$seqres.full" done echo "Create metadump file"
tests/xfs/140 +1 -1
@@ -70,7 +70,7 @@ cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 do not match" cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match" echo "CoW every other block" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR - 1)) | while read f; do _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full" _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full" done
PATCH 3/5 xfs/122: update against xfsprogs 4.3
In reply to Darrick J. WongMake the xfsprogs sb layout and structure size checker work with modern xfsprogs (i.e. 4.3+ and all the new v5 stuff). The old test wasn't picking up structures because they're no longer defined in the "typedef struct xfs_foo { } xfs_foo_t;" style.
--- tests/xfs/122 | 29 +++++- tests/xfs/122.out | 265 +++++++++++++++++++++++++++++------------------------ 2 files changed, 166 insertions(+), 128 deletions(-)
tests/xfs/122 +23 -6
@@ -74,10 +74,22 @@ progout=$tmp.output cat >$cprog <<EOF #include <stdio.h> -#include <xfs/libxlog.h> EOF +for hdr in /usr/include/xfs/xfs*.h; do + echo "#include <$(echo "$hdr" | sed -e 's|/usr/include/||g')>" >> $cprog +done + +# missing: +# xfs_attr_shortform_t +# xfs_trans_header_t cat >$tmp.ignore <<EOF +xfs_buf_log_format_t +xfs_attr3_icleaf_hdr +xfs_da3_icnode_hdr +xfs_dir3_icfree_hdr +xfs_dir3_icleaf_hdr +xfs_name xfs_alloctype_t xfs_buf_cancel_t xfs_bmbt_rec_32_t
@@ -177,11 +189,16 @@ echo 'int main(int argc, char *argv[]) {' >>$cprog # cat /usr/include/xfs/xfs*.h | indent |\ _attribute_filter |\ -tee $seqres.full |\ -egrep '} *xfs_.*_t' |\ +egrep '(} *xfs_.*_t|^struct xfs_[a-z0-9_]*$)' > /tmp/barf + +cat /usr/include/xfs/xfs*.h | indent |\ +_attribute_filter |\ +egrep '(} *xfs_.*_t|^struct xfs_[a-z0-9_]*$)' |\ egrep -v -f $tmp.ignore |\ -awk '{sub(/[;,]/,"",$2); print "printf(\"sizeof(", $2, ") = %d\\n\", sizeof(", $2, "));"}' \ ->>$cprog +sed -e 's/^.*}[[:space:]]*//g' -e 's/;.*$//g' -e 's/_t, /_t\n/g' |\ +sort | uniq |\ +awk '{printf("printf(\"sizeof(%s) = \\%zu\\n\", sizeof(%s));\n", $0, $0);}' |\ +cat >> $cprog # # Look at offsets of key ones which differ in lengths
@@ -192,7 +209,7 @@ cat /usr/include/xfs/xfs*.h | indent |\ awk ' /typedef struct xfs_sb/ { structon = 1; next } structon && $2 ~ /^sb_/ { sub(/[;,]/,"",$2) - print "printf(\"offsetof(xfs_sb_t,", $2, ") = %d\\n\", offsetof(xfs_sb_t,", $2, "));"; next} + printf("printf(\"offsetof(xfs_sb_t, %s) = \\%zu\\n\", offsetof(xfs_sb_t, %s));", $2, $2); next} structon && /}/ { structon = 0; next} '>>$cprog
tests/xfs/122.out +143 -122
266 lines not on this page · raw message
PATCH 4/5 dedupe: record dedupe errors in golden output
In reply to Darrick J. WongThe xfs_io dedupe command originally didn't print dedupe errors to stderr like you'd expect. Since that was fixed, the golden output should be changed to reflect that.
--- tests/generic/122.out | 1 + tests/generic/136 | 2 ++ tests/generic/136.out | 3 +++ tests/generic/137 | 2 +- tests/generic/182.out | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-)
tests/generic/122.out +1 -0
@@ -4,6 +4,7 @@ Create the original files 5e3501f97fd2669babfcbd3e1972e833 TEST_DIR/test-122/file2 Files 1-2 do not match (intentional) (Fail to) dedupe the middle blocks together +dedupe: Extents did not match. Compare sections 35ac8d7917305c385c30f3d82c30a8f6 TEST_DIR/test-122/file1 5e3501f97fd2669babfcbd3e1972e833 TEST_DIR/test-122/file2
tests/generic/136 +2 -0
@@ -82,7 +82,9 @@ test "${C2}" != "${C4}" || echo "file2 and file4 should not match" test "${C3}" = "${C4}" || echo "file3 and file4 should match" echo "Dedupe the last blocks together" +echo "1->2" _dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file2" $BLKSZ 37 >> "$seqres.full" +echo "1->3" _dedupe_range "$TESTDIR/file1" $BLKSZ "$TESTDIR/file3" $BLKSZ 37 >> "$seqres.full" _test_remount
tests/generic/136.out +3 -0
@@ -5,6 +5,9 @@ c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file2 07ac67bf7f271195442509e79cde4cee TEST_DIR/test-136/file3 07ac67bf7f271195442509e79cde4cee TEST_DIR/test-136/file4 Dedupe the last blocks together +1->2 +1->3 +dedupe: Extents did not match. c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file1 c4fd505be25a0c91bcca9f502b9a8156 TEST_DIR/test-136/file2 07ac67bf7f271195442509e79cde4cee TEST_DIR/test-136/file3
tests/generic/137 +1 -1
@@ -83,7 +83,7 @@ done echo "Dedupe block two to the sevens" seq 1 $((NR_BLKS / 7)) | while read nr; do _dedupe_range "$TESTDIR/file1" $((BLKSZ * 2)) "$TESTDIR/file1" \ - $((nr * 7 * BLKSZ)) $BLKSZ >> "$seqres.full" + $((nr * 7 * BLKSZ)) $BLKSZ >> "$seqres.full" 2>&1 done _test_remount
tests/generic/182.out +2 -0
@@ -1,10 +1,12 @@ QA output created by 182 Create the original files +dedupe: Extents did not match. f4820540fc0ac02750739896fe028d56 TEST_DIR/test-182/file1 69ad53078a16243d98e21d9f8704a071 TEST_DIR/test-182/file2 69ad53078a16243d98e21d9f8704a071 TEST_DIR/test-182/file2.chk Compare against check files Make the original file almost dedup-able +dedupe: Extents did not match. f4820540fc0ac02750739896fe028d56 TEST_DIR/test-182/file1 158d4e3578b94b89cbb44493a2110fb9 TEST_DIR/test-182/file2 158d4e3578b94b89cbb44493a2110fb9 TEST_DIR/test-182/file2.chk
PATCH 5/5 tests: use lowercase variables for all the new reflink tests
In reply to Darrick J. WongSince $TESTDIR is a local variable, make it lowercase to avoid confusion with $TEST_DIR. While we're at it, make all the local variables lowercase.
--- tests/generic/110 | 24 ++++----- tests/generic/111 | 42 ++++++++------- tests/generic/115 | 34 ++++++------ tests/generic/116 | 42 ++++++++------- tests/generic/118 | 42 ++++++++------- tests/generic/119 | 112 ++++++++++++++++++++--------------------- tests/generic/121 | 42 ++++++++------- tests/generic/122 | 42 ++++++++------- tests/generic/134 | 90 ++++++++++++++++----------------- tests/generic/136 | 90 ++++++++++++++++----------------- tests/generic/137 | 54 ++++++++++---------- tests/generic/138 | 100 ++++++++++++++++++------------------ tests/generic/139 | 100 ++++++++++++++++++------------------ tests/generic/140 | 100 ++++++++++++++++++------------------ tests/generic/142 | 34 ++++++------ tests/generic/143 | 34 ++++++------ tests/generic/144 | 124 +++++++++++++++++++++++---------------------- tests/generic/145 | 146 +++++++++++++++++++++++++++-------------------------- tests/generic/146 | 136 +++++++++++++++++++++++++------------------------ tests/generic/147 | 142 ++++++++++++++++++++++++++-------------------------- tests/generic/148 | 80 +++++++++++++++-------------- tests/generic/149 | 136 +++++++++++++++++++++++++------------------------ tests/generic/150 | 30 +++++------ tests/generic/151 | 46 ++++++++--------- tests/generic/152 | 52 +++++++++---------- tests/generic/153 | 52 +++++++++---------- tests/generic/154 | 60 +++++++++++----------- tests/generic/155 | 60 +++++++++++----------- tests/generic/156 | 58 +++++++++++---------- tests/generic/157 | 68 ++++++++++++------------- tests/generic/158 | 70 +++++++++++++------------ tests/generic/159 | 30 +++++------ tests/generic/160 | 30 +++++------ tests/generic/161 | 16 +++--- tests/generic/162 | 22 ++++---- tests/generic/163 | 22 ++++---- tests/generic/164 | 28 +++++----- tests/generic/165 | 28 +++++----- tests/generic/166 | 18 +++---- tests/generic/167 | 18 +++---- tests/generic/168 | 22 ++++---- tests/generic/170 | 22 ++++---- tests/generic/171 | 42 ++++++++------- tests/generic/172 | 42 ++++++++------- tests/generic/173 | 42 ++++++++------- tests/generic/174 | 42 ++++++++------- tests/generic/175 | 24 ++++----- tests/generic/176 | 24 ++++----- tests/generic/178 | 28 +++++----- tests/generic/179 | 46 ++++++++--------- tests/generic/180 | 46 ++++++++--------- tests/generic/181 | 34 ++++++------ tests/generic/182 | 76 ++++++++++++++-------------- tests/generic/183 | 48 +++++++++-------- tests/generic/185 | 48 +++++++++-------- tests/generic/186 | 54 ++++++++++---------- tests/generic/187 | 54 ++++++++++---------- tests/generic/188 | 40 +++++++-------- tests/generic/189 | 40 +++++++-------- tests/generic/190 | 40 +++++++-------- tests/generic/191 | 40 +++++++-------- tests/generic/194 | 46 ++++++++--------- tests/generic/195 | 46 ++++++++--------- tests/generic/196 | 40 +++++++-------- tests/generic/197 | 40 +++++++-------- tests/generic/199 | 60 +++++++++++----------- tests/generic/200 | 60 +++++++++++----------- tests/generic/201 | 34 ++++++------ tests/generic/202 | 32 ++++++------ tests/generic/203 | 32 ++++++------ tests/generic/205 | 48 +++++++++-------- tests/generic/206 | 48 +++++++++-------- tests/generic/216 | 48 +++++++++-------- tests/generic/217 | 48 +++++++++-------- tests/generic/218 | 40 +++++++-------- tests/generic/220 | 40 +++++++-------- tests/generic/222 | 48 +++++++++-------- tests/generic/227 | 48 +++++++++-------- tests/generic/229 | 94 +++++++++++++++++----------------- tests/generic/238 | 94 +++++++++++++++++----------------- tests/generic/242 | 46 ++++++++--------- tests/generic/243 | 46 ++++++++--------- tests/xfs/127 | 16 +++--- tests/xfs/128 | 140 +++++++++++++++++++++++++-------------------------- tests/xfs/129 | 28 +++++----- tests/xfs/131 | 16 +++--- tests/xfs/132 | 68 ++++++++++++------------- tests/xfs/139 | 26 +++++---- tests/xfs/140 | 34 ++++++------ 89 files changed, 2337 insertions(+), 2337 deletions(-)
tests/generic/110 +12 -12
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - rm -f $tmp.* "$TESTDIR" + rm -f $tmp.* "$testdir" } # get standard environment, filters and checks
@@ -53,37 +53,37 @@ _require_xfs_io_command "fiemap" _require_cp_reflink _require_test -TESTDIR1=$TEST_DIR/test-$seq -rm -rf $TESTDIR1 -mkdir $TESTDIR1 +testdir1=$TEST_DIR/test-$seq +rm -rf $testdir1 +mkdir $testdir1 _checksum_files() { for F in original copy1 copy2 do - md5sum $TESTDIR1/$F | _filter_test_dir + md5sum $testdir1/$F | _filter_test_dir done } rm -f $seqres.full echo "Create the original file and reflink to copy1, copy2" -$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \ +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \ >> $seqres.full 2>&1 -cp --reflink $TESTDIR1/original $TESTDIR1/copy1 -cp --reflink $TESTDIR1/copy1 $TESTDIR1/copy2 -_verify_reflink $TESTDIR1/original $TESTDIR1/copy1 -_verify_reflink $TESTDIR1/original $TESTDIR1/copy2 +cp --reflink $testdir1/original $testdir1/copy1 +cp --reflink $testdir1/copy1 $testdir1/copy2 +_verify_reflink $testdir1/original $testdir1/copy1 +_verify_reflink $testdir1/original $testdir1/copy2 echo "Original md5sums:" _checksum_files echo "Overwrite original file with new data" -$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $TESTDIR1/original \ +$XFS_IO_PROG -c 'pwrite -S 0x62 0 9000' $testdir1/original \ >> $seqres.full 2>&1 echo "md5sums after overwriting original:" _checksum_files echo "Overwrite copy1 with different new data" -$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $TESTDIR1/copy1 \ +$XFS_IO_PROG -c 'pwrite -S 0x63 0 9000' $testdir1/copy1 \ >> $seqres.full 2>&1 echo "md5sums after overwriting copy1:" _checksum_files
tests/generic/111 +21 -21
83 lines not on this page · raw message
tests/generic/115 +17 -17
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - rm -f $tmp.* "$TESTDIR" + rm -f $tmp.* "$testdir" } # get standard environment, filters and checks
@@ -53,31 +53,31 @@ _require_test rm -f $seqres.full -TESTDIR1=$TEST_DIR/test-$seq -rm -rf $TESTDIR1 -mkdir $TESTDIR1 +testdir1=$TEST_DIR/test-$seq +rm -rf $testdir1 +mkdir $testdir1 echo "Create the original files and reflink dirs" -$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/original \ +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $testdir1/original \ >> $seqres.full -cp --reflink $TESTDIR1/original $TESTDIR1/copy +cp --reflink $testdir1/original $testdir1/copy -_verify_reflink $TESTDIR1/original $TESTDIR1/copy +_verify_reflink $testdir1/original $testdir1/copy echo "Move orig & reflink copy to subdir and md5sum:" -mkdir $TESTDIR1/subdir -mv $TESTDIR1/original $TESTDIR1/subdir/original_moved -mv $TESTDIR1/copy $TESTDIR1/subdir/copy_moved -_verify_reflink $TESTDIR1/subdir/original_moved \ - $TESTDIR1/subdir/copy_moved +mkdir $testdir1/subdir +mv $testdir1/original $testdir1/subdir/original_moved +mv $testdir1/copy $testdir1/subdir/copy_moved +_verify_reflink $testdir1/subdir/original_moved \ + $testdir1/subdir/copy_moved -md5sum $TESTDIR1/subdir/original_moved | _filter_test_dir -md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir +md5sum $testdir1/subdir/original_moved | _filter_test_dir +md5sum $testdir1/subdir/copy_moved | _filter_test_dir echo "remove orig from subdir and md5sum reflink copy:" -rm $TESTDIR1/subdir/original_moved -md5sum $TESTDIR1/subdir/copy_moved | _filter_test_dir -rm -rf $TESTDIR1/subdir +rm $testdir1/subdir/original_moved +md5sum $testdir1/subdir/copy_moved | _filter_test_dir +rm -rf $testdir1/subdir # success, all done status=0
tests/generic/116 +21 -21
71 lines not on this page · raw message
tests/generic/118 +21 -21
71 lines not on this page · raw message
tests/generic/119 +56 -56
182 lines not on this page · raw message
tests/generic/121 +21 -21
71 lines not on this page · raw message
tests/generic/122 +21 -21
71 lines not on this page · raw message
tests/generic/134 +45 -45
127 lines not on this page · raw message
tests/generic/136 +45 -45
129 lines not on this page · raw message
tests/generic/137 +27 -27
107 lines not on this page · raw message
tests/generic/138 +50 -50
158 lines not on this page · raw message
tests/generic/139 +50 -50
157 lines not on this page · raw message
tests/generic/140 +50 -50
158 lines not on this page · raw message
tests/generic/142 +17 -17
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - rm -rf "$tmp".* "$TESTDIR" + rm -rf "$tmp".* "$testdir" } # get standard environment, filters and checks
@@ -52,37 +52,37 @@ _require_cp_reflink rm -f "$seqres.full" -TESTDIR="$TEST_DIR/test-$seq" -rm -rf "$TESTDIR" -mkdir "$TESTDIR" +testdir="$TEST_DIR/test-$seq" +rm -rf "$testdir" +mkdir "$testdir" echo "Create the original file blocks" -BLKSZ=65536 -NR=9 -_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full" +blksz=65536 +nr=9 +_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full" _test_remount -md5sum "$TESTDIR/file1" | _filter_test_dir -csum="$(_md5_checksum "$TESTDIR/file1")" +md5sum "$testdir/file1" | _filter_test_dir +csum="$(_md5_checksum "$testdir/file1")" echo "Create the reflink copies" -seq 2 $NR | while read i; do - _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i" +seq 2 $nr | while read i; do + _cp_reflink "$testdir/file1" "$testdir/file$i" done _test_remount echo "Rewrite the copies" -seq 2 $NR | while read i; do - _pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file$i" >> "$seqres.full" +seq 2 $nr | while read i; do + _pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" >> "$seqres.full" done _test_remount echo "Examine original file" -md5sum "$TESTDIR/file1" | _filter_test_dir -md5sum "$TESTDIR/file2" | _filter_test_dir +md5sum "$testdir/file1" | _filter_test_dir +md5sum "$testdir/file2" | _filter_test_dir -mod_csum="$(_md5_checksum "$TESTDIR/file2")" -new_csum="$(_md5_checksum "$TESTDIR/file1")" +mod_csum="$(_md5_checksum "$testdir/file2")" +new_csum="$(_md5_checksum "$testdir/file1")" test "${csum}" != "${mod_csum}" || echo "checksums do not match" test "${csum}" = "${new_csum}" || echo "checksums do not match"
tests/generic/143 +17 -17
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - rm -rf "$tmp".* "$TESTDIR" + rm -rf "$tmp".* "$testdir" } # get standard environment, filters and checks
@@ -52,37 +52,37 @@ _require_cp_reflink rm -f "$seqres.full" -TESTDIR="$TEST_DIR/test-$seq" -rm -rf "$TESTDIR" -mkdir "$TESTDIR" +testdir="$TEST_DIR/test-$seq" +rm -rf "$testdir" +mkdir "$testdir" echo "Create the original file blocks" -BLKSZ=65536 -NR=9 -_pwrite_byte 0x61 0 $((BLKSZ * 256)) "$TESTDIR/file1" >> "$seqres.full" +blksz=65536 +nr=9 +_pwrite_byte 0x61 0 $((blksz * 256)) "$testdir/file1" >> "$seqres.full" _test_remount -md5sum "$TESTDIR/file1" | _filter_test_dir -csum="$(_md5_checksum "$TESTDIR/file1")" +md5sum "$testdir/file1" | _filter_test_dir +csum="$(_md5_checksum "$testdir/file1")" echo "Create the reflink copies" -seq 2 $NR | while read i; do - _cp_reflink "$TESTDIR/file1" "$TESTDIR/file$i" +seq 2 $nr | while read i; do + _cp_reflink "$testdir/file1" "$testdir/file$i" done _test_remount echo "Rewrite the copies" -seq 2 $NR | while read i; do - _pwrite_byte 0x62 0 $((BLKSZ * 256)) "$TESTDIR/file$i" -d >> "$seqres.full" +seq 2 $nr | while read i; do + _pwrite_byte 0x62 0 $((blksz * 256)) "$testdir/file$i" -d >> "$seqres.full" done _test_remount echo "Examine original file" -md5sum "$TESTDIR/file1" | _filter_test_dir -md5sum "$TESTDIR/file2" | _filter_test_dir +md5sum "$testdir/file1" | _filter_test_dir +md5sum "$testdir/file2" | _filter_test_dir -mod_csum="$(_md5_checksum "$TESTDIR/file2")" -new_csum="$(_md5_checksum "$TESTDIR/file1")" +mod_csum="$(_md5_checksum "$testdir/file2")" +new_csum="$(_md5_checksum "$testdir/file1")" test "${csum}" != "${mod_csum}" || echo "checksums do not match" test "${csum}" = "${new_csum}" || echo "checksums do not match"
tests/generic/144 +62 -62
159 lines not on this page · raw message
tests/generic/145 +73 -73
169 lines not on this page · raw message
tests/generic/146 +68 -68
159 lines not on this page · raw message
tests/generic/147 +71 -71
165 lines not on this page · raw message
tests/generic/148 +40 -40
110 lines not on this page · raw message
tests/generic/149 +68 -68
159 lines not on this page · raw message
tests/generic/150 +15 -15
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / - rm -rf "$tmp".* "$TESTDIR" + rm -rf "$tmp".* "$testdir" } # get standard environment, filters and checks
@@ -50,28 +50,28 @@ _require_cp_reflink rm -f "$seqres.full" -TESTDIR="$TEST_DIR/test-$seq" -rm -rf "$TESTDIR" -mkdir "$TESTDIR" +testdir="$TEST_DIR/test-$seq" +rm -rf "$testdir" +mkdir "$testdir" echo "Create the original file blocks" -BLKSZ="$(stat -f $TESTDIR -c '%S')" -BLKS=2000 -MARGIN=100 -SZ=$((BLKSZ * BLKS)) -NR=7 -_pwrite_byte 0x61 0 $SZ "$TESTDIR/file1" >> "$seqres.full" +blksz="$(stat -f $testdir -c '%S')" +blks=2000 +margin=100 +sz=$((blksz * blks)) +nr=7 +_pwrite_byte 0x61 0 $sz "$testdir/file1" >> "$seqres.full" sync -FREE_BLOCKS0=$(stat -f "$TESTDIR" -c '%f') +free_blocks0=$(stat -f "$testdir" -c '%f') echo "Create the reflink copies" -for i in `seq 2 $NR`; do - _cp_reflink "$TESTDIR/file1" "$TESTDIR/file.$i" +for i in `seq 2 $nr`; do + _cp_reflink "$testdir/file1" "$testdir/file.$i" done _test_remount -FREE_BLOCKS1=$(stat -f "$TESTDIR" -c '%f') +free_blocks1=$(stat -f "$testdir" -c '%f') -_within_tolerance "free blocks after reflink" $FREE_BLOCKS1 $FREE_BLOCKS0 $MARGIN -v +_within_tolerance "free blocks after reflink" $free_blocks1 $free_blocks0 $margin -v # success, all done status=0
tests/generic/151 +23 -23
74 lines not on this page · raw message
tests/generic/152 +26 -26
81 lines not on this page · raw message
tests/generic/153 +26 -26
80 lines not on this page · raw message
tests/generic/154 +30 -30
93 lines not on this page · raw message
tests/generic/155 +30 -30
83 lines not on this page · raw message
tests/generic/156 +29 -29
58 lines not on this page · raw message
tests/generic/157 +34 -34
68 lines not on this page · raw message
tests/generic/158 +35 -35
70 lines not on this page · raw message
tests/generic/171 +21 -21
42 lines not on this page · raw message
tests/generic/172 +21 -21
42 lines not on this page · raw message
tests/generic/173 +21 -21
42 lines not on this page · raw message
tests/generic/174 +21 -21
42 lines not on this page · raw message
tests/generic/179 +23 -23
46 lines not on this page · raw message
tests/generic/180 +23 -23
46 lines not on this page · raw message
tests/generic/182 +38 -38
76 lines not on this page · raw message
tests/generic/183 +24 -24
48 lines not on this page · raw message
tests/generic/185 +24 -24
48 lines not on this page · raw message
tests/generic/186 +27 -27
54 lines not on this page · raw message
tests/generic/187 +27 -27
54 lines not on this page · raw message
tests/generic/194 +23 -23
46 lines not on this page · raw message
tests/generic/195 +23 -23
46 lines not on this page · raw message
tests/generic/199 +30 -30
60 lines not on this page · raw message
tests/generic/200 +30 -30
60 lines not on this page · raw message
tests/generic/205 +24 -24
48 lines not on this page · raw message
tests/generic/206 +24 -24
48 lines not on this page · raw message
tests/generic/216 +24 -24
48 lines not on this page · raw message
tests/generic/217 +24 -24
48 lines not on this page · raw message
tests/generic/222 +24 -24
48 lines not on this page · raw message
tests/generic/227 +24 -24
48 lines not on this page · raw message
tests/generic/229 +47 -47
94 lines not on this page · raw message
tests/generic/238 +47 -47
94 lines not on this page · raw message
tests/generic/242 +23 -23
46 lines not on this page · raw message
tests/generic/243 +23 -23
46 lines not on this page · raw message
tests/xfs/128 +70 -70
140 lines not on this page · raw message
tests/xfs/132 +34 -34
68 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
Re: [PATCH 2/5] reflink: fix off-by-one errors when iterating file blocks in a loop
In reply to Darrick J. WongQuoted 21 lines · Darrick J. Wong
When we're iterating file blocks in a loop (via seq), we have to end at $nr-1, not $nr.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/generic/183 | 2 +- tests/generic/185 | 2 +- tests/generic/186 | 2 +- tests/generic/187 | 2 +- tests/generic/194 | 2 +- tests/generic/195 | 2 +- tests/xfs/129 | 6 +++--- tests/xfs/140 | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)tests/generic/183 +0
-0
tests/generic/183 seq 0 2 $((NR-1)) | while read f; do · line 72
Quoted 5 lines
tests/generic/183 +1
-1@@ -69,7 +69,7 @@ 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 | while read f; do +seq 1 2 $((NR-1)) | while read f; do
Just curious (and no bike shedding intended), why not make the loop in a much more simple and common way such as:
for ((i = 1; i < $NR; i += 2)); do
...
done
or for i in seq 1 2 $((NR - 1)); do .... done
Quoted 103 lines
tests/generic/183 +0
-0_reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/generic/185 +1
-1@@ -69,7 +69,7 @@ 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 | while read f; do +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" donetests/generic/186 +1
-1@@ -112,7 +112,7 @@ 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 | while read f; do +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" donetests/generic/187 +1
-1@@ -112,7 +112,7 @@ 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 | while read f; do +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" donetests/generic/194 +1
-1@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "directio CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/generic/195 +1
-1@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/xfs/129 +3
-3@@ -65,9 +65,9 @@ NR_BLKS=$((4 * BLKSZ / 12)) _pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/file1" >> "$seqres.full" echo "Reflink every other block" -seq 1 $((NR_BLKS / 2)) | while read nr; do - _reflink_range "$TESTDIR/file1" $((nr * 2 * BLKSZ)) \ - "$TESTDIR/file2" $((nr * 2 * BLKSZ)) $BLKSZ >> "$seqres.full" +seq 1 2 $((NR_BLKS - 1)) | while read nr; do + _reflink_range "$TESTDIR/file1" $((nr * BLKSZ)) \ + "$TESTDIR/file2" $((nr * BLKSZ)) $BLKSZ >> "$seqres.full" done echo "Create metadump file"tests/xfs/140 +1
-2@@ -70,7 +70,7 @@ cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 do not match" cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match" echo "CoW every other block" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR - 1)) | while read f; do _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full" _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full" done --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
Signature · 5 lines
Filipe David Manana, "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."
Re: [PATCH 2/5] reflink: fix off-by-one errors when iterating file blocks in a loop
Quoted 32 lines · Filipe Manana
Quoted 21 lines · Darrick J. Wong
When we're iterating file blocks in a loop (via seq), we have to end at $nr-1, not $nr.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/generic/183 | 2 +- tests/generic/185 | 2 +- tests/generic/186 | 2 +- tests/generic/187 | 2 +- tests/generic/194 | 2 +- tests/generic/195 | 2 +- tests/xfs/129 | 6 +++--- tests/xfs/140 | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)tests/generic/183 +0
-0tests/generic/183 seq 0 2 $((NR-1)) | while read f; do · line 72
Quoted 5 lines
tests/generic/183 +1
-1@@ -69,7 +69,7 @@ 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 | while read f; do +seq 1 2 $((NR-1)) | while read f; doJust curious (and no bike shedding intended), why not make the loop in a much more simple and common way such as:
Quoted 3 lines
for ((i = 1; i < $NR; i += 2)); do
...
done
Not that it matters here, but that's a bashism, isn't it?
Quoted 1 line
or for i in
seq 1 2 $((NR - 1)); do .... done
<shrug> No particular reason. :)
I suppose if NR is large then "seq | while read" avoids spraying a large number of arguments into the command interpreter, though that clearly isn't the case here.
--D
Quoted 102 lines
Quoted 102 lines
tests/generic/183 +0
-0_reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/generic/185 +1
-1@@ -69,7 +69,7 @@ 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 | while read f; do +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" donetests/generic/186 +1
-1@@ -112,7 +112,7 @@ 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 | while read f; do +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" donetests/generic/187 +1
-1@@ -112,7 +112,7 @@ 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 | while read f; do +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" donetests/generic/194 +1
-1@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "directio CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/generic/195 +1
-1@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/xfs/129 +3
-3@@ -65,9 +65,9 @@ NR_BLKS=$((4 * BLKSZ / 12)) _pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/file1" >> "$seqres.full" echo "Reflink every other block" -seq 1 $((NR_BLKS / 2)) | while read nr; do - _reflink_range "$TESTDIR/file1" $((nr * 2 * BLKSZ)) \ - "$TESTDIR/file2" $((nr * 2 * BLKSZ)) $BLKSZ >> "$seqres.full" +seq 1 2 $((NR_BLKS - 1)) | while read nr; do + _reflink_range "$TESTDIR/file1" $((nr * BLKSZ)) \ + "$TESTDIR/file2" $((nr * BLKSZ)) $BLKSZ >> "$seqres.full" done echo "Create metadump file"tests/xfs/140 +1
-1@@ -70,7 +70,7 @@ cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 do not match" cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match" echo "CoW every other block" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR - 1)) | while read f; do _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full" _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full" done
Quoted 13 lines
Quoted 4 lines
--
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.htmlSignature · 5 lines
Filipe David Manana, "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/5] reflink: fix off-by-one errors when iterating file blocks in a loop
Quoted 33 lines · Darrick J. Wong
Quoted 32 lines · Filipe Manana
Quoted 21 lines · Darrick J. Wong
When we're iterating file blocks in a loop (via seq), we have to end at $nr-1, not $nr.
Signed-off-by Darrick J. Wong <[email protected]>--- tests/generic/183 | 2 +- tests/generic/185 | 2 +- tests/generic/186 | 2 +- tests/generic/187 | 2 +- tests/generic/194 | 2 +- tests/generic/195 | 2 +- tests/xfs/129 | 6 +++--- tests/xfs/140 | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)tests/generic/183 +0
-0tests/generic/183 seq 0 2 $((NR-1)) | while read f; do · line 72
Quoted 5 lines
tests/generic/183 +1
-1@@ -69,7 +69,7 @@ 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 | while read f; do +seq 1 2 $((NR-1)) | while read f; doJust curious (and no bike shedding intended), why not make the loop in a much more simple and common way such as:
Quoted 5 lines
Quoted 3 lines
for ((i = 1; i < $NR; i += 2)); do
...
doneNot that it matters here, but that's a bashism, isn't it?
Yep, but all tests and scripts (./check, common/rc, etc) start with a shebang referring to bash.
Quoted 8 lines
Quoted 2 lines
or for i in
seq 1 2 $((NR - 1)); do .... done<shrug> No particular reason. :)
I suppose if NR is large then "seq | while read" avoids spraying a large number of arguments into the command interpreter, though that clearly isn't the case here.
Right.
Thanks.
Quoted 118 lines
--D
Quoted 115 lines
Quoted 103 lines
tests/generic/183 +0
-0_reflink_range "$TESTDIR/file2" $((BLKSZ * f)) "$TESTDIR/file3" $((BLKSZ * f)) $BLKSZ >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/generic/185 +1
-1@@ -69,7 +69,7 @@ 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 | while read f; do +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" donetests/generic/186 +1
-1@@ -112,7 +112,7 @@ 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 | while read f; do +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" donetests/generic/187 +1
-1@@ -112,7 +112,7 @@ 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 | while read f; do +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" donetests/generic/194 +1
-1@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "directio CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/generic/195 +1
-1@@ -79,7 +79,7 @@ md5sum "$TESTDIR/file3" | _filter_scratch md5sum "$TESTDIR/file3.chk" | _filter_scratch echo "CoW across the transition" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR-1)) | while read f; do _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3" >> "$seqres.full" _pwrite_byte 0x62 $((BLKSZ * f)) $BLKSZ "$TESTDIR/file3.chk" >> "$seqres.full" donetests/xfs/129 +3
-3@@ -65,9 +65,9 @@ NR_BLKS=$((4 * BLKSZ / 12)) _pwrite_byte 0x61 0 $((BLKSZ * NR_BLKS)) "$TESTDIR/file1" >> "$seqres.full" echo "Reflink every other block" -seq 1 $((NR_BLKS / 2)) | while read nr; do - _reflink_range "$TESTDIR/file1" $((nr * 2 * BLKSZ)) \ - "$TESTDIR/file2" $((nr * 2 * BLKSZ)) $BLKSZ >> "$seqres.full" +seq 1 2 $((NR_BLKS - 1)) | while read nr; do + _reflink_range "$TESTDIR/file1" $((nr * BLKSZ)) \ + "$TESTDIR/file2" $((nr * BLKSZ)) $BLKSZ >> "$seqres.full" done echo "Create metadump file"tests/xfs/140 +1
-2@@ -70,7 +70,7 @@ cmp -s "$TESTDIR/file1" "$TESTDIR/file2" || echo "file1 and file2 do not match" cmp -s "$TESTDIR/file2" "$TESTDIR/file2.chk" || echo "file2 and file2.chk do not match" echo "CoW every other block" -seq 1 2 $NR | while read f; do +seq 1 2 $((NR - 1)) | while read f; do _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2" >> "$seqres.full" _pwrite_byte 0x62 $((f * BLKSZ)) $BLKSZ "$TESTDIR/file2.chk" >> "$seqres.full" done --Quoted 3 lines
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--
Filipe David Manana,"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."
Signature · 5 lines
Filipe David Manana, "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."