]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
seek_sanity_test: fix allocation unit detection on XFS realtime
authorDarrick J. Wong <djwong@kernel.org>
Tue, 28 Jun 2022 20:21:23 +0000 (13:21 -0700)
committerZorro Lang <zlang@kernel.org>
Sat, 2 Jul 2022 13:32:43 +0000 (21:32 +0800)
commite861a30255c9780425ee5193325d30882fbe7410
tree1aab95bf0bdccc18047dee4b688cea3d492e75ca
parent9d14711da549815103dfa9f44f0fb24fe0c71c6c
seek_sanity_test: fix allocation unit detection on XFS realtime

The seek sanity test tries to figure out a file space allocation unit by
calling stat and then using an iterative SEEK_DATA method to try to
detect a smaller blocksize based on SEEK_DATA's consultation of the
filesystem's internal block mapping.  This was put in (AFAICT) because
XFS' stat implementation returns max(filesystem blocksize, PAGESIZE) for
most regular files.

Unfortunately, for a realtime file with an extent size larger than a
single filesystem block this doesn't work at all because block mappings
still work at filesystem block granularity, but allocation units do not.
To fix this, detect the specific case where st_blksize != PAGE_SIZE and
trust the fstat results.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
src/seek_sanity_test.c