aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode_item.c
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2010-02-05 20:39:36 -0500
committerDave Chinner <david@fromorbit.com>2010-02-05 20:39:36 -0500
commitc854363e80b49dd04a4de18ebc379eb8c8806674 (patch)
tree8c8d0dec26d961631a3cd8b6c402b5d1444336e5 /fs/xfs/xfs_inode_item.c
parent777df5afdb26c71634edd60582be620ff94e87a0 (diff)
xfs: Use delayed write for inodes rather than async V2
We currently do background inode flush asynchronously, resulting in inodes being written in whatever order the background writeback issues them. Not only that, there are also blocking and non-blocking asynchronous inode flushes, depending on where the flush comes from. This patch completely removes asynchronous inode writeback. It removes all the strange writeback modes and replaces them with either a synchronous flush or a non-blocking delayed write flush. That is, inode flushes will only issue IO directly if they are synchronous, and background flushing may do nothing if the operation would block (e.g. on a pinned inode or buffer lock). Delayed write flushes will now result in the inode buffer sitting in the delwri queue of the buffer cache to be flushed by either an AIL push or by the xfsbufd timing out the buffer. This will allow accumulation of dirty inode buffers in memory and allow optimisation of inode cluster writeback at the xfsbufd level where we have much greater queue depths than the block layer elevators. We will also get adjacent inode cluster buffer IO merging for free when a later patch in the series allows sorting of the delayed write buffers before dispatch. This effectively means that any inode that is written back by background writeback will be seen as flush locked during AIL pushing, and will result in the buffers being pushed from there. This writeback path is currently non-optimal, but the next patch in the series will fix that problem. A side effect of this delayed write mechanism is that background inode reclaim will no longer directly flush inodes, nor can it wait on the flush lock. The result is that inode reclaim must leave the inode in the reclaimable state until it is clean. Hence attempts to reclaim a dirty inode in the background will simply skip the inode until it is clean and this allows other mechanisms (i.e. xfsbufd) to do more optimal writeback of the dirty buffers. As a result, the inode reclaim code has been rewritten so that it no longer relies on the ambiguous return values of xfs_iflush() to determine whether it is safe to reclaim an inode. Portions of this patch are derived from patches by Christoph Hellwig. Version 2: - cleanup reclaim code as suggested by Christoph - log background reclaim inode flush errors - just pass sync flags to xfs_iflush Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_inode_item.c')
-rw-r--r--fs/xfs/xfs_inode_item.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 48ec1c0b23ce..207553e82954 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -866,10 +866,14 @@ xfs_inode_item_push(
866 iip->ili_format.ilf_fields != 0); 866 iip->ili_format.ilf_fields != 0);
867 867
868 /* 868 /*
869 * Write out the inode. The completion routine ('iflush_done') will 869 * Push the inode to it's backing buffer. This will not remove the
870 * pull it from the AIL, mark it clean, unlock the flush lock. 870 * inode from the AIL - a further push will be required to trigger a
871 * buffer push. However, this allows all the dirty inodes to be pushed
872 * to the buffer before it is pushed to disk. THe buffer IO completion
873 * will pull th einode from the AIL, mark it clean and unlock the flush
874 * lock.
871 */ 875 */
872 (void) xfs_iflush(ip, XFS_IFLUSH_ASYNC); 876 (void) xfs_iflush(ip, 0);
873 xfs_iunlock(ip, XFS_ILOCK_SHARED); 877 xfs_iunlock(ip, XFS_ILOCK_SHARED);
874 878
875 return; 879 return;