On Sun, Jan 02, 2022 at 05:34:05PM -0800, Hugh Dickins wrote: > xfstests generic 098 214 263 286 412 used to pass on huge tmpfs (well, > three of those _require_odirect, enabled by a shmem_direct_IO() stub), > but still fail even with the partial_end fix. > > generic/098 output mismatch shows actual data loss: > --- tests/generic/098.out > +++ /home/hughd/xfstests/results//generic/098.out.bad > @@ -4,9 +4,7 @@ > wrote 32768/32768 bytes at offset 262144 > XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > File content after remount: > -0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa > -* > -0400000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > +0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > ... generic/098 is passing for me ;-( I'm using 'always' for THPs. I'll have to try harder. Regardless, I think your fix is good ... > +static struct folio *shmem_get_partial_folio(struct inode *inode, pgoff_t index) Love the better calling convention. > + folio = __filemap_get_folio(inode->i_mapping, index, > + FGP_ENTRY | FGP_LOCK, 0); > + if (!folio || !xa_is_value(folio)) > + return folio; That first '!folio' is redundant. xa_is_value(NULL) is false.