aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-04-23 01:58:39 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:31 -0400
commit43ff2122e6492bcc88b065c433453dce88223b30 (patch)
tree0f762cfb753edd73402b8830e0927d9efba30c61 /fs/xfs/xfs_inode.c
parent960c60af8b9481595e68875e79b2602e73169c29 (diff)
xfs: on-stack delayed write buffer lists
Queue delwri buffers on a local on-stack list instead of a per-buftarg one, and write back the buffers per-process instead of by waking up xfsbufd. This is now easily doable given that we have very few places left that write delwri buffers: - log recovery: Only done at mount time, and already forcing out the buffers synchronously using xfs_flush_buftarg - quotacheck: Same story. - dquot reclaim: Writes out dirty dquots on the LRU under memory pressure. We might want to look into doing more of this via xfsaild, but it's already more optimal than the synchronous inode reclaim that writes each buffer synchronously. - xfsaild: This is the main beneficiary of the change. By keeping a local list of buffers to write we reduce latency of writing out buffers, and more importably we can remove all the delwri list promotions which were hitting the buffer cache hard under sustained metadata loads. The implementation is very straight forward - xfs_buf_delwri_queue now gets a new list_head pointer that it adds the delwri buffers to, and all callers need to eventually submit the list using xfs_buf_delwi_submit or xfs_buf_delwi_submit_nowait. Buffers that already are on a delwri list are skipped in xfs_buf_delwri_queue, assuming they already are on another delwri list. The biggest change to pass down the buffer list was done to the AIL pushing. Now that we operate on buffers the trylock, push and pushbuf log item methods are merged into a single push routine, which tries to lock the item, and if possible add the buffer that needs writeback to the buffer list. This leads to much simpler code than the previous split but requires the individual IOP_PUSH instances to unlock and reacquire the AIL around calls to blocking routines. Given that xfsailds now also handle writing out buffers, the conditions for log forcing and the sleep times needed some small changes. The most important one is that we consider an AIL busy as long we still have buffers to push, and the other one is that we do increment the pushed LSN for buffers that are under flushing at this moment, but still count them towards the stuck items for restart purposes. Without this we could hammer on stuck items without ever forcing the log and not make progress under heavy random delete workloads on fast flash storage devices. [ Dave Chinner: - rebase on previous patches. - improved comments for XBF_DELWRI_Q handling - fix XBF_ASYNC handling in queue submission (test 106 failure) - rename delwri submit function buffer list parameters for clarity - xfs_efd_item_push() should return XFS_ITEM_PINNED ] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 0fa987dea242..acd846d808b2 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2347,11 +2347,11 @@ cluster_corrupt_out:
2347 */ 2347 */
2348 rcu_read_unlock(); 2348 rcu_read_unlock();
2349 /* 2349 /*
2350 * Clean up the buffer. If it was B_DELWRI, just release it -- 2350 * Clean up the buffer. If it was delwri, just release it --
2351 * brelse can handle it with no problems. If not, shut down the 2351 * brelse can handle it with no problems. If not, shut down the
2352 * filesystem before releasing the buffer. 2352 * filesystem before releasing the buffer.
2353 */ 2353 */
2354 bufwasdelwri = XFS_BUF_ISDELAYWRITE(bp); 2354 bufwasdelwri = (bp->b_flags & _XBF_DELWRI_Q);
2355 if (bufwasdelwri) 2355 if (bufwasdelwri)
2356 xfs_buf_relse(bp); 2356 xfs_buf_relse(bp);
2357 2357
@@ -2685,27 +2685,6 @@ corrupt_out:
2685 return XFS_ERROR(EFSCORRUPTED); 2685 return XFS_ERROR(EFSCORRUPTED);
2686} 2686}
2687 2687
2688void
2689xfs_promote_inode(
2690 struct xfs_inode *ip)
2691{
2692 struct xfs_buf *bp;
2693
2694 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
2695
2696 bp = xfs_incore(ip->i_mount->m_ddev_targp, ip->i_imap.im_blkno,
2697 ip->i_imap.im_len, XBF_TRYLOCK);
2698 if (!bp)
2699 return;
2700
2701 if (XFS_BUF_ISDELAYWRITE(bp)) {
2702 xfs_buf_delwri_promote(bp);
2703 wake_up_process(ip->i_mount->m_ddev_targp->bt_task);
2704 }
2705
2706 xfs_buf_relse(bp);
2707}
2708
2709/* 2688/*
2710 * Return a pointer to the extent record at file index idx. 2689 * Return a pointer to the extent record at file index idx.
2711 */ 2690 */