diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-12-22 20:02:31 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-12-22 20:02:31 -0500 |
commit | 6e857567dbbfe14dd6cc3f7414671b047b1ff5c7 (patch) | |
tree | dde314cd6a22066e4cd7f3c498f89b00984838d7 /block/blk-settings.c | |
parent | 055388a3188f56676c21e92962fc366ac8b5cb72 (diff) |
xfs: don't truncate prealloc from frequently accessed inodes
A long standing problem for streaming writeѕ through the NFS server
has been that the NFS server opens and closes file descriptors on an
inode for every write. The result of this behaviour is that the
->release() function is called on every close and that results in
XFS truncating speculative preallocation beyond the EOF. This has
an adverse effect on file layout when multiple files are being
written at the same time - they interleave their extents and can
result in severe fragmentation.
To avoid this problem, keep track of ->release calls made on a dirty
inode. For most cases, an inode is only going to be opened once for
writing and then closed again during it's lifetime in cache. Hence
if there are multiple ->release calls when the inode is dirty, there
is a good chance that the inode is being accessed by the NFS server.
Hence set a flag the first time ->release is called while there are
delalloc blocks still outstanding on the inode.
If this flag is set when ->release is next called, then do no
truncate away the speculative preallocation - leave it there so that
subsequent writes do not need to reallocate the delalloc space. This
will prevent interleaving of extents of different inodes written
concurrently to the same AG.
If we get this wrong, it is not a big deal as we truncate
speculative allocation beyond EOF anyway in xfs_inactive() when the
inode is thrown out of the cache.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'block/blk-settings.c')
0 files changed, 0 insertions, 0 deletions