Re: [PATCH v15 18/25] xfs: make xfs_free_eofblocks() work with fsverity inodes
Christoph Hellwig <[email protected]>
| Newsgroups | org.kernel.vger.linux-unionfs,dev.linux.lists.fsverity,net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-block,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Aug 14, 2026 at 11:24:35AM +0200, Andrey Albershteyn wrote:
> xfs_free_eofblocks() removes any preallocations and unwritten extents
> beyond EOF.
This reads a bit confusing. I simple removes all extents past EOF
unless the XFS_DIFLAG_PREALLOC or XFS_DIFLAG_APPEND flags are set.
> Add XFS_BMAPI_UNWRITTEN and change xfs_bunmapi_range to remove only
> unwritten extents sitting beyond EOF and set it for fsverity inodes.
Maybe split that from the use of this flag for fsverity?
> - while (unmap_len > 0) {
> - ASSERT((*tpp)->t_highest_agno == NULLAGNUMBER);
> - error = __xfs_bunmapi(*tpp, ip, startoff, &unmap_len, flags,
> - XFS_ITRUNC_MAX_EXTENTS);
> + while (startoff < endoff) {
> + nimaps = 1;
> +
> + error = xfs_bmapi_read(ip, startoff, endoff - startoff + 1,
> + &imap, &nimaps, read_flags);
> if (error)
> goto out;
This gets us extra lookups in the iext tree, which is a bit annoying.
I'd pass the new flag down to __xfs_bunmapi and skip non-unwritten
extents there. That should also be less code and less churn than
trying to do that in the caller.