]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common: fix _require_btime for lazy filesystems
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 12 Feb 2019 02:17:32 +0000 (18:17 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sat, 16 Feb 2019 11:36:06 +0000 (19:36 +0800)
Filesystems are not required to try to fill the statx btime field
unless the caller actually sets STATX_BTIME.  They're allowed to
volunteer that information "if it's cheap", but XFS doesn't
volunteer and there may be filesystems that support btime but not
cheaply.

Either way, we want to test btime on any filesystem that supports
it, cheaply or otherwise, so set STATX_BTIME when we're trying to
detect support for it.

[Eryu: fix _require_scratch_btime too]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc

index ab468adf19e25cadbc052e5a977d2bd74440c03f..c88c304c3f0af52fbc4b0083755f43f7bd386b45 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -3849,7 +3849,11 @@ _dmsetup_create()
 
 _require_btime()
 {
-       $XFS_IO_PROG -f $TEST_DIR/test_creation_time -c "statx -v" \
+       # Note: filesystems are not required to report btime (creation time)
+       # if the caller doesn't ask for it, so we define STATX_BTIME here and
+       # pass it in to the statx command.
+       export STATX_BTIME=0x800
+       $XFS_IO_PROG -f $TEST_DIR/test_creation_time -c "statx -m $STATX_BTIME -v" \
                | grep btime >>$seqres.full 2>&1 || \
                _notrun "inode creation time not supported by this filesystem"
        rm -f $TEST_DIR/test_creation_time
@@ -3861,7 +3865,11 @@ _require_scratch_btime()
        _scratch_mkfs > /dev/null 2>&1
        _scratch_mount
 
-       $XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -v" \
+       # Note: filesystems are not required to report btime (creation time)
+       # if the caller doesn't ask for it, so we define STATX_BTIME here and
+       # pass it in to the statx command.
+       export STATX_BTIME=0x800
+       $XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -m $STATX_BTIME -v" \
                | grep btime >>$seqres.full 2>&1 || \
                _notrun "inode creation time not supported by this filesystem"