xfs: log changed inodes instead of writing them synchronously
authorChristoph Hellwig <hch@infradead.org>
Tue, 9 Feb 2010 00:43:49 +0000 (11:43 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 9 Feb 2010 00:43:49 +0000 (11:43 +1100)
commit07fec73625dc0db6f9aed68019918208a2ca53f5
tree04f4ad3f829c3d64d6b2a3c0bddf11a4374eb93d
parente8b217e7530c6a073ac69f1c85b922d93fdf5647
xfs: log changed inodes instead of writing them synchronously

When an inode has already be flushed delayed write,
xfs_inode_clean() returns true and hence xfs_fs_write_inode() can
return on a synchronous inode write without having written the
inode. Currently these sycnhronous writes only come sync(1),
unmount, a sycnhronous NFS export and cachefiles so should be
relatively rare and out of common performance paths.

Realistically, a synchronous inode write is not necessary here; we
can avoid writing the inode by logging any non-transactional changes
that are pending.  This needs to be done with synchronous
transactions, but it avoids seeking between the log and inode
clusters as we do now. We don't force the log if the inode is
pinned, though, so this differs from the fsync case.  For normal
sys_sync and unmount behaviour this is fine because we do a
synchronous log force in xfs_sync_data which is called from the
->sync_fs code.

It does however break the NFS synchronous export guarantees for now,
but work is under way to fix this at a higher level or for the
higher level to provide an additional flag in the writeback control
to tell us that a log force is needed.

Portions of this patch are based on work from Dave Chinner.

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
fs/xfs/linux-2.6/xfs_super.c