Re: [PATCH] xfs: xfs_release don't free eofblocks with extsize hint

Christoph Hellwig
2012-06-19T07:48:16Z

On Tue, Jun 12, 2012 at 11:11:02AM +1000, Dave Chinner wrote:
> Alternatively, (and I think a better solution) is to treat files
> with extent size hints on them exactly the same as files with
> preallocation on them. i.e. in xfs_set_diflags() we set
> XFS_DIFLAG_PREALLOC at the same time we set the XFS_DIFLAG_EXTSIZE,
> and then all our truncate logic just works as expected for
> physical preallocation beyond EOF on extsize hint files without
> changing anything else....

I think that is a much better approach. The user explicitly asked to
do allocation in the specified unit, so we should not truncate it down.

On something slightly related: Currently the calls to
xfs_free_eofblocks in xfs_release and in xfs_inactive are guarded by
similar but not quite the same checks on the inode type/flags/allocated
blocks, etc. It would be really good to factor the common parts into
a helper, and then document why the other checks need to be different.