diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-04-23 01:58:39 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-05-14 17:20:31 -0400 |
commit | 43ff2122e6492bcc88b065c433453dce88223b30 (patch) | |
tree | 0f762cfb753edd73402b8830e0927d9efba30c61 /fs/xfs/xfs_trans.h | |
parent | 960c60af8b9481595e68875e79b2602e73169c29 (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_trans.h')
-rw-r--r-- | fs/xfs/xfs_trans.h | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index f6118703f20d..7ab99e1898c8 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -345,11 +345,9 @@ struct xfs_item_ops { | |||
345 | void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *); | 345 | void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *); |
346 | void (*iop_pin)(xfs_log_item_t *); | 346 | void (*iop_pin)(xfs_log_item_t *); |
347 | void (*iop_unpin)(xfs_log_item_t *, int remove); | 347 | void (*iop_unpin)(xfs_log_item_t *, int remove); |
348 | uint (*iop_trylock)(xfs_log_item_t *); | 348 | uint (*iop_push)(struct xfs_log_item *, struct list_head *); |
349 | void (*iop_unlock)(xfs_log_item_t *); | 349 | void (*iop_unlock)(xfs_log_item_t *); |
350 | xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t); | 350 | xfs_lsn_t (*iop_committed)(xfs_log_item_t *, xfs_lsn_t); |
351 | void (*iop_push)(xfs_log_item_t *); | ||
352 | bool (*iop_pushbuf)(xfs_log_item_t *); | ||
353 | void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t); | 351 | void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t); |
354 | }; | 352 | }; |
355 | 353 | ||
@@ -357,20 +355,18 @@ struct xfs_item_ops { | |||
357 | #define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp) | 355 | #define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp) |
358 | #define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip) | 356 | #define IOP_PIN(ip) (*(ip)->li_ops->iop_pin)(ip) |
359 | #define IOP_UNPIN(ip, remove) (*(ip)->li_ops->iop_unpin)(ip, remove) | 357 | #define IOP_UNPIN(ip, remove) (*(ip)->li_ops->iop_unpin)(ip, remove) |
360 | #define IOP_TRYLOCK(ip) (*(ip)->li_ops->iop_trylock)(ip) | 358 | #define IOP_PUSH(ip, list) (*(ip)->li_ops->iop_push)(ip, list) |
361 | #define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip) | 359 | #define IOP_UNLOCK(ip) (*(ip)->li_ops->iop_unlock)(ip) |
362 | #define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn) | 360 | #define IOP_COMMITTED(ip, lsn) (*(ip)->li_ops->iop_committed)(ip, lsn) |
363 | #define IOP_PUSH(ip) (*(ip)->li_ops->iop_push)(ip) | ||
364 | #define IOP_PUSHBUF(ip) (*(ip)->li_ops->iop_pushbuf)(ip) | ||
365 | #define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn) | 361 | #define IOP_COMMITTING(ip, lsn) (*(ip)->li_ops->iop_committing)(ip, lsn) |
366 | 362 | ||
367 | /* | 363 | /* |
368 | * Return values for the IOP_TRYLOCK() routines. | 364 | * Return values for the IOP_PUSH() routines. |
369 | */ | 365 | */ |
370 | #define XFS_ITEM_SUCCESS 0 | 366 | #define XFS_ITEM_SUCCESS 0 |
371 | #define XFS_ITEM_PINNED 1 | 367 | #define XFS_ITEM_PINNED 1 |
372 | #define XFS_ITEM_LOCKED 2 | 368 | #define XFS_ITEM_LOCKED 2 |
373 | #define XFS_ITEM_PUSHBUF 3 | 369 | #define XFS_ITEM_FLUSHING 3 |
374 | 370 | ||
375 | /* | 371 | /* |
376 | * This is the type of function which can be given to xfs_trans_callback() | 372 | * This is the type of function which can be given to xfs_trans_callback() |