]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
fstests: use syncfs rather than sync
authorDave Chinner <dchinner@redhat.com>
Tue, 26 Nov 2024 20:48:41 +0000 (07:48 +1100)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Dec 2024 14:05:46 +0000 (22:05 +0800)
sync(1) is a system wide sync and is implemented by iterating all
the superblocks in the system. In most cases, fstests require just
the filesystem under test to be synced - we require syncfs(2)
semantics but what we use is sync(2) semantics.

The result of this is that when running many concurrent fstests at
the same time, we can have *hundreds* of concurrent sync operations
in progress (thanks fsstress!) and this causes excessive
interference with other tests that are running on other filesystems.

For example, some tests try to specifically control extent layout
via specific write and fsync patterns. All these global syncs
perturb them and cause them to spuriously fail.

A random snapshot of running concurrent tests shows just how many
tests are explicitly blocked in sync(1):

check-parallel───check───077───077─┬─cut
      │                                    ├─du
      │                                    └─tail
      ├─check-parallel───check───311───xfs_scrub───{xfs_scrub}
      ├─check-parallel───check───531───128*[t_open_tmpfiles]
      ├─check-parallel───check───227
      ├─check-parallel───check───388
      ├─check-parallel───check───070───fsstress───fsstress───{fsstress+
      ├─check-parallel───check───232───fsstress───7*[fsstress───{fsstr+
      ├─check-parallel───check───648───sleep
      ├─check-parallel───check───409───sync
      ├─check-parallel───check───683───sync
      ├─check-parallel───check───013─┬─013───sleep
      │                              └─fsstress───2*[fsstress───{fsstr+
      ├─check-parallel───check───684───sync
      ├─check-parallel───check───673───sync
      ├─check-parallel───check───118───dd
      ├─check-parallel───check───467───open_by_handle
      ├─check-parallel───check─┬─622
      │                        └─check
      ├─check-parallel───check───685───sync
      ├─check-parallel───check───049───fsstress───fsstress───{fsstress+
      ├─check-parallel───check───599
      ├─check-parallel───check───426───open_by_handle
      ├─check-parallel───check───057───umount
      ├─check-parallel───check───390───fsstress─┬─18*[fsstress───{fsst+
      │                                         └─fsstress
      ├─check-parallel───check───158───fsstress───fsstress───{fsstress+
      ├─check-parallel───check───017
      ├─check-parallel───check───032───fsstress───fsstress
      ├─check-parallel───check───076
      ├─check-parallel───check───477───open_by_handle
      ├─check-parallel───check───170───2*[170───170]
      ├─check-parallel───check───112
      ├─check-parallel───check───686───sync
      ├─4*[check-parallel───check───check───xfs_scrub───{xfs_scrub}]
      ├─check-parallel───check───387───xfs_io───{xfs_io}
      ├─check-parallel───check───615───615
      ├─check-parallel───check─┬─051
      │                        └─check───xfs_repair
      ├─check-parallel───check───049
      ├─check-parallel───check───247
      ├─check-parallel───check───674───sync
      ├─check-parallel───check───040
      ├─check-parallel───check───560───fsstress───fsstress───{fsstress+
      ├─check-parallel───check───030─┬─030─┬─030───xfs_repair
      │                              │     └─030───perl
      │                              ├─sed
      │                              └─uniq
      ├─check-parallel───check───055───055
      ├─2*[check-parallel───check───check]
      ├─check-parallel───check───042
      ├─check-parallel───check───204
      ├─check-parallel───check───271─┬─271───sed
      │                              └─md5sum
      ├─check-parallel───check───091─┬─fsx
      │                              └─tee
      ├─check-parallel───check───063───sleep
      ├─check-parallel───check───026
      ├─check-parallel───check───459───lvm
      ├─check-parallel───check───495
      ├─check-parallel───check───141───fsstress───4*[fsstress]
      ├─check-parallel───check───011─┬─fsstress─┬─fsstress───{fsstress+
      │                              │          └─fsstress
      │                              └─sleep
      ├─check-parallel───check───328───sync
      ├─check-parallel───check───507───507
      ├─check-parallel───check
      ├─check-parallel───check───687───sync
      ├─check-parallel───check───109───mkfs.xfs
      ├─check-parallel───check───324
      ├─check-parallel───check───114───aio-dio-eof-rac
      └─check-parallel───check───503───xfs_scrub───2*[{xfs_scrub}]

There are ~10 sync(1) calls blocked and at least half of the 50-odd
fsstress processes currently running are also going to be stuck in
sync(2) calls.

They are stuck because the superblock iteration has to wait for
mount, unmount, freeze, thaw and any other operation that locks a
superblock exclusively. When running dozens of tests concurrently,
there can be tens of superblocks that are locked exclusively for
every second for significant lengths of time.

Hence the use of sync has impact on both performance and test
behaviour and we need to minimise the amount of sync(1) and
sync(2) usage as much as possible.

Introduce _test_sync() and _scratch_sync() so we can implement
a syncfs mechanism with a fallback to sync(1) if it is not supported
without dirtying all the test code unnecessarily. Then convert
fsstress to use syncfs(2) in preference to sync(2).

This commit changes all the generic and XFS tests to use the new
sync functions, other filesystem specific tests will eventually
need to be converted to avoid similar problems.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
208 files changed:
common/encrypt
common/log
common/quota
common/rc
common/repair
common/report
common/verity
common/xfs
ltp/fsstress.c
tests/generic/015
tests/generic/029
tests/generic/030
tests/generic/032
tests/generic/034
tests/generic/039
tests/generic/040
tests/generic/041
tests/generic/048
tests/generic/049
tests/generic/051
tests/generic/054
tests/generic/057
tests/generic/059
tests/generic/065
tests/generic/066
tests/generic/073
tests/generic/090
tests/generic/092
tests/generic/098
tests/generic/101
tests/generic/104
tests/generic/106
tests/generic/107
tests/generic/150
tests/generic/151
tests/generic/152
tests/generic/157
tests/generic/158
tests/generic/159
tests/generic/160
tests/generic/171
tests/generic/172
tests/generic/173
tests/generic/174
tests/generic/204
tests/generic/247
tests/generic/250
tests/generic/252
tests/generic/265
tests/generic/266
tests/generic/267
tests/generic/268
tests/generic/271
tests/generic/272
tests/generic/273
tests/generic/274
tests/generic/275
tests/generic/276
tests/generic/278
tests/generic/279
tests/generic/281
tests/generic/282
tests/generic/283
tests/generic/315
tests/generic/317
tests/generic/318
tests/generic/325
tests/generic/328
tests/generic/329
tests/generic/330
tests/generic/331
tests/generic/332
tests/generic/335
tests/generic/336
tests/generic/341
tests/generic/342
tests/generic/343
tests/generic/347
tests/generic/348
tests/generic/353
tests/generic/376
tests/generic/382
tests/generic/387
tests/generic/391
tests/generic/409
tests/generic/410
tests/generic/411
tests/generic/416
tests/generic/422
tests/generic/425
tests/generic/461
tests/generic/474
tests/generic/479
tests/generic/480
tests/generic/483
tests/generic/489
tests/generic/502
tests/generic/505
tests/generic/506
tests/generic/507
tests/generic/508
tests/generic/510
tests/generic/520
tests/generic/526
tests/generic/527
tests/generic/535
tests/generic/546
tests/generic/556
tests/generic/579
tests/generic/589
tests/generic/599
tests/generic/610
tests/generic/628
tests/generic/629
tests/generic/640
tests/generic/673
tests/generic/674
tests/generic/675
tests/generic/677
tests/generic/683
tests/generic/684
tests/generic/685
tests/generic/686
tests/generic/687
tests/generic/688
tests/generic/690
tests/generic/694
tests/generic/695
tests/generic/703
tests/generic/716
tests/generic/718
tests/generic/719
tests/generic/721
tests/generic/725
tests/generic/726
tests/generic/727
tests/generic/735
tests/generic/738
tests/generic/745
tests/generic/746
tests/generic/747
tests/generic/749
tests/xfs/016
tests/xfs/052
tests/xfs/110
tests/xfs/118
tests/xfs/119
tests/xfs/128
tests/xfs/133
tests/xfs/134
tests/xfs/161
tests/xfs/176
tests/xfs/195
tests/xfs/201
tests/xfs/212
tests/xfs/227
tests/xfs/231
tests/xfs/232
tests/xfs/234
tests/xfs/236
tests/xfs/237
tests/xfs/239
tests/xfs/240
tests/xfs/241
tests/xfs/243
tests/xfs/246
tests/xfs/265
tests/xfs/272
tests/xfs/274
tests/xfs/276
tests/xfs/291
tests/xfs/309
tests/xfs/312
tests/xfs/313
tests/xfs/314
tests/xfs/315
tests/xfs/316
tests/xfs/317
tests/xfs/318
tests/xfs/319
tests/xfs/320
tests/xfs/321
tests/xfs/322
tests/xfs/323
tests/xfs/324
tests/xfs/325
tests/xfs/326
tests/xfs/327
tests/xfs/420
tests/xfs/421
tests/xfs/423
tests/xfs/438
tests/xfs/440
tests/xfs/442
tests/xfs/511
tests/xfs/519
tests/xfs/520
tests/xfs/541
tests/xfs/553
tests/xfs/558
tests/xfs/607
tests/xfs/617
tests/xfs/629
tests/xfs/630
tests/xfs/631
tests/xfs/790
tests/xfs/791
tests/xfs/792

index d90a566ac134794de7957ee73c29c5d9c9f4c3c2..52f23cd0a455ae366f132559d923e65fdb83d7b1 100644 (file)
@@ -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/,$//'
index ea7e4158e59f440a24d6f9e59f67619a4f4be915..ab7bc9f8733e2888fe73b987b10f58c6f82f7456 100644 (file)
@@ -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
index 3bf7d552eecc0700e026de9ae963781a95c6e407..e87489192a9a0c5dcc6289473d114ff3d618abcc 100644 (file)
@@ -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
index 16c3cf53a925a4d4506d876c93249faad958ecac..2442ef2eec42874e94b05c40c4f7f9794a300a5f 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -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
index 8945d0028c47a4d16c4b64407398c01a1bab3efc..0dae830520f1e9b586d26a069ac120ecd6efcadc 100644 (file)
@@ -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
 
index 0e91e481f9725a9d566d2d48e6ccedf6afe50b14..7128bbebac8b75c903001872a0e5834ba0c89d76 100644 (file)
@@ -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"
 }
 
index 59b67e12010a48b3fe12986522afaf98f78f28ad..11e839d2e7dfcf54eadf66ccdcf6d4a622b5378b 100644 (file)
@@ -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 ) ))
index 68abfa71d8552f3e79ab1b59f8d7bb919cf6c479..0417a40adba3e2520d8e38c4cd45842943bc3779 100644 (file)
@@ -1087,7 +1087,7 @@ _scratch_xfs_unmount_dirty()
 
        rm -f "$f"
        echo "test" > "$f"
-       sync
+       _scratch_sync
        _scratch_shutdown
        _scratch_unmount
 }
index a6840f28c90d82eade51bbf4ba516e808a423157..8b8c9035f6fb5a204b24726a1ccb1b723e1f9430 100644 (file)
@@ -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);
index d4f81c7f62c44936e064b3a7a92786461150c6af..3cbb2f2d0374a46dc006b889c0356b64a7b83478 100755 (executable)
@@ -85,7 +85,7 @@ fi
 
 echo "check free space:"
 
-sync
+_scratch_sync
 
 free2=`_free`
 if [ -z "$free2" ]
index 0af46e8920fb0f088407a165a38c0bccc7e426c1..c6162b0b4f7a835268c3ccf112798729b86af72c 100755 (executable)
@@ -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
index 3f0e5b99350ce5bd43fd92ac56a82290410918ad..b1b51469c1ee9455c03200f1c2ab842648e02f90 100755 (executable)
@@ -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
index 63abd62a8c3bd2b24bd1d91e454ad86ceb0e8d43..30290c7225a2fa88504483cec486fd40d4dcd634 100755 (executable)
@@ -29,7 +29,7 @@ _cleanup()
 _syncloop()
 {
        while [ true ]; do
-               sync
+               _scratch_sync
        done
 }
 
index 71aae2a0172efe6eeec84e3c623a305cabfe8310..cd22f330d77c95942a147178b04f41fec389e4c4 100755 (executable)
@@ -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
index 5162e85b03f43cb456de23a31de5a22058b67018..00d4e4afb5fc60b3c55d1633e0b916d615d38a0e 100755 (executable)
@@ -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
index eb88e9eedcd53ac43f355155f02396cbe3d3cb7b..8b4e3b703a4e4f6041e000a4b5d3ec1b9b18ad29 100755 (executable)
@@ -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.
index 447013689b8cec173b83c83863e0b87589ef4f15..6d42d1a283103caf9cf36b84e41fe3b44b418fc4 100755 (executable)
@@ -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.
index 7b28cb053b48c9d880977d9ede7755313110d5a2..5c554d501b5ff5b84b2cebf50fa69f564b1ad5e2 100755 (executable)
@@ -69,7 +69,7 @@ do
 done
 
 # sync, then shutdown immediately after, then remount and test
-sync
+_scratch_sync
 _scratch_shutdown
 _scratch_unmount
 _scratch_mount
index 8e4b99565f44a9c21f142c1b360939558ba8c198..94b5afe9686e359a3e90111ae42b8f8aa4bab5ca 100755 (executable)
@@ -66,7 +66,7 @@ do
 done
 
 # sync, then shutdown immediately after, then remount and test
-sync
+_scratch_sync
 _scratch_shutdown
 _scratch_unmount
 _scratch_mount
index 69250cde6b38d89ac9e543a38f3197b3728f6bfa..5ee4dfdbad70be0099c0a1520c0735b8100b60ac 100755 (executable)
@@ -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
index 20e9a1e967d6dd50b07a074db77cc823ab992aa6..0649b25930c6a523b732a28e315058d16f51cb24 100755 (executable)
@@ -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
index c92af5ddbfd47771835503ae8e73ecf5c6daf9c0..c5db80977b4dafbc7dead2e1bcde5629704b4d20 100755 (executable)
@@ -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" \
index 0d3270787aa7e13a00031ba5580bc1212f4f73f4..db48de3786003a798f22d36d5e0a650f5ca3a007 100755 (executable)
@@ -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.
index adf55b7500a6cdd0755d0a95e4a37641d1ef2371..f7e1e276f5a450fb305dda6dbd2f8dfd04eab54e 100755 (executable)
@@ -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
index e32e9658bd87ce674b3ac9d5698b803aab7dd2d3..37d04e069e280b3ca04037c55467ad208bc220d4 100755 (executable)
@@ -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
index 5ebf634fa42fa7ce91073058ceee7165defb25ba..05df1ea87dce43f3f4f5bbfe1d35f6c5433078bf 100755 (executable)
@@ -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
index 36a9ee865a1bcf472ad16de24d228eafc0c6cb85..b1ea27bbd287a4787970d9177bd579e02830c608 100755 (executable)
@@ -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
index d8c223270a9e4963f166f9369a08f64a74164100..3a61f00f7c0d990671637e6cbfe5dfc2c131c9bc 100755 (executable)
@@ -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
index 57de42e9ce7b9ab4bed1133eac89c877419d125c..ff6cf908eb2a634a692dee9b23c90373d1dd7d4b 100755 (executable)
@@ -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
index 2e954357917eba051c8178a741a59f5fe6fd8b03..4295f080130d59d6b036a8ad2e5b32fd552cf0e2 100755 (executable)
@@ -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
index 7f294e1b6e60da06015b51ed209d8006838ad973..9af3b5582e96380d843f2d4aa38c129f4450ca80 100755 (executable)
@@ -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.
index 2b89ae69aec349c20b107ef6dd97d7e7510fb5e4..8bcc7575e1f6c1622ec73ed5b9bb51a331eda530 100755 (executable)
@@ -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.
index 177ca59c502414feca0dc67b623f1e99be88e06b..8a82d146880ddc7e3b98b416398509e9e4128a13 100755 (executable)
@@ -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
index 159a53c4deb86ed1753161c1e09b37ea0d0639c3..d9a53a5b1ee953716cf8b1635515ddedec8335cb 100755 (executable)
@@ -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"
index a335b9273e021d1723dbdba5bf5f3350d6f12e42..d20477ab3ffd0d4913467004cb2b05528ca14f7d 100755 (executable)
@@ -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
index 8d87dbac73896b7a0b13dfe52bf74ba0ec1138b9..afcbd6d9353f850aac0cd339466ad4bb25bf862b 100755 (executable)
@@ -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
index cb9143673f95c265fc5b80eaa154a33a0845e4d1..24415937cf938788bc3d54db38448743970e325a 100755 (executable)
@@ -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'
index 171d3c0dcf279e8c135f43c22392416783de184d..ccee3690aecf39169c7c9a96030498576a8801d3 100755 (executable)
@@ -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 | \
index c4dec17ca0982b77365c6af30c07efa63809c972..a2d20622a0544de868482f81cb85e5a8e5bb7d84 100755 (executable)
@@ -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()
 {
index fc7a161e1546b8f785cadf966bcfd54b9fdf2fa3..c1f24ddbba926eb07a3824c1ec8f6282dc3d98d2 100755 (executable)
@@ -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()
 {
index dd56aa792afbd58d4c48f79018a139bc5abb2a58..5c8504d26c679fa3a52397aac4403379155eb2e4 100755 (executable)
@@ -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 | \
index c23a122845546403dbe400f4f22d85813da04d90..17f817805389c0261188dbf4384138fa71fdc5b7 100755 (executable)
@@ -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 | \
index 8df3c6df21b29c55f6b0720e3ada4a4413f30769..d7ac7b15d171553b1cbd4c1257f856864d4b82c9 100755 (executable)
@@ -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)"
index b9c292071445fe74d08a58b0e059546ce83df196..c7c62001dbb3b22dcf830747c8a05bff89ff50f1 100755 (executable)
@@ -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 | \
index 9ef54e2390724f0569d8ea7b9b487cbdc0225ff1..39483a09a2f596e6b9714e5a502ca0e2f36e991a 100755 (executable)
@@ -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
index 47ff5c3431073304b6fdda1ead930d223634c56c..a758ae24cc9dcc15d12f83b10e82f696c1daa109 100755 (executable)
@@ -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 &
index 196a34bb073b9e4f4bc46dc4d1a0a9c1f9d1d5d0..605d7c8ade3dd5f47b48dabefeccdbeef077545f 100755 (executable)
@@ -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
index 3ee2b0a673acffedd628bda4aa2ef4c12bfc48eb..ddf950e34193fc2c6e524561c5df7c4d38afd740 100755 (executable)
@@ -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
index 3c84e2a84828922adfcb0f0ff154454df15761cc..0f165e7e64ff4920257f0704908dfd0c532b6baf 100755 (executable)
@@ -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)
index d5675afbc7227baa3109471ce5b4108c96070df7..02e290de5572df65fa12671584fbd8ca9d60b0fd 100755 (executable)
@@ -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)
index ddaf1064caa198393562cdef9d60097123198b1e..48b1981f10ea3a860c1eb553b9bd03927684011b 100755 (executable)
@@ -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
index c6068cf4ebacf88066b172529752ab41fa772549..f46e0b75599cf0240405a7e977e254335f696e55 100755 (executable)
@@ -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)
index ce647d1550ca29741909cb3568ee0bd073da36d0..854ea1021116252393a8d1186fe574210934ae7a 100755 (executable)
@@ -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
index 3d2cace9ff147fc8c3976b603a2d6340d6ac6807..bc77365df63b5033ddd4d6914419cc03dcf647e0 100755 (executable)
@@ -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
index e0ee0483aed6818a666a677dbbb865d33b81f2c4..5100e848be5d4d295b8c058f04c1067420078e39 100755 (executable)
@@ -92,7 +92,7 @@ _porter()
                echo "_porter $_suffix not complete"
        fi
        
-       sync
+       _scratch_sync
 }
 
 _do_workload()
index d526a9b710273adbbb1124f71d24a4b5e8bebea1..916c7173cf2882185f4d0936684d36f7ad4492c0 100755 (executable)
@@ -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"
index 57de69b803c99485d210717c32c6bd3e418f83d0..fbfe158163f3363d527ad70dfe74238e4a20ceba 100755 (executable)
@@ -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}'`
index 3c3e75df60d74feaff30037de9518f7547656322..dfd2888ce36944c0de26cf99da9482e5c765eb0d 100755 (executable)
@@ -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
index 5d9778f9f39e7c9922d202dca1314a21e23fef50..e303a74cee8d5581310cc5cd2e5f435af2f2b99e 100755 (executable)
@@ -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
index f4dac950c755df0ec3281fa5c1efa6729843b073..599b4b6dc08a830e4e54534b9b224f89e37ffcb3 100755 (executable)
@@ -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.
index 6d48c4b14a45e1937f3606429df6cb05297f3262..474b8b73a193971cbdf0661f57bdf1deb5fbde3e 100755 (executable)
@@ -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.
index b3eb4806379e9802d5e71d0ca2c7b9027d79ddf2..7279781302a48012ec0a74a7ba80b63a8a273e75 100755 (executable)
@@ -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.
index b9104fe64921d97fa94391b29fe6f623ab996028..cdad47a24d0b0d52354091b99b9d34b1917139db 100755 (executable)
@@ -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.
index 83f46655ff25039956387d7cce0bf91f706e7d88..cb660ed2d7a41bde6581f27f6608e699ee5a7df7 100755 (executable)
@@ -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}'`
index 177d885251961dc4ffaed96ad2e42141acf5c7fa..1afec6a75716642c79501b0fb0770f25d04ecf15 100755 (executable)
@@ -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
index d31ad2b13780155e67dab588320152fe6e01d754..033c0611cc4ea336dc0612bd2fedbdcca0e261eb 100755 (executable)
@@ -81,7 +81,7 @@ _print_getfacls
 
 echo "*** Remounting ***"
 echo ""
-sync
+_scratch_sync
 _scratch_cycle_mount      >>$seqres.full 2>&1 || _fail "remount failed"
 
 _print_getfacls
index 8fbd0d1d9e10f35692d2525d3fe1896a674428b4..f850663377b016bed33e2548bf205d3b0b9923bc 100755 (executable)
@@ -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
index 25e1f2a021872f0aa6c7a5b93f6b933096762530..7071ded259ddb372cef196d59ac7877cefd3d85e 100755 (executable)
@@ -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
index ab37e047f7012c3dc5825f0ad5ebbe36058b2fbb..e4300f92ce0da44b80fb79a4f473a69e811258a6 100755 (executable)
@@ -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
index 4fa81f9913ee7e4e7d691d746e9572730f347962..c67defc48ad70a8d4626b6875460da5955a8be39 100755 (executable)
@@ -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
index c1949e1b94c172b3f002aed6ad0fc9adc524160a..fe12ec4ebacdf574482752d8065226d1555d8966 100755 (executable)
@@ -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
index 4a61e4a02a7cdccf3e4c48a5bb020e931b049fd1..cb15e77bdbb0d0c3d9d82d2de72909e8d6fd9e0c 100755 (executable)
@@ -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
 
index 280cf8538410709111c615fda6e9ab496596e72f..f287b5150a399e86624f542ba1c09d7ca65c8019 100755 (executable)
@@ -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/
index 4780819787303e47710d8a11738503eae722e307..06391a93fb00ae71cb2fc436e9814cbae7774d03 100755 (executable)
@@ -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
index bea36e26547e1c8536b59ae87965c3131ada1ad3..80fdcbac7a4327aee203a28dbb7b5ceca20967a3 100755 (executable)
@@ -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
index 3f5aca673d737729baff71c382362458be7f332f..a7aca860b9a8acf359e975ab26566afbf489f803 100755 (executable)
@@ -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.
index 6659f19882745bd444f599f43c31a09f2d8453d6..97ff4f984258a1d6c31ea6f607cb8d74f4cd9843 100755 (executable)
@@ -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
index 7e1ea5d90bba456798282596c8ff4c7bd8a3a965..5c0e3f94958524ef2585b18f173ab915f61052ca 100755 (executable)
@@ -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
 
index eb0587d20d320ba5e39de957ba15e4a3f2457bbf..1905a6e6a7eacd479671c8b182f4a6b0ef0c5459 100755 (executable)
@@ -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
index ac5b978802b6a0e7be045ea28de5872791440e15..2114a74cb9db69b9d99fe16d02e4a90131a09c3f 100755 (executable)
@@ -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
 
index cecd4e0d7e9881e6e78bb9ecaa84115b6ca90bb7..17a5f290bed659a0d453e5ae7bb732b0068a3852 100755 (executable)
@@ -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
index 162da41d47964144dfeae47dfadc6d9aa86940ec..1634d85d24b037438200c82bdeac81a08444570a 100755 (executable)
@@ -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
 }
index 544e7552ad7b575958bf92543385926e7a3d2f36..c3b972496b9e7da67af0729d2b631dc237afec54 100755 (executable)
@@ -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
index d19c48262a89375c8a29f9fae43abb49a75235d8..e41f644d3e5d851716d643f524afd647666a743f 100755 (executable)
@@ -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"
index ab7e7eb55973f584d78bfda650ce27820ed56a5d..ac1b14ad60f7233be4efa781db79d15beb77272d 100755 (executable)
@@ -58,7 +58,7 @@ fs_stress()
                       -f getdents=1 \
                       -f fiemap=1 \
                       -d $target
-       sync
+       _sync_fs $target
 }
 
 # prepare some mountpoint dir
index f0f0921be264b0f443861c1209ae3465a4d3e6a6..e0d0c57eba2950f4884bfba22a4bfb5fe518580f 100755 (executable)
@@ -66,7 +66,7 @@ fs_stress()
                       -f getdents=1 \
                       -f fiemap=1 \
                       -d $target
-       sync
+       _sync_fs $target
 }
 
 # prepare some mountpoint dir
index 3b55b4f9160952589a3cfc3397a49cfc53f629d4..0a80554cd4d3b9a8526d2c6ac95679f189ce6bdd 100755 (executable)
@@ -49,7 +49,7 @@ fs_stress()
                       -f getdents=1 \
                       -f fiemap=1 \
                       -d $target
-       sync
+       _sync_fs $target
 }
 
 # prepare some mountpoint dir
index 31a85c83f3f5cae8bde9eb846fb73c9ee2033845..f6a516fb6da68e018e27b48ed36c00d4ef754d2a 100755 (executable)
@@ -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.
index 71a0e5a8628672177d8b7a31ef2673247657810a..ad37b9ceaf56ecde547cdfa054837e465d0d835a 100755 (executable)
@@ -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.
 
index 3367a9567f8be497f71d3eba08443fa58d431c9a..352ae32d2c21fe0ff78c9fab27f99b485902bcb6 100755 (executable)
@@ -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)
index 95dd6a34dd37a710133433304cb6822ed6dd7c11..a2927f85e5e75f3e14eb5b4be5437bd9a8e74ca8 100755 (executable)
@@ -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
index 2fa087a87c18b5b4a1288ebbdac367e9cea28764..961d0f06f3d07332b59be68528bd1df90ebce12c 100755 (executable)
@@ -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
index 7f4aab4e71838b57b0092db2ecb18100fd984229..650c921b8fdc808dece92f65681bbafd61fb6f5b 100755 (executable)
@@ -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".
index 975c990ff4b06833099aab981b40f2ea6af43a3e..6c599446b5e527d2c706ad30ae6c62aa7be3172b 100755 (executable)
@@ -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.
index 60f9b10979bff52f1f1c4f97eba53ff29d739abf..a71f96ad0dc1aa86ce8bbeed65548072e2ef8dcf 100755 (executable)
@@ -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"\
index 62aa45a863e7f0f3eb7f7fda330a39b41804ecd7..e76055fa4436bb548e1d8e215b227e4711cae204 100755 (executable)
@@ -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" \
index f6374f677f6c3d4f9addefe80830302d4d9ffd2b..f488bd06c7a8658fd986a495cb55f0b1dbdee53e 100755 (executable)
@@ -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).
index a259673529229e716628b1fcf414227869b9dbfb..eb44573b417d09ebdd66a479da1f73af72604071 100755 (executable)
@@ -40,7 +40,7 @@ do_check()
        touch $testfile
 
        if [ "$1" == "sync" ]; then
-               sync
+               _scratch_sync
        fi
 
        chown 100 $testfile
index 9a41e5634fa44740b286223d723e23293cea9466..397e93d0774aaf8dee2cfb3150df43dd7cf76ef7 100755 (executable)
@@ -45,7 +45,7 @@ do_check()
        touch $testfile
 
        if [ "$1" == "sync" ]; then
-               sync
+               _scratch_sync
        fi
 
        $XFS_IO_PROG -x -c "chproj 100" $testfile
index 6678e50f7ecd9f1e9643785f40962bff26e56269..b9e58067e6f22ef1953962845c33d833f1947896 100755 (executable)
@@ -59,7 +59,7 @@ do_check()
 
        if [ "$2" == "sync" ]; then
                echo "sync" >> $seqres.full
-               sync
+               _scratch_sync
        fi
 
        echo "Test chattr +$1" >> $seqres.full
index 4e234160dd6b5be7e7bc29bf40b16619340b73f6..02023cf08b06e5cbdd2ea2373c36dd936104f18d 100755 (executable)
@@ -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`
index 5ea0e067713759a50ddb900fe00a323297f8e283..abf18f1bfee41faa01d4cec833f53d221d93d36a 100755 (executable)
@@ -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
index 00fa050e208d6f97b700f20857eb965c0d1ff688..f2523fca27f265d58ab5838041a6e01d6bfca19d 100755 (executable)
@@ -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
index 7d47cf111e8e60521271df0c628b84372f6cfc3f..af77ccaff32bad7144d6af35f58db1378f0054c7 100755 (executable)
@@ -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
index 2ba1f319b89a1e2a879b4053cd8fe10812890830..90555077f0071287b6922de0e4abc0545ab2b07f 100755 (executable)
@@ -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
index c2338da6b5e6ba28442072980ee5ae24c3989a07..98e2f2384a641a3e4261061322063d360725b47c 100755 (executable)
@@ -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"
index 972886858aaa211b9e2969b96d0b3149798d88d3..ab4ea657ee00d88d071736eed1e52bac90f10ab8 100755 (executable)
@@ -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
index d3396ae3bf146536890af0fd4c772c05fca205f7..279ff58b3d27d7ed1f6ad0e52b90ad92e3c8b302 100755 (executable)
@@ -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
 }
index 4187ab0f05433aa9992d4f43a940a33f505b118f..d5fab4892e9ae331f776ec1a49e69558736128f3 100755 (executable)
@@ -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
 ) &
 
index 969a8ac61a53063dcce2a32359d83c24b741d98b..b5860070b80e898ca791a25efe7ca6f942e0ad56 100755 (executable)
@@ -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
index e1454584f77beb7a88d8ca175b9ea7109883d3c9..a8eb937095c2bed25119eb5e02fa56a5b1c29f54 100755 (executable)
@@ -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.
index 22f28c6df021100e83331594c3cd7d8db8e6491c..00a676e6e7e7b935dd66b5ae72f10bcee255c3a0 100755 (executable)
@@ -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
 
index 8fd44364c96b8c4e365199bdfe8841c143d6de11..6f891abc2f6ff8f647c07542ccbf92451aaea965 100755 (executable)
@@ -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
index 92b7839a075e730cfbd5e276db0925cac61d0ebf..1088e50e40eb0a06efb203b9c221dc11ff64391d 100755 (executable)
@@ -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
index 038dde975056d143d3c25e52ef5d684e3642bfe2..c3b33746e669dbf765b3e7df3f32f089bb7d9c70 100755 (executable)
@@ -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
index 1230b51e1df918336ab1f1d7581fd3948e06f56c..8f6def9c78881aafc9f8e03274a7a429a2bd9910 100755 (executable)
@@ -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() {
index 2e395290a0df728f551997e2f52ba15096226b18..1b711f27f39ed1b8abcc8cc36405fd20a77ecb17 100755 (executable)
@@ -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() {
index 7c062db8161ca774d84ebbfa1697885823af0c10..e66de84b546a25565af37be52f9da4de1eed538e 100755 (executable)
@@ -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() {
index f2081c34c6babaca5f67c301c4c61a27c93ffd57..86099454ff39bf48de199a8a61e4a6b5fe670159 100755 (executable)
@@ -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
index cf1ebbc44897fd78757ffbb6cf9bd207fa33ca3a..cc9a9786bde4bf85f5ebdd4768d332aa52dab164 100755 (executable)
@@ -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() {
index e1eb4e1187ee9b75f47b5438d5181d29d0722bb0..2ca036fe518050952bd3825c39caa96b103cf321 100755 (executable)
@@ -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() {
index bec2c5a0b2efbd1520dc6de3b277728f25f3adaf..de07a798a68594a43a3fb9ec6c9b8ff4cc87c3cb 100755 (executable)
@@ -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() {
index efcc3f6100992661f9c6b2fa984fb418547f0005..fc6761fe61a91e26679e14f43f4ee08c6cd98f3c 100755 (executable)
@@ -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() {
index e05f0fdcd671d6a9167d38ea2c642c15b8031b9e..82dce88b85ef6d1005c66cef9d134a6f2b555243 100755 (executable)
@@ -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() {
index 9c19356d80cb17fc978d4fedbe4ec3e9588f00c8..e491d5cf30af235e977e85b1fd1f12a2d18045d3 100755 (executable)
@@ -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() {
index ba0da30d3bf40da1711ecc3e58c613196699a0f5..ef5bd1983cef3d8a3cccc6e783030fc45f5eca19 100755 (executable)
@@ -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).
index a68fc5230405cb8f4a9a7bc9c0765946df4da3de..e5c4f88c5277cf93433bd8cf339e31fb578b6a29 100755 (executable)
@@ -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`
 
index 8179d59a0244c59067cb04b5cf8fbcfaae3dc045..df81fdb7fea8f9ede1f84aa7549c283aaa3457a8 100755 (executable)
@@ -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:
 #
index 8ee1d558c95ced7326b5a3f5b105c9d44ba00128..2bace19d6f06507d1df5fe7600dcb2c0c51063e3 100755 (executable)
@@ -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
index a2b86225a3cd32f96169bf679f4978a0d32e7e7b..d3923dc1d4356684bd99343e5cb84aad04ddf9de 100755 (executable)
@@ -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
index ed3a1fee562f5c9db494a6cfc4863f270a906fc2..4d322b2241dd21607bab569367072d7429b8a6fa 100755 (executable)
@@ -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)
index c82cf9552747d1cccb0c58f832f5c3709c9e7f49..9cd6eed919250b1ec3019eabedd390849ce3b1d1 100755 (executable)
@@ -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
index 98505aac97f4c6220b77cf1942568cb553f5240c..a9565f1891783112afac34d132ed39aaf75bc485 100755 (executable)
@@ -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
index e1db83b5ee889a7d101a97ffc3dd02fdb83e92e0..3a9005ddfbbcc8a7d21ce663b242c39fe7df009d 100755 (executable)
@@ -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.
index 00071b1d0fdac561acf693c3baaac2f06de40b77..131ac5b503e1a41601cc5c66e19408d5132a2b29 100755 (executable)
@@ -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() {
index dbed1d45c406c42239d096929500305bfde851cb..ee7ed9760a165ad865740318a44992d714872486 100755 (executable)
@@ -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() {
index 1aeeb9a422d422d1f5a0164bd0e1f08896b6413a..9bbdf3a17005fbbc00f9263b95fffba43438fcb9 100755 (executable)
@@ -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
index 4da2d8879f423b4da5c7161e0b91e3ea9c093b02..6f1ea7f8fa4096fcdd20b17cd96fc1197db2bc87 100755 (executable)
@@ -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
index bed43578aece15892c93f23a9a6f7d30ff0896b0..62624b15bc65a38dd173b824db13ffb41c4978d7 100755 (executable)
@@ -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
index 651affe07b40bc1d4aaec41dc713e7589eda039d..5734f254d3d7a6d1f48feb2e6251383b1ac7bf4a 100755 (executable)
@@ -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."
 
index b92098f9fce41b6357d27b22af41cb7f795b8115..44834186697535eeff3c354d95408af7f374ab6e 100755 (executable)
@@ -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"
 
index 8b2c7feff7f8a3ff87f8dbfa3417a35b0024cb86..fc747738091200a9898db04c336d159ec4ec8498 100755 (executable)
@@ -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
index 1abc06c424499819b1a27655ba0f40544fb82327..f8076cc8dfd11eba27eab008170ff14747c02f26 100755 (executable)
@@ -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
 
index adeab538016e24233b27f1d8c486c1a08142d677..af6e938e017b1cc2496efe6c883212663218dc85 100755 (executable)
@@ -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
index 0c8c87ea99818fda5dd3e0698cf207fcc5e155eb..fc51d183f92f81458888580980190242f81f70d0 100755 (executable)
@@ -43,7 +43,7 @@ do
 done
 wait
 
-sync
+_scratch_sync
 
 I=10030585
 E=10030599
index 73e4293849d92bc9b4a168be2e56e44eebf404ef..b5a1eabf75250438fe0f64a2e36f80316db05132 100755 (executable)
@@ -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
index 334d069342f1e414de307600279544f8df587bdc..7c1cd6a50ce5204a35c6707058f9553f8c90bab6 100755 (executable)
@@ -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)
index 0f1905295137591dea31127496cc6ac31c3a47a8..0bfda0e068d53925d9a72beaa57d823310c6706a 100755 (executable)
@@ -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}')
 
index 39f4f74ae49c9c98309337ce216c5f433fd3490f..c9bae5d92f9481191622df9955d2f421520ba888 100755 (executable)
@@ -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
index b86265211a6428ebf63c0a1b923c78eae5d7b7a7..77505718afa3efeb8f9f2f7fc4c17b34f2f11b45 100755 (executable)
@@ -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
index 948121c0569484831eddfaf5bdcfefea07e5b3fd..e13a646a5053bdf0533f32da0675e3d7b3350990 100755 (executable)
@@ -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
 
index 8d58590fd9daaf80e46a20967ce5f447bc9d3b91..e3fa87c43f2927dbf0b272710afb216b8afbe29f 100755 (executable)
@@ -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
index f965d9c389edfe273603ce23a7270f9526476252..9d23c32dcf26e43749a24b201c6a599d136a95ea 100755 (executable)
@@ -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
index 60cc84ed25dc5ec358933fe665755ed43334e6a0..ffd05f8a93be5a8bd356c51525fd655924577a20 100755 (executable)
@@ -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
index 54ece22abbc661dbe52c42bf307e92dc1fdff92a..51d2111649ec1820d476391b9de6f0dbb537949c 100755 (executable)
@@ -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
index 3f01b175e3e91cbd231110f092aa36bffa2cc453..2ad910cbdb1de8c33f36a92affdf30aa8c36b066 100755 (executable)
@@ -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
index c01682fa84c877f5d426004a6243af79b32dea29..ea494a152ef68c65dc0ec9606c52871e56e1afd8 100755 (executable)
@@ -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
index c7eba95a4b86973e49c1da15c18a8ec945338475..0eea2c098a8eb7818e7d529034bdf4f7c4bc0ff1 100755 (executable)
@@ -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
index 4d6e30c0a5d6881fbcf9d2f4717f76e53f1d1111..e57bf38cb8b6814e2367fcd6db5aaebe96232296 100755 (executable)
@@ -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
index a374a300d1905ac4af84aee6809581f4a28a470c..29cab3190a1c93550113ebbb5aa31d530802e284 100755 (executable)
@@ -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
index 194cd0459d3897afa15eb4faf74c00cb81c8b1bd..f172aaf5932ad9d02e2df6bacac0d2b3df1bd1ac 100755 (executable)
@@ -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
index bfe722c0add020aebcbe911a271087e1f6b13826..11a0d125a4c153e21c53e545058a82af8baf3409 100755 (executable)
@@ -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
index 4f9311e8ee491e059294388c05cb7af6774d31f5..e95cf3f5d1582999f2a8ca51fcca00ed6552792b 100755 (executable)
@@ -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
index 1532493979ffa74444b1754f3330c89e9ece6ac9..6d73d48e4974c8142a1bd668e6e4a8219334706e 100755 (executable)
@@ -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
 
index ea83a7b448166b1beb286ea4df2285f2b62274e9..964e94e1da1651e561cd0b5899ad51170c761626 100755 (executable)
@@ -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
index ce97fad5d57895cd06a7a774fff0a84b28584836..997a7ad47516a1dd387a62f989c6936a90639388 100755 (executable)
@@ -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:"
index 21de4c054a573f7d7bc61183e8bcf9da6b2725dc..e7f939c14a723ce44ae8be29451e2748a95eb035 100755 (executable)
@@ -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
index b65e2fae5172a114045d131c543d17c49aa00a8a..3e3ceec512421d0965331a4bafb6e2fe492cf8e9 100755 (executable)
@@ -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)
 
index d06e7fc13619e96228939457b3b55861aaf32637..a6bdc7c032bb38446f8a68c9a09d5a4aedb76060 100755 (executable)
@@ -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)
index f21f7a86ee1c96a50674ec9d16e4ae3522692242..69de69d86cda9cc27941dc4453357fe9bed35a4d 100755 (executable)
@@ -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)
 
index 0141c075be215af2e44982bf59d73fbda5575b6b..777968a9240df6b78fd9d2a102bcb9dbd29a1694 100755 (executable)
@@ -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
index 63ca0a67b18087a2035fa63b9f5954f23bbb4976..429a506c2d6423e7d1417d3b5b68024e6c638eee 100755 (executable)
@@ -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
index 6e47d442baffeafda5761ed61508e76711dbe5de..4c0fbf74a6c1dc50a5a9f3727cc47e3401963868 100755 (executable)
@@ -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
index d0c77db8b75adbb7b5546103301086e7966faac0..8f533041bb20dcc334d427cc7a697d8fda1bdb1e 100755 (executable)
@@ -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
index 07596e00b09647936d0970bf4f87932a4b9dd8cf..b86d06ae7f1f04d0202fc8143fd8b99287d563bb 100755 (executable)
@@ -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
index f6c346e185fb5f7eb16f55ce9e6ccabe8322c539..af783a7ad20a253582c32e501a590471016659b9 100755 (executable)
@@ -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
index 63711ed473726b2b85f052ab48c944d5ac15a615..3c92d1a1d1d3ae811bae754cae2abe8ddba4485e 100755 (executable)
@@ -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
index 192107f5907a0d46dcd996215d7965ab6bf7b641..2ae0b903c504de561fd364de1a1a02677c1a015c 100755 (executable)
@@ -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
index 590d268e66a8deeead1fc2613bb7b583da0ad85e..4ff11be402242c0f1c337709a89389fe17271e12 100755 (executable)
@@ -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"
index 45b958d8f79f0d6fd506cb9ea312866f97845d24..66f191127175985b252b903ed9ed1c3b871eba8c 100755 (executable)
@@ -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
index f7e4949a35053291ba166b2833df7ef7e27ec05f..4cf174b88dee60f263164645718e33dca07f4921 100755 (executable)
@@ -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
index a09e4a8cec663d74e2fe714ee5281381320a0806..4ebde3e2a543de896ea96e8b4fbddd8b12c6dbf7 100755 (executable)
@@ -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
index 4cb36a51520323b5f91b62022e67dea3430808e9..0492b647ee677a1dac48886e351eaf482e866ae5 100755 (executable)
@@ -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
index 0579d4a7267677d9a2f37b2e83aeb9609bcc35e4..ee45ba6085e12a8c6bd5918b6da420c124cfd052 100755 (executable)
@@ -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
index 485b16215dbb26db1cc81476ee5515200819da22..b86bb0ea82326a17b153762ae9f2925505339715 100755 (executable)
@@ -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
index 2387b8d889b685a9d226e202f17357d490b4e181..f06eda64ec8fb67c983eb74f3ca78cc977147edf 100755 (executable)
@@ -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"
index 5d7afe9bf7f59b68e5fdac6c73d224f787609ddd..a06879c3e3955963f3c376f2be092ba42d516ef3 100755 (executable)
@@ -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"
index 44728c117452eef3a864fb3b95de829704c01ce3..1f2ee54849a0184ff93f10d8d73e399a165de192 100755 (executable)
@@ -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)
index 038682ef95821dbf2ae9bed8c1e7facbe3958fd4..37fb8c6b8aa83d3bf2776ac30b3a27f0c18f1c7c 100755 (executable)
@@ -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
index ab565e1f6a35389c85bd212998acc96e02048f94..fdee45ce49f127b9c4c9cae85cddf3923ab25dd7 100755 (executable)
@@ -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
index 1fbf500d8c8f960911293b770987d06c605a7fbe..78fd913017ccf7ec2539da06a53bc7f0d0fc16c0 100755 (executable)
@@ -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
index 0239778c5121449eb776ac3624a0b90347453dfb..6d1988c8b9b807b5f4f152093642cb9be7dad651 100755 (executable)
@@ -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
index fc7319449d4da4bbadd116cc57406a9b1d97a3a3..0cc679aebf418f6e914a391c7498961e8e3f406b 100755 (executable)
@@ -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"
index 5cbd8dd1925158fc5976633ec9b446cfd8615917..58e56b5d27ef336e649062b91acda26ace580b6e 100755 (executable)
@@ -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)
index b55c34b923fa729f30c670d2110b2a7e1d7b76fd..a942e92e3af32d4d1242cd11d7c96d12b1a2117a 100755 (executable)
@@ -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
index ac815f1230bc98b67a07880c99f388178b3756f1..37a139c9e4212367bd1cb803219c38378ef6f6a6 100755 (executable)
@@ -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"
index 3734d8746288e15c25174170ffaffbbd2c9d2456..2d80188b2972e381c54d68114936ed037eee86d2 100755 (executable)
@@ -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 | \
index 518373fa8902266b92ead5e79dc8b04aebc7155f..9be15d1f6027e659285125742bf7f0dffe5fa68b 100755 (executable)
@@ -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 || \
index f4294e9c1e03e1d59c39001ba0fa17fe1c2e8461..13ef629e38712e72f65ef47a2485a871b4a5f359 100755 (executable)
@@ -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 \
index ec2fbcb6832a31f58762f80e84fe1be28542d671..ba137ae8dac33a0c2bcc13346797aeadecf7f9ca 100755 (executable)
@@ -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.
index 530fea9ed6bab3fc4313f280509195dc46f3ddcc..ae1e19a9aeb68d189958cabd9e2bc27eec8706b8 100755 (executable)
@@ -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
 
index 2f5bf52334b83f9e83f32743db394bd1b8dc07cb..e0ad7d81612f4d9e7ecb6bc4afa456066e2899e9 100755 (executable)
@@ -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
index 58beedc03a8bb9ca8b6e2d76e367c4a9cc1564d9..34b3ca0d634346f7d54775be42e763720c5de0bc 100755 (executable)
@@ -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)
index 939d8a4ac37f98ad1005e437745cddf083772395..79dcb44bc066136eb2706f6ae43c29a32fb5bf25 100755 (executable)
@@ -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)
index 55a74297918a2c4a6e80a4e79f29a0577300af21..4d79b821f9edc125f6e13b4787e129881168cdb9 100755 (executable)
@@ -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)
index 53e8906bb9fbd02657d26c82b28d13ad4ad5f141..d0bdaef96e838cf9d836a333bedaba4a6e507d1c 100755 (executable)
@@ -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"
index bca58042001208f6d76538a30b0f59f8a3af42da..0fcc4819049b90cbf020a4a20a0e5518507abe8f 100755 (executable)
@@ -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
index cdfa63692118dad49211a74fea8807ea812bb18f..6c7b2db1135625a9aac8474d5e58b5ab183b600b 100755 (executable)
@@ -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.