[PATCH 22/28] fsync-tester.c: use syncfs() rather than sync()

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Dave Chinner <dchinner@xxxxxxxxxx>

generic/311 runs each fsync-tester unit test 4 times, and there are
20 separate tests. At least 9 of those unit tests run sync() to
flush dirty data periodically.

When running check-parallel, sync() can take a -long- time to
run as there can be dozens of filesystems that need to be synced,
not to mention sync getting hung up behind all the mount and
unmounts that are also being run. This results in:

Ten slowest tests - runtime in seconds:
generic/311 419

This test running for a really long time.

Convert the sync() calls to syncfs() so that they only try to sync
the filesystem under test and not the entire system. This avoids
interactions and delays with other tests and mount/unmount
operations, hence allowing both the test and the overall
check-parallel operation to run faster:

generic/311        166s

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 src/fsync-tester.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fsync-tester.c b/src/fsync-tester.c
index 417187491..048cb4853 100644
--- a/src/fsync-tester.c
+++ b/src/fsync-tester.c
@@ -131,7 +131,7 @@ static int test_three(int *max_blocks, int prealloc, int rand_fsync,
 		/* Force a transaction commit in between just for fun */
 		if (blocks == sync_block && (do_sync || drop_caches)) {
 			if (do_sync)
-				sync();
+				syncfs(test_fd);
 			else
 				sync_file_range(test_fd, 0, 0,
 						SYNC_FILE_RANGE_WRITE|
-- 
2.45.2





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux