[ $? -ne 0 ] && die_now
od -x $testfile | head -n -1
}
+
+_test_block_boundaries()
+{
+
+ remove_testfile=1
+ sync_cmd="-c fsync"
+ unwritten_tests=1
+ OPTIND=1
+ while getopts 'dk' OPTION
+ do
+ case $OPTION in
+ k) remove_testfile=
+ ;;
+ d) sync_cmd=
+ ;;
+ ?) echo Invalid flag
+ exit 1
+ ;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ bs=$1
+ zero_cmd=$2
+ filter_cmd=$3
+ testfile=$4
+
+ # Block size plus 1
+ bs_p1=$(($bs + 1))
+ # Block size plus 2
+ bs_p2=$(($bs + 2))
+
+ # Block size minus 1
+ bs_m1=$(($bs - 1))
+
+ # Block size multiplied by 2
+ bs_t2=$(($bs * 2))
+
+ # Block size divided by 2
+ bs_d2=$(($bs / 2))
+
+ echo "zero 0, 1"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd 0 1" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+ echo "zero 0, $bs_m1"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd 0 $bs_m1" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+ echo "zero 0, $bs"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd 0 $bs" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+ echo "zero 0, $bs_p1"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd 0 $bs_p1" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+ echo "zero $bs_m1, $bs"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd $bs_m1 $bs" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+ echo "zero $bs_m1, $bs_p1"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd $bs_m1 $bs_p1" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+ echo "zero $bs_m1, $bs_p2"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd $bs_m1 $bs_p2" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+
+ echo "zero $bs, $bs"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd $bs $bs" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+
+
+ echo "zero $bs_d2 , $bs"
+ $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 $bs" \
+ -c "pwrite -S 0x42 $bs $bs" \
+ -c "$zero_cmd $bs_d2 $bs" \
+ -c "pread -v 0 $bs_t2" \
+ $testfile | $filter_cmd
+}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
+. ./common/punch
# real QA test starts here
testfile=$TEST_DIR/290.$$
-test_zero()
-{
- zero_start=$1
- zero_len=$2
-
- $XFS_IO_PROG -f -t -c "pwrite -S 0x41 0 4096" \
- -c "pwrite -S 0x42 4096 4096" \
- -c "zero $zero_start $zero_len" \
- -c "pread -v 0 8192" \
- $testfile | _filter_xfs_io_unique
-}
-
-# [0,1] -- Shouldn't toss anything
-test_zero 0 1
-
-#[0,4095] -- Shouldn't toss anything
-test_zero 0 4095
-
-#[0,4096] -- Should toss first page
-test_zero 0 4096
-
-#[0,4097] -- Should toss first page
-test_zero 0 4097
-
-#[4095,8191] -- Should toss last byte of first page
-test_zero 4095 4096
-
-#[4095,8192] -- Should toss second page & last byte of first page
-test_zero 4095 4097
-
-#[4095,8193] -- Should toss second page & last byte of first page
-test_zero 4095 4098
-
-#[4096,8192] -- Should toss second page
-test_zero 4096 4096
-
-#[1024,5120] -- Should toss from 1024 to end of first page
-test_zero 1024 4096
+_test_block_boundaries 4096 zero _filter_xfs_io_unique $testfile
# success, all done
status=0
QA output created by 290
+zero 0, 1
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 0, 4095
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 0, 4096
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 0, 4097
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 4095, 4096
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
00001ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 42 ...............B
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 4095, 4097
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 4095, 4098
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 4096, 4096
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+zero 2048 , 4096
wrote 4096/4096 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 4096/4096 bytes at offset 4096
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
00000000: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
*
-00000400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
+00000800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
*
-00001400: 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 BBBBBBBBBBBBBBBB
+00001800: 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 BBBBBBBBBBBBBBBB
*
read 8192/8192 bytes at offset 0
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)