@@ -1037,6 +1037,15 @@ xfs_buffered_write_iomap_begin(
goto convert_delay;
if (end_fsb > eof_fsb)
end_fsb = eof_fsb;
+ } else if (imap.br_state == XFS_EXT_UNWRITTEN) {
+ u64 end;
+
+ xfs_trim_extent(&imap, offset_fsb, end_fsb - offset_fsb);
+ end = iomap_fill_dirty_folios(VFS_I(ip), iomap,
+ XFS_FSB_TO_B(mp, imap.br_startoff),
+ XFS_FSB_TO_B(mp, imap.br_blockcount));
+ end_fsb = min_t(xfs_fileoff_t, end_fsb, XFS_B_TO_FSB(mp, end));
+ iomap_flags |= IOMAP_F_HAS_FOLIOS;
}
xfs_trim_extent(&imap, offset_fsb, end_fsb - offset_fsb);
}
Use the iomap folio batch mechanism to identify which folios to zero on zero range of unwritten mappings. Trim the resulting mapping if the batch is filled (unlikely) and set the HAS_FOLIOS flag to inform iomap that pagecache has been checked for dirty folios. Signed-off-by: Brian Foster <bfoster@redhat.com> --- fs/xfs/xfs_iomap.c | 9 +++++++++ 1 file changed, 9 insertions(+)