On Thu, Oct 29, 2020 at 12:47:32PM +0200, Amir Goldstein wrote: > On Wed, Oct 28, 2020 at 10:24 PM Darrick J. Wong > <darrick.wong@xxxxxxxxxx> wrote: > > > > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > > > Teach fstests to extract timestamp limits of a filesystem using the new > > xfs_db timelimit command. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > --- > > common/rc | 2 +- > > common/xfs | 14 ++++++++++++++ > > tests/xfs/911 | 44 ++++++++++++++++++++++++++++++++++++++++++++ > > tests/xfs/911.out | 15 +++++++++++++++ > > tests/xfs/group | 1 + > > 5 files changed, 75 insertions(+), 1 deletion(-) > > create mode 100755 tests/xfs/911 > > create mode 100644 tests/xfs/911.out > > > > > > diff --git a/common/rc b/common/rc > > index 41f93047..162d957a 100644 > > --- a/common/rc > > +++ b/common/rc > > @@ -2029,7 +2029,7 @@ _filesystem_timestamp_range() > > echo "0 $u32max" > > ;; > > xfs) > > - echo "$s32min $s32max" > > + _xfs_timestamp_range "$device" > > ;; > > btrfs) > > echo "$s64min $s64max" > > diff --git a/common/xfs b/common/xfs > > index e548a0a1..19ccee03 100644 > > --- a/common/xfs > > +++ b/common/xfs > > @@ -994,3 +994,17 @@ _require_xfs_scratch_inobtcount() > > _notrun "inobtcount not supported by scratch filesystem type: $FSTYP" > > _scratch_unmount > > } > > + > > +_xfs_timestamp_range() > > +{ > > + local use_db=0 > > + local dbprog="$XFS_DB_PROG $device" Heh, device isn't defined, I'll fix that. > > + 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 > > + echo "-$((1<<31)) $(((1<<31)-1))" > > This embodies an assumption that the tested filesystem does not have > bigtime enabled if xfs_db tool is not uptodate. If the xfs_db tool doesn't support the timelimit command then it doesn't support formatting with bigtime. I don't think it's reasonable to expect to be able to run fstests on a test filesystem that xfsprogs doesn't support. Hence it's fine to output the old limits if the timelimit command doesn't exist. > Maybe it makes sense, but it may be safer to return "-1 -1" and not_run > generic/402 if xfs_db is not uptodate, perhaps with an extra message > hinting the user to upgrade xfs_db. TBH it boggles my mind that there *still* is no way to ask the kernel for the supported timestamp range of a mounted filesystem. The timelimit command and this mess in fstests was supposed to be a temporary workaround that would (in my ideal world) have become unnecessary before this landed, but ... ugh. --D > Thanks, > Amir.