common: fix _require_btime for lazy filesystems

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>
This commit is contained in:
Darrick J. Wong
2019-02-11 18:17:32 -08:00
committed by Eryu Guan
parent 0c24aa077f
commit 08174ee110
+10 -2
View File
@@ -3849,7 +3849,11 @@ _dmsetup_create()
_require_btime() _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 || \ | grep btime >>$seqres.full 2>&1 || \
_notrun "inode creation time not supported by this filesystem" _notrun "inode creation time not supported by this filesystem"
rm -f $TEST_DIR/test_creation_time rm -f $TEST_DIR/test_creation_time
@@ -3861,7 +3865,11 @@ _require_scratch_btime()
_scratch_mkfs > /dev/null 2>&1 _scratch_mkfs > /dev/null 2>&1
_scratch_mount _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 || \ | grep btime >>$seqres.full 2>&1 || \
_notrun "inode creation time not supported by this filesystem" _notrun "inode creation time not supported by this filesystem"