On Tue, Jun 28, 2022 at 01:22:02PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Beginning with 5.18, some filesystems support creating large folios for > the page cache. A system with 64k pages can create 256k folios, which > means that with the old file size of 1M, the last half of the file is > completely converted from unwritten to written by page_mkwrite. The > test encodes a translated version of the xfs_bmap output in the golden > output, which means that the test now fails on 64k pages. Fixing the > 64k page case by increasing the file size to 2MB broke fsdax because > fsdax uses 2MB PMDs, hence 12MB. > > Increase the size to prevent this from happening. This may require > further revision if folios get larger or fsdax starts supporting PMDs > that are larger than 2MB. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- > tests/xfs/166 | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > > diff --git a/tests/xfs/166 b/tests/xfs/166 > index 42379961..d45dc5e8 100755 > --- a/tests/xfs/166 > +++ b/tests/xfs/166 > @@ -16,12 +16,12 @@ _begin_fstest rw metadata auto quick > # the others are unwritten. > _filter_blocks() > { > - $AWK_PROG ' > + $AWK_PROG -v file_size=$FILE_SIZE ' > /^ +[0-9]/ { > if (!written_size) { > written_size = $6 > - unwritten1 = ((1048576/512) / 2) - written_size > - unwritten2 = ((1048576/512) / 2) - 2 * written_size > + unwritten1 = ((file_size/512) / 2) - written_size > + unwritten2 = ((file_size/512) / 2) - 2 * written_size > } > > # is the extent unwritten? > @@ -58,7 +58,18 @@ _scratch_mount > > TEST_FILE=$SCRATCH_MNT/test_file > TEST_PROG=$here/src/unwritten_mmap > -FILE_SIZE=1048576 > + > +# Beginning with 5.18, some filesystems support creating large folios for the > +# page cache. A system with 64k pages can create 256k folios, which means > +# that with the old file size of 1M, the last half of the file is completely > +# converted from unwritten to written by page_mkwrite. The test will fail on > +# the golden output when this happens, so increase the size from the original > +# 1MB file size to at least (6 * 256k == 1.5MB) prevent this from happening. > +# > +# However, increasing the file size to around 2MB causes regressions when fsdax > +# is enabled because fsdax will try to use PMD entries for the mappings. Hence > +# we need to set the file size to (6 * 2MB == 12MB) to cover all cases. > +FILE_SIZE=$((12 * 1048576)) LGTM. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx