@@ -686,7 +686,7 @@ _get_ciphertext_block_list()
{
local file=$1
- sync
+ _sync_fs $file
$XFS_IO_PROG -c fiemap $file | perl -ne '
next if not /^\s*\d+: \[\d+\.\.\d+\]: (\d+)\.\.(\d+)/;
print $_ . "," foreach $1..$2;' | sed 's/,$//'
@@ -392,7 +392,7 @@ _create_log_sync()
# add some syncs to get the log flushed to disk
for file in $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}; do
touch $file
- sync
+ _scratch_sync
done
# unmount the FS
@@ -336,7 +336,7 @@ _qmount_option()
_check_quota_usage()
{
# Sync to get delalloc to disk
- sync
+ _scratch_sync
# kill caches to guarantee removal speculative delalloc
# XXX: really need an ioctl instead of this big hammer
@@ -6,6 +6,30 @@
BC="$(type -P bc)" || BC=
+# Don't use sync(1) directly if at all possible. In most cases we only need to
+# sync the fs under test, so we use syncfs if it is supported to prevent
+# disturbance of other tests that may be running concurrently.
+_sync_fs()
+{
+ local dir=$1
+
+ if [ -e $dir ]; then
+ $XFS_IO_PROG -rxc "syncfs" $dir > /dev/null 2>&1
+ return
+ fi
+ sync
+}
+
+_scratch_sync()
+{
+ _sync_fs $SCRATCH_MNT
+}
+
+_test_sync()
+{
+ _sync_fs $TEST_DIR
+}
+
# Common execution handling for fsstress invocation.
#
# We need per-test fsstress binaries because of the way fsstress forks and
@@ -119,7 +119,7 @@ _check_repair()
_scratch_mount
POSIXLY_CORRECT=yes \
dd if=/bin/bash of=$SCRATCH_MNT/sh 2>&1 |_filter_dd
- sync
+ _scratch_sync
rm -f $SCRATCH_MNT/sh
_scratch_unmount
@@ -156,7 +156,7 @@ ENDL
cat $report >> "$tmp_fn"
fi
echo "</testsuite>" >> "$tmp_fn"
- sync "$tmp_fn" && mv "$tmp_fn" "$out_fn"
+ _sync_fs "$tmp_fn" && mv "$tmp_fn" "$out_fn"
echo "Xunit report: $out_fn"
}
@@ -335,7 +335,7 @@ _fsv_scratch_corrupt_bytes()
local dd_cmds=()
local cmd
- sync # Sync to avoid unwritten extents
+ _scratch_sync # Sync to avoid unwritten extents
cat > $tmp.bytes
local end=$(( offset + $(_get_filesize $tmp.bytes ) ))
@@ -1087,7 +1087,7 @@ _scratch_xfs_unmount_dirty()
rm -f "$f"
echo "test" > "$f"
- sync
+ _scratch_sync
_scratch_shutdown
_scratch_unmount
}
@@ -5241,6 +5241,18 @@ symlink_f(opnum_t opno, long r)
void
sync_f(opnum_t opno, long r)
{
+ int fd;
+
+ fd = open(homedir, O_RDONLY|O_DIRECTORY);
+ if (fd < 0)
+ goto use_sync;
+ syncfs(fd);
+ close(fd);
+ if (verbose)
+ printf("%d/%lld: syncfs\n", procid, opno);
+ return;
+
+use_sync:
sync();
if (verbose)
printf("%d/%lld: sync\n", procid, opno);
@@ -85,7 +85,7 @@ fi
echo "check free space:"
-sync
+_scratch_sync
free2=`_free`
if [ -z "$free2" ]
@@ -43,7 +43,7 @@ echo "==== Post-Remount =="
_hexdump $testfile
rm -f $testfile
-sync
+_scratch_sync
# second case is to do a mwrite between the truncate to a block on the
# same page we are truncating within the EOF. This checks that a mapped
@@ -48,7 +48,7 @@ echo "==== Post-Remount =="
_hexdump $testfile
rm -f $testfile
-sync
+_scratch_sync
# second case is to do a mwrite between the truncate to a block on the
# same page we are truncating within the EOF. This checks that a mapped
@@ -29,7 +29,7 @@ _cleanup()
_syncloop()
{
while [ true ]; do
- sync
+ _scratch_sync
done
}
@@ -41,7 +41,7 @@ touch $SCRATCH_MNT/test_dir/foo
# The intention is that at log recovery time we have a dir entry for 'foo' both
# in the fs/subvol tree and in the log tree - this is necessary to trigger the
# bug on btrfs.
-sync
+_scratch_sync
touch $SCRATCH_MNT/test_dir/bar
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/test_dir
@@ -44,7 +44,7 @@ echo "hello world" > $SCRATCH_MNT/a/b/foo
ln $SCRATCH_MNT/a/b/foo $SCRATCH_MNT/a/b/bar
# Make sure all metadata and data are durably persisted.
-sync
+_scratch_sync
# Now remove one of the hard links and fsync the inode.
rm -f $SCRATCH_MNT/a/b/bar
@@ -60,7 +60,7 @@ for i in `seq 1 3000`; do
done
# Make sure all metadata and data are durably persisted.
-sync
+_scratch_sync
# Add one more link to the inode that ends up being a btrfs extref and fsync
# the inode.
@@ -64,7 +64,7 @@ for i in `seq 1 3000`; do
done
# Make sure all metadata and data are durably persisted.
-sync
+_scratch_sync
# Now remove one link, add a new one with a new name, add another new one with
# the same name as the one we just removed and fsync the inode.
@@ -69,7 +69,7 @@ do
done
# sync, then shutdown immediately after, then remount and test
-sync
+_scratch_sync
_scratch_shutdown
_scratch_unmount
_scratch_mount
@@ -66,7 +66,7 @@ do
done
# sync, then shutdown immediately after, then remount and test
-sync
+_scratch_sync
_scratch_shutdown
_scratch_unmount
_scratch_mount
@@ -30,7 +30,7 @@ load_dir=$SCRATCH_MNT/test
_run_fsstress_bg -n 10000000 -p $PROCS -d $load_dir
sleep $SLEEP_TIME
_kill_fsstress
-sync
+_scratch_sync
_scratch_unmount
# now mount again, run the load again, this time with a shutdown.
@@ -38,7 +38,7 @@ _scratch_mount
$XFS_FSR_PROG -v $load_dir >> $seqres.full 2>&1
_run_fsstress_bg -n10000000 -p $PROCS -d $load_dir
sleep $SLEEP_TIME
-sync
+_scratch_sync
# now shutdown and unmount
sleep 5
@@ -67,7 +67,7 @@ for s in sync nosync ; do
# add some syncs to get the log flushed to disk
for file in $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}; do
touch $file
- sync
+ _scratch_sync
done
else
# generate some log traffic - but not too much - life gets a little
@@ -41,7 +41,7 @@ $XFS_IO_PROG -f -c "pwrite -S 0xaa -b 8K 0 8K" \
$SCRATCH_MNT/foo | _filter_xfs_io
# Make sure the file is durably persisted.
-sync
+_scratch_sync
# Append some data to our file, to increase its size.
$XFS_IO_PROG -f -c "pwrite -S 0xcc -b 4K 8K 4K" \
@@ -58,7 +58,7 @@ $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo
# that modifies the data or metadata of our file, should update those fields in
# the btrfs inode with values that make the next fsync operation write to the
# fsync log.
-sync
+_scratch_sync
# Sleep for 1 second, because we want to check that the next punch operations we
# do update the file's mtime and ctime.
@@ -42,7 +42,7 @@ $XFS_IO_PROG -f -c "pwrite -S 0xaa 0 8K" $SCRATCH_MNT/foo | _filter_xfs_io
mkdir $SCRATCH_MNT/mydir
# Make sure all metadata and data are durably persisted.
-sync
+_scratch_sync
# Add a hard link to 'foo' inside our test directory and fsync only the
# directory. The btrfs fsync implementation had a bug that caused the new
@@ -48,7 +48,7 @@ $SETFATTR_PROG -n user.attr2 -v val2 $SCRATCH_MNT/foobar
$SETFATTR_PROG -n user.attr3 -v val3 $SCRATCH_MNT/foobar
# Make sure everything is durably persisted.
-sync
+_scratch_sync
# Now delete the second xattr and fsync the inode.
$SETFATTR_PROG -x user.attr2 $SCRATCH_MNT/foobar
@@ -51,7 +51,7 @@ touch $SCRATCH_MNT/testdir_1/bar
mkdir $SCRATCH_MNT/testdir_2
# Make sure everything is durably persisted.
-sync
+_scratch_sync
# Write more 8Kb of data to our file.
$XFS_IO_PROG -c "pwrite -S 0xbb 8K 8K" $SCRATCH_MNT/foo | _filter_xfs_io
@@ -41,7 +41,7 @@ _mount_flakey
$XFS_IO_PROG -f -c "pwrite -S 0xaa 0 32k" \
-c "fsync" \
$SCRATCH_MNT/foo | _filter_xfs_io
-sync
+_scratch_sync
# Add a hard link to our file.
# On btrfs this sets the flag BTRFS_INODE_COPY_EVERYTHING on the btrfs inode,
@@ -50,7 +50,7 @@ ln $SCRATCH_MNT/foo $SCRATCH_MNT/bar
# Sync the filesystem to force a commit of the current btrfs transaction, this
# is a necessary condition to trigger the bug on btrfs.
-sync
+_scratch_sync
# Now append more data to our file, increasing its size, and fsync the file.
# In btrfs because the inode flag BTRFS_INODE_COPY_EVERYTHING was set and the
@@ -36,7 +36,7 @@ _require_congruent_file_oplen $TEST_DIR $((7 * 1048576))
# past i_size
$XFS_IO_PROG -f -c "falloc -k 0 10M" -c "pwrite 0 5M" -c "truncate 5M"\
$TEST_DIR/testfile.$seq | _filter_xfs_io
-sync
+_test_sync
$XFS_IO_PROG -c "fiemap -v" $TEST_DIR/testfile.$seq | _filter_fiemap
# Now verify that if we truncate up past i_size we don't trim the preallocated
@@ -38,7 +38,7 @@ workout()
# Create our test file with some data and durably persist it.
$XFS_IO_PROG -t -f -c "pwrite -S 0xaa 0 128K" $SCRATCH_MNT/foo | _filter_xfs_io
- sync
+ _scratch_sync
# Append some data to the file, increasing its size, and leave a hole between
# the old size and the start offset if the following write. So our file gets
@@ -49,7 +49,7 @@ workout()
# This is required to trigger a bug in btrfs truncate where it updates on-disk
# inode size incorrectly.
if [ $need_sync -eq 1 ]; then
- sync
+ _scratch_sync
fi
# Now truncate our file to a smaller size that is in the middle of the hole we
@@ -49,7 +49,7 @@ $XFS_IO_PROG -f -c "pwrite -S 0xaa 0 64K" \
$XFS_IO_PROG -f -c "pwrite -S 0xee 0 64K" \
-c "pwrite -S 0xff 64K 61K" \
$SCRATCH_MNT/bar | _filter_xfs_io
-sync
+_scratch_sync
# Now truncate our file foo to a smaller size (64Kb) and then truncate it to the
# size it had before the shrinking truncate (125Kb). Then fsync our file. If a
@@ -38,7 +38,7 @@ touch $SCRATCH_MNT/testdir/foo
touch $SCRATCH_MNT/testdir/bar
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Create one hard link for file foo and another one for file bar. After that
# fsync only the file bar.
@@ -37,7 +37,7 @@ touch $SCRATCH_MNT/testdir/foo
ln $SCRATCH_MNT/testdir/foo $SCRATCH_MNT/testdir/bar
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Now remove one of the links, trigger inode eviction and then fsync our
# inode.
@@ -41,7 +41,7 @@ ln $SCRATCH_MNT/foo $SCRATCH_MNT/testdir/foo2
ln $SCRATCH_MNT/foo $SCRATCH_MNT/testdir/foo3
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Now we remove one of our file's hardlinks in the directory testdir.
unlink $SCRATCH_MNT/testdir/foo3
@@ -38,7 +38,7 @@ sz=$((blksz * blks))
nr=7
filesize=$((blksz * nr))
_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
-sync
+_test_sync
free_blocks0=$(stat -f $testdir -c '%f')
echo "Create the reflink copies"
@@ -43,7 +43,7 @@ free_blocks0=$(stat -f $testdir -c '%f')
nr=7
filesize=$((blksz * nr))
_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
-sync
+_test_sync
echo "Create the reflink copies"
for i in `seq 2 $nr`; do
@@ -44,7 +44,7 @@ free_blocks0=$(stat -f $testdir -c '%f')
nr=4
filesize=$((blksz * nr))
_pwrite_byte 0x61 0 $sz $testdir/file1 >> $seqres.full
-sync
+_test_sync
echo "Create the reflink copies"
for i in `seq 2 $nr`; do
@@ -54,7 +54,8 @@ seq 1 $((2 * blksz / 250)) | while read f; do
done
mknod $testdir1/dev1 c 1 3
mkfifo $testdir1/fifo1
-sync
+_test_sync
+_scratch_sync
_filter_enotty() {
sed -e 's/Inappropriate ioctl for device/Invalid argument/g'
@@ -55,7 +55,8 @@ seq 1 $((2 * blksz / 250)) | while read f; do
done
mknod $testdir1/dev1 c 1 3
mkfifo $testdir1/fifo1
-sync
+_test_sync
+_scratch_sync
_filter_enotty() {
_filter_dedupe_error | \
@@ -39,7 +39,7 @@ nr=4
filesize=$((blksz * nr))
_pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
_pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
-sync
+_test_sync
do_filter_output()
{
@@ -39,7 +39,7 @@ nr=4
filesize=$((blksz * nr))
_pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
_pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
-sync
+_test_sync
do_filter_output()
{
@@ -49,12 +49,12 @@ mkdir $testdir
echo "Create a big file and reflink it"
_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/bigfile >> $seqres.full 2>&1
_cp_reflink $testdir/bigfile $testdir/clonefile
-sync
+_scratch_sync
echo "Allocate the rest of the space"
nr_free=$(stat -f -c '%f' $testdir)
_fill_fs $((nr_free * blksz)) $testdir/space $blksz 0 >> $seqres.full 2>&1
-sync
+_scratch_sync
echo "CoW the big file"
out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile 2>&1 | \
@@ -47,11 +47,11 @@ mkdir $testdir
echo "Create a big file and reflink it"
_pwrite_byte 0x61 0 $file_size $testdir/bigfile >> $seqres.full 2>&1
_cp_reflink $testdir/bigfile $testdir/clonefile
-sync
+_scratch_sync
echo "Allocate the rest of the space"
_fill_fs $fs_size $testdir/space $blksz 0 >> $seqres.full 2>&1
-sync
+_scratch_sync
echo "CoW the big file"
out="$(_pwrite_byte 0x62 0 $file_size $testdir/bigfile 2>&1 | \
@@ -49,12 +49,12 @@ mkdir $testdir
echo "Create a big file and reflink it"
_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/bigfile >> $seqres.full 2>&1
_cp_reflink $testdir/bigfile $testdir/clonefile
-sync
+_scratch_sync
echo "Allocate the rest of the space"
nr_free=$(stat -f -c '%f' $testdir)
_fill_fs $((blksz * nr_free)) $testdir/space $blksz 0 >> $seqres.full 2>&1
-sync
+_scratch_sync
echo "mmap CoW the big file"
core_ulimit="$(ulimit -c)"
@@ -50,12 +50,12 @@ mkdir $testdir
echo "Create a big file and reflink it"
_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/bigfile >> $seqres.full 2>&1
_cp_reflink $testdir/bigfile $testdir/clonefile
-sync
+_scratch_sync
echo "Allocate the rest of the space"
nr_free=$(stat -f -c '%f' $testdir)
_fill_fs $((blksz * nr_free)) $testdir/space $blksz 0 >> $seqres.full 2>&1
-sync
+_scratch_sync
echo "CoW the big file"
out="$(_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/bigfile -d 2>&1 | \
@@ -9,17 +9,9 @@
. ./common/preamble
_begin_fstest metadata rw auto
-# Override the default cleanup function.
-_cleanup()
-{
- rm -f $tmp.*
- sync
-}
-
# Import common functions.
. ./common/filter
-
_require_scratch
# For xfs, we need to handle the different default log sizes that different
@@ -39,7 +39,7 @@ iosize=1048576
# Initialise file
dd if=/dev/zero of=$testfile bs=$iosize count=$loops &> /dev/null
[ $? -ne 0 ] && exit
-sync
+_test_sync
# Direct I/O overwriter
dd if=/dev/zero of=$testfile oflag=direct bs=$iosize count=$loops conv=notrunc &> /dev/null &
@@ -61,7 +61,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "Write and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
-sync
+_scratch_sync
_dmerror_load_error_table
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
>> $seqres.full 2>&1
@@ -64,7 +64,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
-sync
+_scratch_sync
_dmerror_load_error_table
$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
_dmerror_load_working_table
@@ -53,7 +53,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
-c "fdatasync" $testdir/file2 2>&1)
@@ -53,7 +53,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
-c "fdatasync" $testdir/file2 2>&1)
@@ -53,7 +53,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
_dmerror_load_working_table
@@ -54,7 +54,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" \
-c "fdatasync" $testdir/file2 2>&1)
@@ -54,7 +54,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
echo $urk >> $seqres.full
@@ -54,7 +54,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
echo $urk >> $seqres.full
@@ -92,7 +92,7 @@ _porter()
echo "_porter $_suffix not complete"
fi
- sync
+ _scratch_sync
}
_do_workload()
@@ -50,7 +50,7 @@ echo "Fill fs with 1M IOs; ENOSPC expected" >> $seqres.full
dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=1M >>$seqres.full 2>&1
echo "Fill fs with 4K IOs; ENOSPC expected" >> $seqres.full
dd if=/dev/zero of=$SCRATCH_MNT/tmp2 bs=4K >>$seqres.full 2>&1
-sync
+_scratch_sync
# Last effort, use O_SYNC
echo "Fill fs with 4K DIOs; ENOSPC expected" >> $seqres.full
dd if=/dev/zero of=$SCRATCH_MNT/tmp3 bs=4K oflag=sync >>$seqres.full 2>&1
@@ -66,7 +66,7 @@ for i in `seq 1 2 1023`; do
dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc \
>>$seqres.full 2>/dev/null || _fail "failed to write to test file"
done
-sync
+_scratch_sync
echo >> $seqres.full
echo "Fill in prealloc space; fill holes at offsets:" >> $seqres.full
for i in `seq 2 2 1023`; do
@@ -74,7 +74,7 @@ for i in `seq 2 2 1023`; do
dd if=/dev/zero of=$SCRATCH_MNT/test seek=$i bs=4K count=1 conv=notrunc \
>>$seqres.full 2>/dev/null || _fail "failed to fill test file"
done
-sync
+_scratch_sync
echo >> $seqres.full
echo "done"
@@ -51,9 +51,9 @@ dd if=/dev/zero of=$SCRATCH_MNT/tmp1 bs=256K count=1 >>$seqres.full 2>&1
# Attempt to completely fill fs
dd if=/dev/zero of=$SCRATCH_MNT/tmp2 bs=1M >>$seqres.full 2>&1
-sync
+_scratch_sync
dd if=/dev/zero of=$SCRATCH_MNT/tmp3 bs=4K >>$seqres.full 2>&1
-sync
+_scratch_sync
# Last effort, use O_SYNC
dd if=/dev/zero of=$SCRATCH_MNT/tmp4 bs=4K oflag=sync >>$seqres.full 2>&1
# Save space usage info to the full file
@@ -62,7 +62,7 @@ $DF_PROG $SCRATCH_MNT >>$seqres.full 2>&1
# Should leave approx 256k free
rm -f $SCRATCH_MNT/tmp1
-sync
+_scratch_sync
echo "Post rm space:" >> $seqres.full
$DF_PROG $SCRATCH_MNT >>$seqres.full 2>&1
_freespace=`$DF_PROG -k $SCRATCH_MNT | tail -n 1 | awk '{print $5}'`
@@ -54,7 +54,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
$XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
>> $seqres.full 2>&1
@@ -55,7 +55,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
urk=$($XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 2>&1)
echo $urk >> $seqres.full
@@ -53,7 +53,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
# Insulate ourselves against bash reporting the SIGBUS when we try to modify
# the metadata.
@@ -53,7 +53,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
# Insulate ourselves against bash reporting the SIGBUS when we try to modify
# the metadata.
@@ -53,7 +53,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
# Insulate ourselves against bash reporting the SIGBUS when we try to modify
# the metadata.
@@ -54,7 +54,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
-sync
+_scratch_sync
_dmerror_load_error_table
# Insulate ourselves against bash reporting the SIGBUS when we try to modify
# the metadata.
@@ -41,7 +41,7 @@ fsize=`_get_filesize $TEST_DIR/testfile.$seq`
# Truncate the file size back to 0
truncate -s 0 $TEST_DIR/testfile.$seq
-sync
+_test_sync
# Preallocated disk space should be released
avail_done=`df -P $TEST_DIR | awk 'END {print $4}'`
@@ -73,7 +73,7 @@ _print_numeric_uid
echo ""
echo "*** Remounting ***"
echo ""
-sync
+_scratch_sync
_scratch_cycle_mount >>$seqres.full 2>&1 || _fail "remount failed"
_print_numeric_uid
@@ -81,7 +81,7 @@ _print_getfacls
echo "*** Remounting ***"
echo ""
-sync
+_scratch_sync
_scratch_cycle_mount >>$seqres.full 2>&1 || _fail "remount failed"
_print_getfacls
@@ -42,7 +42,7 @@ $XFS_IO_PROG -f -c "pwrite -S 0xff 0 256K" $SCRATCH_MNT/foo | _filter_xfs_io
# Now sync the file data to disk using 'sync' and not an fsync. This is because
# in btrfs the first fsync clears the btrfs inode full fsync flag, which must
# be set when the first msync below happens in order to trigger the bug.
-sync
+_scratch_sync
# Now update the first 4Kb and the last 4Kb of the file, using memory mapped IO
# because an msync(), since the linux kernel commit
@@ -62,12 +62,12 @@ _report_quota_blocks $SCRATCH_MNT
echo "Try to dio write the whole file"
_pwrite_byte 0x62 0 $sz $testdir/file1 -d >> $seqres.full
-sync
+_scratch_sync
_report_quota_blocks $SCRATCH_MNT
echo "Try to write the whole file"
_pwrite_byte 0x62 0 $sz $testdir/file3 >> $seqres.full
-sync
+_scratch_sync
_report_quota_blocks $SCRATCH_MNT
# success, all done
@@ -57,7 +57,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
-sync
+_scratch_sync
_dmerror_load_error_table
$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
_dmerror_load_working_table
@@ -51,7 +51,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
-sync
+_scratch_sync
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
_scratch_cycle_mount
@@ -57,7 +57,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
-sync
+_scratch_sync
_dmerror_load_error_table
$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
$XFS_IO_PROG -c "fdatasync" $testdir/file2
@@ -52,7 +52,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
-sync
+_scratch_sync
$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
_scratch_cycle_mount
@@ -38,7 +38,7 @@ mkdir $SCRATCH_MNT/c
touch $SCRATCH_MNT/a/b/foo
# Make sure everything is durably persisted.
-sync
+_scratch_sync
# Now move our test file into a new parent directory.
mv $SCRATCH_MNT/a/b/foo $SCRATCH_MNT/c/
@@ -43,7 +43,7 @@ ln $SCRATCH_MNT/a/foo $SCRATCH_MNT/b/foo_link
touch $SCRATCH_MNT/b/bar
# Make sure everything is durably persisted.
-sync
+_scratch_sync
# Now delete one of the hard links of file foo and move file bar into c/
unlink $SCRATCH_MNT/b/foo_link
@@ -36,7 +36,7 @@ mkdir -p $SCRATCH_MNT/a/x
$XFS_IO_PROG -f -c "pwrite -S 0xaf 0 32K" $SCRATCH_MNT/a/x/foo | _filter_xfs_io
$XFS_IO_PROG -f -c "pwrite -S 0xba 0 32K" $SCRATCH_MNT/a/x/bar | _filter_xfs_io
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
echo "File digests before power failure:"
md5sum $SCRATCH_MNT/a/x/foo | _filter_scratch
@@ -40,7 +40,7 @@ _mount_flakey
mkdir $SCRATCH_MNT/a
$XFS_IO_PROG -f -c "pwrite -S 0xf1 0 16K" $SCRATCH_MNT/a/foo | _filter_xfs_io
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Now rename file foo to bar and create a new file named foo under the same
# directory. After a power failure we must see the two files.
@@ -41,7 +41,7 @@ mkdir $SCRATCH_MNT/y/z
touch $SCRATCH_MNT/y/foo2
# Make sure everything is durably persisted.
-sync
+_scratch_sync
# Now add a link to foo at directory x, move directory z and file foo2 from
# directory y to directory x and fsync foo's inode. We expect that after a
@@ -36,7 +36,7 @@ _workout()
$XFS_IO_PROG -f -c "pwrite -W 0 1M" $SCRATCH_MNT/file$I &>/dev/null
done
- sync
+ _scratch_sync
_dmthin_grow $GROW_SIZE
@@ -35,7 +35,7 @@ _mount_flakey
mkdir $SCRATCH_MNT/testdir1
# Make sure it's durably persisted.
-sync
+_scratch_sync
# Create our symlinks and fsync their parent directories.
# We test both the case where the parent directory is new (not yet durably
@@ -48,7 +48,7 @@ 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
+_scratch_sync
$XFS_IO_PROG -c "fiemap -v" $file1 | _filter_fiemap_flags > $extmap1
$XFS_IO_PROG -c "fiemap -v" $file2 | _filter_fiemap_flags > $extmap2
@@ -36,7 +36,7 @@ _mount_flakey
mkdir $SCRATCH_MNT/dir
touch $SCRATCH_MNT/dir/foo
# Make sure everything is durably persisted.
-sync
+_scratch_sync
mv $SCRATCH_MNT/dir/foo $SCRATCH_MNT/dir/bar
touch $SCRATCH_MNT/dir/foo
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/dir/bar
@@ -56,7 +56,7 @@ do_test()
for ((i=0; i<30; i++));do
_user_do "echo -n > ${SCRATCH_MNT}/file${i}"
done
- sync
+ _scratch_sync
rm -f ${SCRATCH_MNT}/* >/dev/null 2>&1
}
@@ -37,7 +37,7 @@ done
# consume all remaining free space
dd if=/dev/zero of=$SCRATCH_MNT/space >/dev/null 2>&1
-sync
+_scratch_sync
# fs is full now and fs internal operations may need some free space, for
# example, in btrfs, transaction will need to reserve space first, so here free
@@ -38,7 +38,7 @@ for ((off = 0; off < num_extents * extent_size; off += extent_size)); do
done
# To reproduce the Btrfs bug, the extent map must not be cached in memory.
-sync
+_test_sync
echo 3 > /proc/sys/vm/drop_caches
"$here/src/dio-interleaved" "$extent_size" "$num_extents" "$testfile"
@@ -58,7 +58,7 @@ fs_stress()
-f getdents=1 \
-f fiemap=1 \
-d $target
- sync
+ _sync_fs $target
}
# prepare some mountpoint dir
@@ -66,7 +66,7 @@ fs_stress()
-f getdents=1 \
-f fiemap=1 \
-d $target
- sync
+ _sync_fs $target
}
# prepare some mountpoint dir
@@ -49,7 +49,7 @@ fs_stress()
-f getdents=1 \
-f fiemap=1 \
-d $target
- sync
+ _sync_fs $target
}
# prepare some mountpoint dir
@@ -52,7 +52,7 @@ _scratch_remount
# remove all files with odd file names, which should free near half
# of the space
rm $SCRATCH_MNT/*[13579]
-sync
+_scratch_sync
# We should be able to write at least 1/8 of the whole fs size
# The number 1/8 is for btrfs, which only has about 47M for data.
@@ -34,7 +34,7 @@ $XFS_IO_PROG -f \
touch $SCRATCH_MNT/foo4
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Now overwrite the extent of the first file.
$XFS_IO_PROG -c "pwrite -S 0xff 0 64K" $SCRATCH_MNT/foo1 | _filter_xfs_io
@@ -77,7 +77,7 @@ space_used > $SCRATCH_MNT/$seq.before
cat $SCRATCH_MNT/$seq.before
) >> $seqres.full
-sync
+_scratch_sync
# We expect the same file sizes reported by 'du' after writeback finishes.
@@ -52,7 +52,7 @@ while [ $i -lt $max_attrs ]; do
$SETFATTR_PROG -n "user.$n" -v "$n" $testfile > $seqres.full 2>&1 || break
i=$((i + 1))
done
-sync
+_scratch_sync
echo "Check attr extent counts"
f1=$(_count_attr_extents $testfile)
@@ -27,7 +27,7 @@ load_dir=$SCRATCH_MNT/test
_run_fsstress_bg -n10000000 -p $PROCS -d $load_dir
sleep $SLEEP_TIME
-sync
+_scratch_sync
# now shutdown and unmount
sleep 5
@@ -36,7 +36,7 @@ _scratch_mount
# accelerates syncfs on testing filesystem so that test case can finish
# in 30 seconds.
-sync
+_scratch_sync
# Large fs has a huge size .use_space file, will take long time on running
# fssum $SCRATCH_MNT. So change the target path to a sub-dir of $SCRATCH_MNT.
@@ -47,7 +47,7 @@ $XFS_IO_PROG -f -c "pwrite 0 4K" $localdir/testfile >/dev/null 2>&1
# fssum used for comparing checksum of test file(data & metedata),
# exclude checking about atime, block structure, open error.
$FSSUM_PROG -ugomAcdES -f -w $tmp.fssum $localdir
-$XFS_IO_PROG -c "syncfs" $localdir/testfile >/dev/null 2>&1
+_sync_fs $localdir/testfile
_scratch_shutdown
_scratch_cycle_mount
$FSSUM_PROG -r $tmp.fssum $localdir
@@ -53,7 +53,7 @@ run_test()
_fail "Invalid file type argument: $file_type"
esac
# Make sure everything done so far is durably persisted.
- sync
+ _scratch_sync
# Create a file and fsync it just to create a journal/log. This file
# must be in the same directory as our special file "foo".
@@ -38,7 +38,7 @@ touch $SCRATCH_MNT/testdir/foo
ln $SCRATCH_MNT/testdir/foo $SCRATCH_MNT/testdir/bar
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Now remove of the links of our file and create a new file with the same name
# and in the same parent directory, and finally fsync this new file.
@@ -57,7 +57,7 @@ $XFS_IO_PROG -f -c "pwrite -S 0xf1 0 256K" \
$SCRATCH_MNT/baz >/dev/null
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Allocate an extent beyond the size of the first test file and fsync it.
$XFS_IO_PROG -c "falloc -k 256K 1M"\
@@ -39,7 +39,7 @@ $SETFATTR_PROG -n user.xa3 -v test $SCRATCH_MNT/foobar
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foobar
# Call sync to commit all fileystem metadata.
-sync
+_scratch_sync
$XFS_IO_PROG -c "pwrite -S 0xea 0 64K" \
-c "fsync" \
@@ -46,7 +46,7 @@ touch $SCRATCH_MNT/testdir/foo
ln $SCRATCH_MNT/testdir/foo $SCRATCH_MNT/testdir/bar
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Now rename the first hard link (foo) to a new name and rename the second hard
# link (bar) to the old name of the first hard link (foo).
@@ -40,7 +40,7 @@ do_check()
touch $testfile
if [ "$1" == "sync" ]; then
- sync
+ _scratch_sync
fi
chown 100 $testfile
@@ -45,7 +45,7 @@ do_check()
touch $testfile
if [ "$1" == "sync" ]; then
- sync
+ _scratch_sync
fi
$XFS_IO_PROG -x -c "chproj 100" $testfile
@@ -59,7 +59,7 @@ do_check()
if [ "$2" == "sync" ]; then
echo "sync" >> $seqres.full
- sync
+ _scratch_sync
fi
echo "Test chattr +$1" >> $seqres.full
@@ -44,7 +44,7 @@ do_check()
touch $testfile
if [ "$1" == "sync" ]; then
- sync
+ _scratch_sync
fi
before=`$XFS_IO_PROG -f $testfile -c "statx -v" | grep btime`
@@ -39,7 +39,7 @@ mkdir $SCRATCH_MNT/testdir/B
touch $SCRATCH_MNT/testdir/B/bar
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Now move our file bar from directory B to directory A and then replace
# directory B with directory A, also renaming directory A to B. Finally
@@ -125,7 +125,7 @@ test_link_sync()
mkdir -p "${dest%/*}"
touch $src
ln $src $dest
- sync
+ _scratch_sync
before=`stat "$stat_opt" $src`
check_consistency $src 0
@@ -43,7 +43,7 @@ echo -n "foo" > $SCRATCH_MNT/testdir/fname1
echo -n "hello" > $SCRATCH_MNT/testdir/fname2
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Rename and link files such that one new name corresponds to the name of
# another renamed file and one new file has the old name of one of the renamed
@@ -49,7 +49,7 @@ ln $SCRATCH_MNT/testdir2/zz $SCRATCH_MNT/testdir2/zz_link
echo -n "hello" > $SCRATCH_MNT/testdir2/a
# Make sure everything done so far is durably persisted.
-sync
+_scratch_sync
# Rename, remove and link files such that one new name corresponds to the name
# of a deleted file and one new file has the old name of the renamed file. Then
@@ -59,7 +59,7 @@ do_check()
echo "Test chmod $target" >> $seqres.full
chmod 777 $target
- sync
+ _scratch_sync
chmod 755 $target
$XFS_IO_PROG $target -c "fsync"
@@ -47,7 +47,7 @@ _pwrite_byte 0x00 0 512m "$SCRATCH_MNT/padding" >> $seqres.full 2>&1
# Sync to ensure that padding file reach disk so that at log recovery we
# still have no data space
-sync
+_scratch_sync
# This should not fail
_pwrite_byte 0xcd 1m 16m "$SCRATCH_MNT/foobar" >> $seqres.full
@@ -366,7 +366,7 @@ test_toplevel_dir_rename()
# 'f2fs: don't use casefolded comparison for "." and ".."'.
mkdir ${dir}
_casefold_set_attr ${dir}
- sync
+ _scratch_sync
echo 2 > /proc/sys/vm/drop_caches
mv ${dir} ${dir}.new
}
@@ -86,7 +86,7 @@ done
(
while [ ! -e $tmp.done ]; do
sleep 2.$((RANDOM % 100))
- sync && echo 3 > /proc/sys/vm/drop_caches
+ _scratch_sync && echo 3 > /proc/sys/vm/drop_caches
done
) &
@@ -48,7 +48,7 @@ fs_stress()
local target=$1
_run_fsstress -n 50 -p 3 -d $target
- sync
+ _sync_fs $target
}
# prepare some mountpoint dir
@@ -24,7 +24,7 @@ _scratch_mount
localdir=$SCRATCH_MNT/dir
mkdir $localdir
-sync
+_scratch_sync
# fssum used for comparing checksum of test file(data & metedata),
# exclude checking about atime, block structure, open error.
@@ -30,7 +30,7 @@ $here/src/punch-alternating $SCRATCH_MNT/foobar >>$seqres.full
# For btrfs, trigger a transaction commit to force metadata COW for the
# following fallocate zero range operation.
-sync
+_scratch_sync
$XFS_IO_PROG -c "fzero 0 100M" $SCRATCH_MNT/foobar
@@ -54,7 +54,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x59 0 1m -b 1m' $SCRATCH_MNT/c >> $seqres.full
_cp_reflink $SCRATCH_MNT/a $SCRATCH_MNT/e
_cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d
touch $SCRATCH_MNT/b
-sync
+_scratch_sync
# Test that reflink forces dirty data/metadata to disk when destination file
# opened with O_SYNC
@@ -81,7 +81,7 @@ rm -f $SCRATCH_MNT/b $SCRATCH_MNT/d
_cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d
touch $SCRATCH_MNT/b
chattr +S $SCRATCH_MNT/b $SCRATCH_MNT/d
-sync
+_scratch_sync
# Test that reflink forces dirty data/metadata to disk when destination file
# has the sync iflag set
@@ -50,7 +50,7 @@ md5sum $SCRATCH_MNT/0 | _filter_scratch
# Set up initial files for copy test
$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m -b 1m' $SCRATCH_MNT/a >> $seqres.full
touch $SCRATCH_MNT/b
-sync
+_scratch_sync
# Test that unaligned copy file range forces dirty data/metadata to disk when
# destination file opened with O_SYNC
@@ -66,7 +66,7 @@ md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch
rm -f $SCRATCH_MNT/b
touch $SCRATCH_MNT/b
chattr +S $SCRATCH_MNT/b
-sync
+_scratch_sync
# Test that unaligned copy file range forces dirty data/metadata to disk when
# destination file has the sync iflag set
@@ -38,7 +38,7 @@ mkdir $SCRATCH_MNT/B
echo -n "hello world" > $SCRATCH_MNT/A/foo
# Persist everything done so far.
-sync
+_scratch_sync
# Add some new file to directory A and fsync the directory.
touch $SCRATCH_MNT/A/bar
@@ -28,7 +28,7 @@ setup_testfile() {
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
_pwrite_byte 0x57 0 1m $SCRATCH_MNT/b >> $seqres.full
chmod a+r $SCRATCH_MNT/b
- sync
+ _scratch_sync
}
commit_and_check() {
@@ -29,7 +29,7 @@ setup_testfile() {
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/b >> $seqres.full
chmod a+r $SCRATCH_MNT/b
- sync
+ _scratch_sync
}
commit_and_check() {
@@ -33,7 +33,7 @@ setup_testfile() {
_pwrite_byte 0x57 0 1m $SCRATCH_MNT/b >> $seqres.full
chmod a+rwx $SCRATCH_MNT/a $SCRATCH_MNT/b
$SETCAP_PROG cap_setgid,cap_setuid+ep $SCRATCH_MNT/a
- sync
+ _scratch_sync
}
commit_and_check() {
@@ -62,7 +62,7 @@ $XFS_IO_PROG -c "falloc -k 20M 1M" $SCRATCH_MNT/foo
# On btrfs this commits the current transaction and it makes all the created
# extents to have a generation lower than the generation of the transaction used
# by the next write and fsync.
-sync
+_scratch_sync
# Now overwrite only the first extent.
# On btrfs, due to COW (both data and metadata), that results in modifying only
@@ -36,7 +36,7 @@ chmod a+rw $junk_dir/
setup_testfile() {
rm -f $junk_file
_pwrite_byte 0x58 0 192k $junk_file >> $seqres.full
- sync
+ _test_sync
}
commit_and_check() {
@@ -36,7 +36,7 @@ chmod a+rw $junk_dir/
setup_testfile() {
rm -f $junk_file
_pwrite_byte 0x58 0 192k $junk_file >> $seqres.full
- sync
+ _test_sync
}
commit_and_check() {
@@ -36,7 +36,7 @@ chmod a+rw $junk_dir/
setup_testfile() {
rm -f $junk_file
_pwrite_byte 0x58 0 192k $junk_file >> $seqres.full
- sync
+ _test_sync
}
commit_and_check() {
@@ -36,7 +36,7 @@ chmod a+rw $junk_dir/
setup_testfile() {
rm -f $junk_file
_pwrite_byte 0x58 0 192k $junk_file >> $seqres.full
- sync
+ _test_sync
}
commit_and_check() {
@@ -36,7 +36,7 @@ chmod a+rw $junk_dir/
setup_testfile() {
rm -f $junk_file
_pwrite_byte 0x58 0 192k $junk_file >> $seqres.full
- sync
+ _test_sync
}
commit_and_check() {
@@ -40,7 +40,7 @@ setup_testfile() {
touch $junk_file
chmod a+rwx $junk_file
$SETCAP_PROG cap_setgid,cap_setuid+ep $junk_file
- sync
+ _test_sync
}
commit_and_check() {
@@ -52,7 +52,7 @@ _mount_flakey
mkdir "$SCRATCH_MNT"/testdir
# Commit the current transaction and persist the directory.
-sync
+_scratch_sync
# Create a file in the test directory, so that the next fsync on the directory
# actually does something (it logs the directory).
@@ -39,7 +39,7 @@ fi
# make sure indirect block reservations and other temporary block reservations
# are released before sampling i_blocks
-sync $junk_file
+_test_sync
iblocks=`stat -c '%b' $junk_file`
@@ -51,7 +51,7 @@ $XFS_IO_PROG -f -c "truncate 12M" \
$SCRATCH_MNT/foobar | _filter_xfs_io
# Persist everything, commit the filesystem's transaction.
-sync
+_scratch_sync
# Now punch two holes in the file:
#
@@ -70,7 +70,7 @@ fi
$XFS_IO_PROG -c "falloc 0 256M" $test_file
# Persist everything, make sure the file exists after power failure.
-sync
+_scratch_sync
echo -e "Running fio with config:\n" >> $seqres.full
cat $fio_config >> $seqres.full
@@ -36,7 +36,7 @@ filesnap() {
mkfile() {
rm -f $dir/a
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
- sync
+ _test_sync
}
dir=$TEST_DIR/test-$seq
@@ -31,7 +31,7 @@ nrblks=64
# Create some 4M files to test exchangerange
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/b >> $seqres.full
-sync
+_test_sync
md5sum $dir/a $dir/b | _filter_test_dir
# Set FSIZE to twice the blocksize (IOWs, 128k)
@@ -34,7 +34,7 @@ filesnap() {
mkfile() {
rm -f $dir/a
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
- sync
+ _test_sync
}
dir=$TEST_DIR/test-$seq
@@ -35,7 +35,7 @@ mkfile() {
rm -f $dir/a
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
chown $qa_user $dir/a $dir/
- sync
+ _test_sync
}
dir=$TEST_DIR/test-$seq
@@ -31,7 +31,7 @@ _require_congruent_file_oplen $SCRATCH_MNT 65536
# Create original file
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
-sync
+_scratch_sync
md5sum $SCRATCH_MNT/a | _filter_scratch
# Test atomic scatter-gather file commits.
@@ -35,7 +35,7 @@ chmod a+rw $SCRATCH_MNT/
setup_testfile() {
rm -f $SCRATCH_MNT/a
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
- sync
+ _scratch_sync
}
commit_and_check() {
@@ -42,7 +42,7 @@ setup_testfile() {
_pwrite_byte 0x57 0 1m $SCRATCH_MNT/b >> $seqres.full
chmod a+rw $SCRATCH_MNT/a $SCRATCH_MNT/b
$SETCAP_PROG cap_setgid,cap_setuid+ep $SCRATCH_MNT/a
- sync
+ _scratch_sync
}
commit_and_check() {
@@ -42,7 +42,7 @@ $XFS_IO_PROG -f -c "finsert 1M ${finsert_len}" "${SCRATCH_MNT}/file" >> $seqres.
# Filling up the free space ensures that the pre-allocated space is the reserved space.
nr_free=$(stat -f -c '%f' ${SCRATCH_MNT})
_fill_fs $((nr_free * file_blksz)) ${SCRATCH_MNT}/fill $file_blksz 0 >> $seqres.full 2>&1
-sync
+_scratch_sync
# Remove reserved space to gain free space for allocation
rm -f ${SCRATCH_MNT}/tmp
@@ -36,7 +36,7 @@ $XFS_IO_PROG -fc "pwrite 0 64k" $SCRATCH_MNT/testfile >> $seqres.full
for i in $(seq 0 1024); do
create_eof_block_file $SCRATCH_MNT/$i
done
-sync
+_scratch_sync
xfs_freeze -f $SCRATCH_MNT
# This will hang if bug reproduces
@@ -51,7 +51,7 @@ _mount_flakey
# Create the test file with some initial data and make sure everything is
# durably persisted.
$XFS_IO_PROG -f -c "pwrite -S 0xaa 0 32k" $SCRATCH_MNT/foo | _filter_xfs_io
-sync
+_scratch_sync
# Add many small xattrs to our file.
# We create such a large amount because it's needed to trigger the issue found
@@ -66,7 +66,7 @@ done
# Sync the filesystem to force a commit of the current btrfs transaction, this
# is a necessary condition to trigger the bug on btrfs.
-sync
+_scratch_sync
# Now update our file's data and fsync the file.
# After a successful fsync, if the fsync log/journal is replayed we expect to
@@ -170,7 +170,7 @@ for i in `seq 1 10`; do
done
# Get reference fiemap, this can contain i.e. uninitialized inode table
-sync
+_sync_fs $loop_mnt
get_holes > $fiemap_ref
# Delete some files
@@ -184,7 +184,7 @@ echo "done."
echo -n "Detecting interesting holes in image..."
# Get after-trim fiemap
-sync
+_sync_fs $loop_mnt
get_holes > $fiemap_after
echo "done."
@@ -57,7 +57,7 @@ _used_percent() {
_delete_random_file() {
local to_delete=$(find ${SCRATCH_MNT} -type f | shuf | head -1)
rm $to_delete
- sync ${SCRATCH_MNT}
+ _scratch_sync
}
_get_random_fsz() {
@@ -110,7 +110,7 @@ echo "Starting mixed write/delete test using buffered IO"
_mixed_write_delete ""
echo "Syncing"
-sync ${SCRATCH_MNT}/*
+_scratch_sync
echo "Done, all good"
@@ -100,7 +100,7 @@ do_mmap_tests()
$XFS_IO_PROG -f -c "pwrite -S 0xaa -b 512 $offset $len" \
$test_file >> $seqres.full
- sync
+ _scratch_sync
new_filelen=$(_get_filesize $test_file)
map_len=$(_round_up_to_page_boundary $new_filelen)
csum_orig="$(_md5_checksum $test_file)"
@@ -141,7 +141,7 @@ do_mmap_tests()
-c "mmap -w 0 $map_len" \
-c "mwrite $new_filelen $zero_filled_data_len" \
-c "munmap"
- sync
+ _scratch_sync
csum_post="$(_md5_checksum $test_file)"
if [[ "$csum_orig" != "$csum_post" ]]; then
let failed=$failed+1
@@ -101,9 +101,9 @@ _log_traffic()
while [ $count -ge 0 ]
do
touch $out
- sync
+ _scratch_sync
rm $out
- sync
+ _scratch_sync
let "count = count - 1"
done
@@ -54,7 +54,7 @@ fi
# create 100 (fs-blocksize) blocks
_file_as_id $SCRATCH_MNT/foo $id $type $dbsize 220
-sync
+_scratch_sync
# set limit at 1001 (1k) blocks
bsoft=1001
@@ -43,7 +43,7 @@ do
done
wait
-sync
+_scratch_sync
I=10030585
E=10030599
@@ -38,7 +38,7 @@ echo "Silence is golden"
# preallocation added. Let's say... 64k free chunks.
$XFS_IO_PROG -fs -c "falloc 0 40000k" $SCRATCH_MNT/fill >> $seqres.full 2>&1
-sync
+_scratch_sync
dd if=/dev/zero of=$SCRATCH_MNT/remainder oflag=direct > /dev/null 2>&1
@@ -55,7 +55,7 @@ for I in `seq 1 64`; do
>> $seqres.full 2>&1
done
# sync to get extents on disk so fsr sees them
-sync
+_scratch_sync
# Free up some space for defragmentation temp file
rm -f $SCRATCH_MNT/fill
@@ -30,7 +30,7 @@ _require_scratch
_require_freeze
# this may hang
-sync
+_scratch_sync
export MKFS_OPTIONS="-l version=2,su=64k"
logblks=$(_scratch_find_xfs_min_logblocks)
@@ -42,7 +42,7 @@ blksz_factor=$((blksz / real_blksz))
# preallocate space to try to produce a single extent.
$XFS_IO_PROG -f -c "falloc 0 $((blks * blksz))" $testdir/file1 >> $seqres.full
_pwrite_byte 0x61 0 $((blks * blksz)) $testdir/file1 >> $seqres.full
-sync
+_scratch_sync
nextents=$($XFS_IO_PROG -c 'stat' $testdir/file1 | grep 'fsxattr.nextents' | awk '{print $3}')
@@ -49,7 +49,7 @@ fi
echo "Remount, try to append"
_scratch_mount
dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
-sync
+_scratch_sync
# success, all done
status=0
@@ -52,7 +52,7 @@ fi
echo "Remount, try to append"
_scratch_mount
dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)."
-sync
+_scratch_sync
# success, all done
status=0
@@ -51,7 +51,7 @@ lim_bhard=$(( 100 * blksz ))
# Force the block counters for uid 1 and 2 above zero
_pwrite_byte 0x61 0 $filesz $SCRATCH_MNT/a >> $seqres.full
_pwrite_byte 0x61 0 $filesz $SCRATCH_MNT/b >> $seqres.full
-sync
+_scratch_sync
chown 1 $SCRATCH_MNT/a
chown 2 $SCRATCH_MNT/b
@@ -151,7 +151,7 @@ for ((ino = icluster_ino; ino < icluster_ino + XFS_INODES_PER_CHUNK; ino++)); do
find $SCRATCH_MNT/urk/ -inum "$ino" -print0 | xargs -r -0 mv -t $SCRATCH_MNT/save/
done
rm -rf $SCRATCH_MNT/urk/ $SCRATCH_MNT/save/*/*
-sync
+_scratch_sync
$XFS_IO_PROG -c 'fsmap -vvvvv' $SCRATCH_MNT &>> $seqres.full
# Propose shrinking the filesystem such that the end of the fs ends up in the
@@ -56,7 +56,7 @@ $CHATTR_PROG +d $TEST_DIR/d/t
_do_dump
echo "Dump exclude flag set, after sync (should be skipped)"
-sync
+_test_sync
_do_dump
# success, all done
@@ -64,8 +64,8 @@ do_pwrite 5000 6455 $min_align
do_pwrite 1728 4999 $min_align
do_pwrite 0 1727 $min_align
-sync
-sync
+_scratch_sync
+_scratch_sync
# and truncate it again
> $SCRATCH_MNT/bigfile
@@ -52,7 +52,7 @@ echo "CoW and leave leftovers"
$XFS_IO_PROG -f -c "extsize" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((filesize - 1)) 1" -c "fsync" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((filesize - 1)) 1" -c "fsync" $testdir/file2.chk >> $seqres.full
-sync
+_scratch_sync
echo "Crash and recover"
$XFS_IO_PROG -x -c "shutdown" $testdir/file2 >> $seqres.full
@@ -60,7 +60,7 @@ fragment_freespace()
$XFS_IO_PROG -f -c "unresvsp ${i}k 4k" $_file \
> /dev/null 2>&1
done
- sync
+ _scratch_sync
# and now use up all the remaining extents larger than 3 blocks
$XFS_IO_PROG -fs -c "resvsp 0 4m" $_file.large > /dev/null 2>&1
@@ -71,7 +71,7 @@ seq 2 2 $((nr - 1)) | while read f; do
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2.chk >> $seqres.full
done
-sync
+_scratch_sync
echo "Wait for CoW expiration"
sleep 3
@@ -88,7 +88,7 @@ seq 2 2 $((nr - 1)) | while read f; do
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2.chk >> $seqres.full
done
-sync
+_scratch_sync
echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
@@ -74,7 +74,7 @@ seq 2 2 $((nr - 1)) | while read f; do
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f - 1)) 1" $testdir/file2.chk >> $seqres.full
done
-sync
+_scratch_sync
echo "Wait for CoW expiration"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * 2)) 1" $testdir/file2 >> $seqres.full
@@ -92,7 +92,7 @@ seq 2 2 $((nr - 1)) | while read f; do
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 $((blksz * f)) 1" $testdir/file2.chk >> $seqres.full
done
-sync
+_scratch_sync
echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
@@ -39,7 +39,7 @@ echo "Create the original file blocks"
blksz="$(_get_block_size $testdir)"
nr_blks=$((4 * blksz / 12))
_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
-sync
+_scratch_sync
echo "Punch every other block"
seq 1 2 $((nr_blks - 1)) | while read nr; do
@@ -38,7 +38,7 @@ nr_blks=$((8 * blksz / 12))
for i in 1 2 x; do
_pwrite_byte 0x61 0 $((blksz * nr_blks)) $testdir/file1 >> $seqres.full
_pwrite_byte 0x62 0 $((blksz * nr_blks)) $testdir/file2 >> $seqres.full
- sync
+ _scratch_sync
echo "$i: Reflink every other block"
seq 1 2 $((nr_blks - 1)) | while read nr; do
@@ -60,7 +60,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
-sync
+_scratch_sync
_dmerror_load_error_table
$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
_dmerror_load_working_table
@@ -56,7 +56,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
-sync
+_scratch_sync
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
$AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
_scratch_cycle_mount
@@ -62,7 +62,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
-sync
+_scratch_sync
_dmerror_load_error_table
$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
$XFS_IO_PROG -c "fdatasync" $testdir/file2
@@ -57,7 +57,7 @@ md5sum $testdir/file2 | _filter_scratch
echo "CoW and unmount"
$XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
-sync
+_scratch_sync
$AIO_TEST -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
_scratch_cycle_mount
@@ -66,7 +66,7 @@ seq 3 5 $nr | while read f; do
_pwrite_byte 0x71 $((blksz * f)) $blksz $testdir/file3 >> $seqres.full
_pwrite_byte 0x71 $((blksz * f)) $blksz $testdir/file3.chk >> $seqres.full
done
-sync
+_scratch_sync
# 4 blocks are delalloc (do later)
seq 4 5 $nr | while read f; do
_pwrite_byte 0x62 $((blksz * f)) $blksz $testdir/file3 >> $seqres.full
@@ -102,7 +102,7 @@ echo "Regular data extents:"
test $(_xfs_bmapx_find data $testdir/file3 -E '00[01]{4}$') -gt 0 || \
echo "Expected to find a regular data extent"
-sync
+_scratch_sync
echo "Dump extents after sync"
$XFS_IO_PROG -c "cowextsize" $testdir/file3 | _filter_scratch
@@ -25,7 +25,7 @@ mkdir $testdir
echo "Create the original files"
touch $testdir/file1
-sync
+_scratch_sync
echo "Dump extents after sync"
echo "Hole CoW extents:"
@@ -44,7 +44,7 @@ for i in 1 2 x; do
seq 1 $nr_blks | while read nr; do
_cp_reflink $testdir/file1 $testdir/file1.$nr >> $seqres.full
done
- sync
+ _scratch_sync
echo "$i: Truncate files"
seq 1 $nr_blks | while read nr; do
@@ -33,7 +33,7 @@ _scratch_mount
_xfs_force_bdev data $SCRATCH_MNT
_pwrite_byte 0x80 0 737373 $SCRATCH_MNT/urk >> $seqres.full
-sync
+_scratch_sync
$here/src/punch-alternating $SCRATCH_MNT/urk >> $seqres.full
ino=$(stat -c '%i' $SCRATCH_MNT/urk)
@@ -32,7 +32,7 @@ _scratch_mkfs > "$seqres.full" 2>&1
_scratch_mount
_pwrite_byte 0x80 0 737373 $SCRATCH_MNT/f1 >> $seqres.full
-sync
+_scratch_sync
$here/src/punch-alternating $SCRATCH_MNT/f1 >> $seqres.full
_cp_reflink $SCRATCH_MNT/f1 $SCRATCH_MNT/f2
ino=$(stat -c '%i' $SCRATCH_MNT/f1)
@@ -37,7 +37,7 @@ _scratch_mount
test $rtextsz -eq $dbsize || _notrun "Skipping test due to rtextsize > 1 fsb"
$XFS_IO_PROG -f -R -c 'pwrite -S 0x80 0 737373' $SCRATCH_MNT/urk >> $seqres.full
-sync
+_scratch_sync
$here/src/punch-alternating $SCRATCH_MNT/urk >> $seqres.full
ino=$(stat -c '%i' $SCRATCH_MNT/urk)
@@ -41,12 +41,12 @@ mkdir $SCRATCH_MNT/fragdir
for I in `seq 0 26200`; do
(echo data > $SCRATCH_MNT/fragdir/f$I) >> $seqres.full 2>&1
done
-sync
+_scratch_sync
for I in `seq 0 2 26200`; do
rm -f $SCRATCH_MNT/fragdir/f$I >> $seqres.full 2>&1
done
-sync
+_scratch_sync
# Soak up any remaining freespace
$XFS_IO_PROG -f -c "pwrite 0 16m" -c "fsync" $SCRATCH_MNT/space_file.large >> $seqres.full 2>&1
@@ -44,7 +44,7 @@ for i in 1 2 x; do
seq 1 $nr_blks | while read nr; do
_cp_reflink $testdir/file1 $testdir/file1.$nr >> $seqres.full
done
- sync
+ _scratch_sync
echo "$i: Truncate files"
seq 1 $nr_blks | while read nr; do
@@ -45,7 +45,7 @@ _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file3
seq 1 2 $blks | while read off; do
$XFS_IO_PROG -c "fpunch $((off * blksz)) $blksz" $SCRATCH_MNT/file3 >> $seqres.full
done
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -44,7 +44,7 @@ _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file3
seq 1 2 $blks | while read off; do
$XFS_IO_PROG -c "fpunch $((off * blksz)) $blksz" $SCRATCH_MNT/file3 >> $seqres.full
done
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -45,7 +45,7 @@ _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file3
seq 1 2 $blks | while read off; do
$XFS_IO_PROG -c "fpunch $((off * blksz)) $blksz" $SCRATCH_MNT/file3 >> $seqres.full
done
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -43,7 +43,7 @@ echo "Create files"
_pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
_pwrite_byte 0x66 $((sz / 2)) $((sz / 2)) $SCRATCH_MNT/file2 >> $seqres.full
_reflink_range $SCRATCH_MNT/file1 0 $SCRATCH_MNT/file2 0 $((sz / 2)) >> $seqres.full
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -54,7 +54,7 @@ _scratch_inject_error "free_extent"
echo "CoW a few blocks"
$XFS_IO_PROG -c "pwrite -W -S 0x67 -b $sz 0 $sz" $SCRATCH_MNT/file1 >> $seqres.full 2>&1
-sync
+_scratch_sync
echo "FS should be shut down, touch will fail"
touch $SCRATCH_MNT/badfs 2>&1 | _filter_scratch
@@ -45,7 +45,7 @@ _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file3
seq 1 2 $blks | while read off; do
$XFS_IO_PROG -c "fpunch $((off * blksz)) $blksz" $SCRATCH_MNT/file3 >> $seqres.full
done
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -36,7 +36,7 @@ _scratch_mount >> $seqres.full
echo "Create files"
touch $SCRATCH_MNT/file1
_pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file0 >> $seqres.full
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file0 | _filter_scratch
@@ -43,7 +43,7 @@ touch $SCRATCH_MNT/file1
echo "Write files"
$XFS_IO_PROG -c "pwrite -S 0x67 0 $sz" $SCRATCH_MNT/file1 >> $seqres.full
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 2>&1 | _filter_scratch
@@ -53,7 +53,7 @@ _scratch_inject_error "free_extent"
echo "Remove files"
rm -rf $SCRATCH_MNT/file1
-sync
+_scratch_sync
$XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
echo "FS should be shut down, touch will fail"
@@ -38,7 +38,7 @@ echo "Create files"
_pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
_cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2
_pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file3 >> $seqres.full
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -37,7 +37,7 @@ _scratch_mount >> $seqres.full
echo "Create files"
_pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
_cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -37,7 +37,7 @@ _scratch_mount >> $seqres.full
echo "Create files"
_pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
$XFS_IO_PROG -f -c "truncate $sz" $SCRATCH_MNT/file3 >> $seqres.full
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -39,7 +39,7 @@ _require_congruent_file_oplen $SCRATCH_MNT $blksz
echo "Create files"
_pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
$XFS_IO_PROG -f -c "truncate $sz" $SCRATCH_MNT/file3 >> $seqres.full
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -37,7 +37,7 @@ _scratch_mount >> $seqres.full
echo "Create files"
_pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
_pwrite_byte 0x67 0 $sz $SCRATCH_MNT/file3 >> $seqres.full
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -45,7 +45,7 @@ _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file3
seq 1 2 $blks | while read off; do
$XFS_IO_PROG -c "fpunch $((off * blksz)) $blksz" $SCRATCH_MNT/file3 >> $seqres.full
done
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -39,7 +39,7 @@ _scratch_mount >> $seqres.full
echo "Create files"
_pwrite_byte 0x66 0 $((blksz * blks)) $SCRATCH_MNT/file1 >> $seqres.full
_cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -52,7 +52,7 @@ echo "Inject error"
_scratch_inject_error "free_extent"
rm $SCRATCH_MNT/file1
-sync
+_scratch_sync
$XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
echo "FS should be shut down, touch will fail"
@@ -62,7 +62,7 @@ _cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file3
seq 1 2 $blks | while read off; do
$XFS_IO_PROG -c "fpunch $((off * blksz)) $blksz" $SCRATCH_MNT/file3 >> $seqres.full
done
-sync
+_scratch_sync
echo "Check files"
md5sum $SCRATCH_MNT/file1 | _filter_scratch
@@ -70,7 +70,7 @@ md5sum $SCRATCH_MNT/file2 | _filter_scratch
md5sum $SCRATCH_MNT/file3 | _filter_scratch
$XFS_IO_PROG -c "pwrite -W -S 0x67 $((10 * blksz)) 1" $SCRATCH_MNT/file2 >> $seqres.full
-sync
+_scratch_sync
echo "Inject error"
_scratch_inject_error "refcount_finish_one"
@@ -37,7 +37,7 @@ _pwrite_byte 0x66 0 1 $SCRATCH_MNT/file.0 >> $seqres.full
seq 1 $nr | while read i; do
_cp_reflink $SCRATCH_MNT/file.0 $SCRATCH_MNT/file.$i
done
-sync
+_scratch_sync
ino_0=$(stat -c '%i' $SCRATCH_MNT/file.0)
ino_64=$(stat -c '%i' $SCRATCH_MNT/file.64)
@@ -109,7 +109,7 @@ md5sum $testdir/file3 | _filter_scratch
echo 1 > /proc/sys/vm/drop_caches
echo "sync filesystem" | tee -a $seqres.full
-sync
+_scratch_sync
$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
@@ -94,7 +94,7 @@ md5sum $testdir/file3 | _filter_scratch
echo 1 > /proc/sys/vm/drop_caches
echo "sync filesystem" | tee -a $seqres.full
-sync
+_scratch_sync
$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file1 >> $seqres.full 2>&1
$XFS_IO_PROG -c "bmap -ev" -c "bmap -cv" $testdir/file2 >> $seqres.full 2>&1
@@ -31,7 +31,7 @@ _scratch_mount
$XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/a >> $seqres.full
$XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/b >> $seqres.full
$here/src/punch-alternating $SCRATCH_MNT/b
-sync
+_scratch_sync
echo "Set up delalloc extents"
$XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/a >> $seqres.full
@@ -136,7 +136,7 @@ $DMSETUP_PROG table >> $seqres.full
$XFS_QUOTA_PROG -x -c "limit -u isoft=400 $qa_user" $SCRATCH_MNT
$XFS_QUOTA_PROG -x -c "report -ih" $SCRATCH_MNT >> $seqres.full
-sync
+_scratch_sync
# wait for the push of the dquota log item in AIL and
# the completion of the retried write of dquota buffer
@@ -43,7 +43,7 @@ $XFS_IO_PROG -c 'stat -r' $SCRATCH_MNT/a | grep stat.size >> $seqres.full
_report_quota_blocks "-u $SCRATCH_MNT"
echo "Sync"
-sync
+_scratch_sync
_report_quota_blocks "-u $SCRATCH_MNT"
echo "Chown and check quota"
@@ -36,7 +36,7 @@ compare_quota_to_du() {
# This ensures that we did the quota accounting correctly and that we're
# accurately reporting cow preallocation blocks in stat.
check_quota_du_blocks() {
- sync
+ _scratch_sync
#$XFS_QUOTA_PROG -x -c 'report' $SCRATCH_MNT >> $seqres.full
du_rep=$(du -ks $SCRATCH_MNT | awk '{print $1}')
u_rep=$(report_quota_blocks -u)
@@ -33,7 +33,7 @@ _require_prjquota $SCRATCH_DEV
# Create a directory to be project object, and create a file to take 64k space
mkdir $SCRATCH_MNT/t
-$XFS_IO_PROG -f -c "pwrite 0 65536" -c sync $SCRATCH_MNT/t/file >>$seqres.full
+$XFS_IO_PROG -f -c "pwrite 0 65536" -c syncfs $SCRATCH_MNT/t/file >>$seqres.full
quota_cmd="$XFS_QUOTA_PROG -x"
$quota_cmd -c "project -s -p $SCRATCH_MNT/t 42" $SCRATCH_MNT >/dev/null 2>&1
@@ -28,7 +28,7 @@ $XFS_IO_PROG -f -c 'pwrite -S 0x59 0 1m -b 1m' $SCRATCH_MNT/c >> $seqres.full
_cp_reflink $SCRATCH_MNT/a $SCRATCH_MNT/e
_cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d
touch $SCRATCH_MNT/b
-sync
+_scratch_sync
# Test that setting the reflink flag on the dest file forces the log
echo "test reflink flag not set"
@@ -46,7 +46,7 @@ force_crafted_metadata() {
if [ $mounted -ne 0 ]; then
dd if=/dev/zero of=$SCRATCH_MNT/test bs=65536 count=1 >> \
$seqres.full 2>&1
- sync
+ _scratch_sync
fi
_dmesg_since_test_start | tac | sed -ne "0,\#${kmsg}#p" | tac | \
@@ -91,7 +91,7 @@ test $after_rtextsz_blocks -eq $new_rtextsz_blocks || \
# Create a new realtime file to prove that we can.
echo moo > $SCRATCH_MNT/a
-sync -f $SCRATCH_MNT
+_scratch_sync
$XFS_IO_PROG -c 'lsattr -v' $SCRATCH_MNT/a | \
cut -d ' ' -f 1 | \
grep -q realtime || \
@@ -45,7 +45,7 @@ $XFS_IO_PROG -c "cowextsize $((blksz * 4096))" $destination >> $seqres.full
echo "Fragment FS"
$XFS_IO_PROG -f -c "pwrite 0 $((blksz * 16384))" $fragmented_file \
>> $seqres.full
-sync
+_scratch_sync
$here/src/punch-alternating $fragmented_file >> $seqres.full
echo "Inject bmap_alloc_minlen_extent error tag"
@@ -54,7 +54,7 @@ _scratch_inject_error bmap_alloc_minlen_extent 1
echo "Create delalloc extent of length 4096 blocks in destination file's CoW fork"
$XFS_IO_PROG -c "pwrite 0 $blksz" $destination >> $seqres.full
-sync
+_scratch_sync
echo "Direct I/O write at 3rd block in destination file"
$XFS_IO_PROG -d -c "pwrite $((blksz * 3)) $((blksz * 2))" $destination \
@@ -140,13 +140,13 @@ $XFS_IO_PROG -c 'cowextsize 1m' $SCRATCH_MNT
# Write out a file with the first two blocks unshared and the rest shared.
_pwrite_byte 0x59 0 $((160 * blksz)) $SCRATCH_MNT/file >> $seqres.full
_pwrite_byte 0x59 0 $((160 * blksz)) $SCRATCH_MNT/file.compare >> $seqres.full
-sync
+_scratch_sync
_cp_reflink $SCRATCH_MNT/file $SCRATCH_MNT/file.reflink
_pwrite_byte 0x58 0 $((2 * blksz)) $SCRATCH_MNT/file >> $seqres.full
_pwrite_byte 0x58 0 $((2 * blksz)) $SCRATCH_MNT/file.compare >> $seqres.full
-sync
+_scratch_sync
# Avoid creation of large folios on newer kernels by cycling the mount and
# immediately writing to the page cache.
@@ -156,7 +156,7 @@ _scratch_cycle_mount
# before slowing down writeback to avoid unnecessary delay.
_pwrite_byte 0x57 0 $((2 * blksz)) $SCRATCH_MNT/file.compare >> $seqres.full
_pwrite_byte 0x56 $((2 * blksz)) $((2 * blksz)) $SCRATCH_MNT/file.compare >> $seqres.full
-sync
+_scratch_sync
# Introduce a half-second wait to each writeback block mapping call. This
# gives us a chance to race speculative cow prealloc with writeback.
@@ -53,7 +53,7 @@ fi
echo "Create source file"
$XFS_IO_PROG -f -c "pwrite 0 $((blksz * 256))" $file1 >> $seqres.full
-sync
+_test_sync
echo "Create Reflinked file"
_cp_reflink $file1 $file2 >> $seqres.full
@@ -63,7 +63,7 @@ $XFS_IO_PROG -c "cowextsize $((blksz * 128))" -c stat $file1 >> $seqres.full
echo "Fragment FS"
$XFS_IO_PROG -f -c "pwrite 0 $((blksz * 512))" $fragmentedfile >> $seqres.full
-sync
+_test_sync
$here/src/punch-alternating $fragmentedfile
echo "Allocate block sized extent from now onwards"
@@ -72,7 +72,7 @@ _test_inject_error bmap_alloc_minlen_extent 1
echo "Create big delalloc extent in CoW fork"
$XFS_IO_PROG -c "pwrite 0 $blksz" $file1 >> $seqres.full
-sync
+_test_sync
$XFS_IO_PROG -c 'bmap -elpv' -c 'bmap -celpv' $file1 &>> $seqres.full
@@ -35,7 +35,7 @@ swap_and_check_contents() {
local b="$2"
local tag="$3"
- sync
+ _scratch_sync
# Test exchangerange. -w means skip holes in /b
echo "swap $tag" >> $seqres.full
@@ -55,7 +55,7 @@ for ((n=0; n<nfiles; n++)); do
write_sync_file $n > /dev/null 2>&1 &
done
wait
-sync
+_scratch_sync
for ((n=0; n<nfiles; n++)); do
count=$(_count_extents $workfile.$n)
@@ -58,7 +58,7 @@ for ((n=0; n<nfiles; n++)); do
write_extsz_file $n > /dev/null 2>&1 &
done
wait
-sync
+_scratch_sync
for ((n=0; n<nfiles; n++)); do
count=$(_count_extents $workfile.$n)
@@ -58,7 +58,7 @@ for ((n=0; n<nfiles; n++)); do
write_direct_file $n > /dev/null 2>&1 &
done
wait
-sync
+_scratch_sync
for ((n=0; n<nfiles; n++)); do
count=$(_count_extents $workfile.$n)
@@ -45,7 +45,7 @@ $here/src/punch-alternating $dir/a
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/b >> $seqres.full
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/c >> $seqres.full
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
-sync
+_test_sync
# Inject a bmap error and trigger it via exchangerange.
filesnap "before commit"
@@ -38,7 +38,7 @@ _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
$XFS_IO_PROG -f -c 'truncate 1m' $SCRATCH_MNT/b
_pwrite_byte 0x59 64k 64k $SCRATCH_MNT/b >> $seqres.full
_pwrite_byte 0x57 768k 64k $SCRATCH_MNT/b >> $seqres.full
-sync
+_scratch_sync
md5sum $SCRATCH_MNT/a | _filter_scratch
md5sum $SCRATCH_MNT/b | _filter_scratch
@@ -33,7 +33,7 @@ _scratch_mount
# Create original file
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
-sync
+_scratch_sync
md5sum $SCRATCH_MNT/a | _filter_scratch
# Test atomic scatter-gather file commits.