Re: [PATCH 09/11] xfs: remove the i_new_size field in struct xfs_inode

Christoph Hellwig
2011-12-14T13:57:35Z

On Wed, Dec 14, 2011 at 10:16:11AM +1100, Dave Chinner wrote:
> > Note that currently the generic direct I/O code only updates i_size after
> > calling our end_io handler, which requires a small workaround to make
> > sure di_size actually makes it to disk. I hope to fix this properly in
> > the generic code.
>
> I think there's a couple of issues with the work around - the
> generic code marks the inode dirty when it updates the inode size.
> With your early setting of the size, it will no longer do this
> because it doesn't see that it needs to update the inode size.
> This may not be a problem if we mark the inode dirty elsewhere, but
> I'm not sure we do in the direct IO path.

We do from I/O completion, once we actually update the on-disk inode
size that actually gets logged. Before the on-disk inode size has
been updated ->write_inode is a no-op as far as size updates are
concerned, so marking the inode dirty earlier doesn't buy us anything.