diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-04-20 17:23:20 -0700 |
---|---|---|
committer | Eryu Guan <guaneryu@gmail.com> | 2021-04-25 14:45:26 +0800 |
commit | 63b6a5644e71e006df56ebec49aec9d94045c73a (patch) | |
tree | e151c0287fabedcda98b2f41b855fc5ed87528c0 /common/xfs | |
parent | f806708c2c485d2110dd55f1fd58d84fac1eb434 (diff) |
xfs: detect time limits from filesystem
Teach fstests to extract timestamp limits of a filesystem using the new
xfs_db timelimit command.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Diffstat (limited to 'common/xfs')
-rw-r--r-- | common/xfs | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1166,3 +1166,22 @@ _require_scratch_xfs_inobtcount() _notrun "kernel doesn't support xfs inobtcount feature" _scratch_unmount } + +_xfs_timestamp_range() +{ + local device="$1" + local use_db=0 + local dbprog="$XFS_DB_PROG $device" + test "$device" = "$SCRATCH_DEV" && dbprog=_scratch_xfs_db + + $dbprog -f -c 'help timelimit' | grep -v -q 'not found' && use_db=1 + if [ $use_db -eq 0 ]; then + # The "timelimit" command was added to xfs_db at the same time + # that bigtime was added to xfsprogs. Therefore, we can assume + # the old timestamp range if the command isn't present. + echo "-$((1<<31)) $(((1<<31)-1))" + else + $dbprog -f -c 'timelimit --compact' | \ + awk '{printf("%s %s", $1, $2);}' + fi +} |