xfs: AIL lock contention reduction V3
This series reduces AIL locking overhead by introducing bulk operations for insert and delete. With delayed logging, we can be doing insert operations on thousands of items at a time, so using a bulk operation to reduce AIL lock traffic is a major win in terms of reducing contention on the lock.
Similarly, when we have inode buffer IO completion running on multiple CPUs at once, the AIl lock contention from each individual AIL removal is significant. By batching all the inodes on the buffer to be removed from the AIL in a single bulk operation, contention on the AIL is reduced by an order of magnitude.
Finally, there is a modification to the xfsaild wakeup code to prevent too many wakeups when the xfsaild is pausing waiting for some work to complete. This prevents an excessive number of AIL scanning traversals by the xfsaild when tail pushing is backing off and waiting for some IO to complete.
In combination, these modification reduce AIL lock contention sufficiently to drop the AIL lock out of the "top 10" contended locks on 8-way fs_mark and dbench workloads.
Version 3:
- split XFS_EFI_CANCELED fixup into separate patch
- initialised efi_next_extent correctly
- converted XFS_EFI_RECOVERED to use correct bit set/clear operations
- removed unneeded clearing of XFS_EFI_COMMITTED in recovery.
- added helper for freeing an EFI.
- cleaned up log item array variable naming.
- cleaned up bulk AIL operation comments.
Version 2:
- split out stale inode AIL insertion bug fix
- split bulk AIL insertion into multiple patches
- EFI/EFD handling changes
- stale inode AIL insertion bug fix
- simplify code calling xfs_ail_delete
- bulk ail insertion modifications
- use atomic_inc_return for extent recording in xfs_trans_log_efi_extent()
- modified AIL sleep code to explicitly set task state as suggested by Christoph.
- split AIL bulk deletion into two patches
- buffer iodone callback modifications
- bulk AIL deletion and inode iodone callback mods.
- removed lip parameter from xfs_buf_do_callbacks() as the loop fetches it from the buffer anyway.
- fixed unused variable warning in xfs_buf_do_callbacks().
- added two new patches to reduce code duplication
- use AIL bulk insertion function to implement single updates
- use AIL bulk delete function to implement single deletes
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/9 xfs: fix EFI transaction cancellation.
From: Dave Chinner <[email protected]>
XFS_EFI_CANCELED has not been set in the code base since xfs_efi_cancel() was removed back in 2006 by commit 065d312e15902976d256ddaf396a7950ec0350a8 ("[XFS] Remove unused iop_abort log item operation), and even then xfs_efi_cancel() was never called. I haven't tracked it back further than that (beyond git history), but it indicates that the handling of EFIs in cancelled transactions has been broken for a long time.
Basically, when we get an IOP_UNPIN(lip, 1); call from xfs_trans_uncommit() (i.e. remove == 1), if we don't free the log item descriptor we leak it. Fix the behviour to be correct and kill the XFS_EFI_CANCELED flag.
--- fs/xfs/xfs_extfree_item.c | 20 +++++++++----------- fs/xfs/xfs_extfree_item.h | 1 - 2 files changed, 9 insertions(+), 12 deletions(-)
fs/xfs/xfs_extfree_item.c +9 -11
@@ -99,10 +99,11 @@ xfs_efi_item_pin( }/* -* While EFIs cannot really be pinned, the unpin operation is the -* last place at which the EFI is manipulated during a transaction. -* Here we coordinate with xfs_efi_cancel() to determine who gets to -* free the EFI. +* While EFIs cannot really be pinned, the unpin operation is the last place at +* which the EFI is manipulated during a transaction. If we are being asked to +* remove the EFI it's because the transaction has been cancelled and by +* definition that means the EFI cannot be in the AIL so remove it from the +* transaction and free it. */ STATIC void xfs_efi_item_unpin(
@@ -113,17 +114,14 @@ xfs_efi_item_unpin(struct xfs_ail *ailp = lip->li_ailp;spin_lock (&ailp->xa_lock); -if (efip->efi_flags &XFS_EFI_CANCELED ) { -if (remove) -xfs_trans_del_item (lip); - -/* xfs_trans_ail_delete() drops the AIL lock. */ -xfs_trans_ail_delete (ailp, lip); +if (remove) { +ASSERT (!(lip->li_flags &XFS_LI_IN_AIL )); +xfs_trans_del_item (lip);xfs_efi_item_free (efip); }else { efip->efi_flags |=XFS_EFI_COMMITTED ; -spin_unlock (&ailp->xa_lock); } +spin_unlock (&ailp->xa_lock); }/*
fs/xfs/xfs_extfree_item.h +0 -1
@@ -115,7 +115,6 @@ typedef struct xfs_efd_log_format_64 {*/ #define XFS_EFI_RECOVERED 0x1#define XFS_EFI_COMMITTED 0x2 -#define XFS_EFI_CANCELED 0x4/* * This is the "extent free intention" log item. It is used
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/9] xfs: fix EFI transaction cancellation.
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/9 xfs: Pull EFI/EFD handling out from under the AIL lock
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
EFI/EFD interactions are protected from races by the AIL lock. They are the only type of log items that require the the AIL lock to serialise internal state, so they need to be separated from the AIL lock before we can do bulk insert operations on the AIL.
To acheive this, convert the counter of the number of extents in the EFI to an atomic so it can be safely manipulated by EFD processing without locks. Also, convert the EFI state flag manipulations to use atomic bit operations so no locks are needed to record state changes. Finally, use the state bits to determine when it is safe to free the EFI and clean up the code to do this neatly.
--- fs/xfs/xfs_extfree_item.c | 81 ++++++++++++++++++++++++------------------- fs/xfs/xfs_extfree_item.h | 10 +++--- fs/xfs/xfs_log_recover.c | 9 ++--- fs/xfs/xfs_trans_extfree.c | 8 +++- 4 files changed, 60 insertions(+), 48 deletions(-)
fs/xfs/xfs_extfree_item.c +45 -36
@@ -48,6 +48,28 @@ xfs_efi_item_free( }/* +* Freeing the efi requires that we remove it from the AIL if it has already +* been placed there. However, the EFI may not yet have been placed in the AIL +* when called by xfs_efi_release() from EFD processing due to the ordering of +* committed vs unpin operations in bulk insert operations. Hence the +* test_and_clear_bit(XFS_EFI_COMMITTED) to ensure only the last caller frees +* the EFI. +*/ +STATIC void +__xfs_efi_release ( +struct xfs_efi_log_item *efip) +{ +struct xfs_ail *ailp = efip->efi_item.li_ailp; + +if (!test_and_clear_bit (XFS_EFI_COMMITTED , &efip->efi_flags)) { +spin_lock (&ailp->xa_lock); +/* xfs_trans_ail_delete() drops the AIL lock. */ +xfs_trans_ail_delete (ailp, (xfs_log_item_t *)efip); +xfs_efi_item_free (efip); + } +} + +/* * This returns the number of iovecs needed to log the given efi item. * We only need 1 iovec for an efi item. It just logs the efi_log_format * structure.
@@ -74,7 +96,8 @@ xfs_efi_item_format(struct xfs_efi_log_item *efip =EFI_ITEM (lip);uint size; -ASSERT (efip->efi_next_extent == efip->efi_format.efi_nextents); +ASSERT (atomic_read (&efip->efi_next_extent) == + efip->efi_format.efi_nextents); efip->efi_format.efi_type =XFS_LI_EFI ;
@@ -103,7 +126,8 @@ xfs_efi_item_pin(* which the EFI is manipulated during a transaction. If we are being asked to * remove the EFI it's because the transaction has been cancelled and by * definition that means the EFI cannot be in the AIL so remove it from the -* transaction and free it. +* transaction and free it. Otherwise coordinate with xfs_efi_release() (via +* XFS_EFI_COMMITTED) to determine who gets to free the EFI. */ STATIC void xfs_efi_item_unpin(
@@ -111,17 +135,14 @@ xfs_efi_item_unpin( int remove) {struct xfs_efi_log_item *efip =EFI_ITEM (lip); -struct xfs_ail *ailp = lip->li_ailp; -spin_lock (&ailp->xa_lock);if (remove) {ASSERT (!(lip->li_flags &XFS_LI_IN_AIL ));xfs_trans_del_item (lip);xfs_efi_item_free (efip); - }else { - efip->efi_flags |=XFS_EFI_COMMITTED ; +return ; } -spin_unlock (&ailp->xa_lock); +__xfs_efi_release (efip); }/*
@@ -150,16 +171,20 @@ xfs_efi_item_unlock( }/* -* The EFI is logged only once and cannot be moved in the log, so -* simply return the lsn at which it's been logged. The canceled -* flag is not paid any attention here. Checking for that is delayed -* until the EFI is unpinned. +* The EFI is logged only once and cannot be moved in the log, so simply return +* the lsn at which it's been logged. For bulk transaction committed +* processing, the EFI may be processed but not yet unpinned prior to the EFD +* being processed. Set the XFS_EFI_COMMITTED flag so this case can be detected +* when processing the EFD. */ STATIC xfs_lsn_txfs_efi_item_committed (struct xfs_log_item *lip,xfs_lsn_t lsn) { +struct xfs_efi_log_item *efip =EFI_ITEM (lip); + +set_bit (XFS_EFI_COMMITTED , &efip->efi_flags);return lsn; }
@@ -228,6 +253,7 @@ xfs_efi_init(xfs_log_item_init (mp, &efip->efi_item,XFS_LI_EFI , &xfs_efi_item_ops); efip->efi_format.efi_nextents = nextents; efip->efi_format.efi_id = (__psint_t )(void *)efip; +atomic_set (&efip->efi_next_extent,0 );return efip; }
@@ -287,37 +313,20 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt) }/* -* This is called by the efd item code below to release references to -* the given efi item. Each efd calls this with the number of -* extents that it has logged, and when the sum of these reaches -* the total number of extents logged by this efi item we can free -* the efi item. -* -* Freeing the efi item requires that we remove it from the AIL. -* We'll use the AIL lock to protect our counters as well as -* the removal from the AIL. +* This is called by the efd item code below to release references to the given +* efi item. Each efd calls this with the number of extents that it has +* logged, and when the sum of these reaches the total number of extents logged +* by this efi item we can free the efi item. */ void xfs_efi_release (xfs_efi_log_item_t *efip,uint nextents) { -struct xfs_ail *ailp = efip->efi_item.li_ailp; -int extents_left; +ASSERT (atomic_read (&efip->efi_next_extent) >= nextents); +if (!atomic_sub_and_test (nextents, &efip->efi_next_extent)) +return ; -ASSERT (efip->efi_next_extent >0 ); -ASSERT (efip->efi_flags &XFS_EFI_COMMITTED ); - -spin_lock (&ailp->xa_lock); -ASSERT (efip->efi_next_extent >= nextents); - efip->efi_next_extent -= nextents; - extents_left = efip->efi_next_extent; -if (extents_left ==0 ) { -/* xfs_trans_ail_delete() drops the AIL lock. */ -xfs_trans_ail_delete (ailp, (xfs_log_item_t *)efip); -xfs_efi_item_free (efip); - }else { -spin_unlock (&ailp->xa_lock); - } +__xfs_efi_release (efip); }static inline struct xfs_efd_log_item *EFD_ITEM (struct xfs_log_item *lip)
fs/xfs/xfs_extfree_item.h +5 -5
@@ -111,10 +111,10 @@ typedef struct xfs_efd_log_format_64 {#define XFS_EFI_MAX_FAST_EXTENTS 16/* -* Define EFI flags. +* Define EFI flag bits. Manipulated by set/clear/test_bit operators. */ -#define XFS_EFI_RECOVERED 0x1 -#define XFS_EFI_COMMITTED 0x2 +#define XFS_EFI_RECOVERED 1 +#define XFS_EFI_COMMITTED 2/* * This is the "extent free intention" log item. It is used
@@ -124,8 +124,8 @@ typedef struct xfs_efd_log_format_64 {*/ typedef struct xfs_efi_log_item {xfs_log_item_t efi_item; -uint efi_flags;/* misc flags */ -uint efi_next_extent; +atomic_t efi_next_extent; +unsigned long efi_flags;/* misc flags */ xfs_efi_log_format_t efi_format; }xfs_efi_log_item_t ;
fs/xfs/xfs_log_recover.c +4 -5
@@ -2717,8 +2717,7 @@ xlog_recover_do_efi_trans(xfs_efi_item_free (efip);return error; } - efip->efi_next_extent = efi_formatp->efi_nextents; - efip->efi_flags |=XFS_EFI_COMMITTED ; +atomic_set (&efip->efi_next_extent, efi_formatp->efi_nextents);spin_lock (&log->l_ailp->xa_lock);/*
@@ -3011,7 +3010,7 @@ xlog_recover_process_efi(xfs_extent_t *extp;xfs_fsblock_t startblock_fsb; -ASSERT (!(efip->efi_flags &XFS_EFI_RECOVERED )); +ASSERT (!test_bit (XFS_EFI_RECOVERED , &efip->efi_flags));/* * First check the validity of the extents described by the
@@ -3050,7 +3049,7 @@ xlog_recover_process_efi( extp->ext_len); } - efip->efi_flags |=XFS_EFI_RECOVERED ; +set_bit (XFS_EFI_RECOVERED , &efip->efi_flags); error =xfs_trans_commit (tp,0 );return error;
@@ -3107,7 +3106,7 @@ xlog_recover_process_efis(* Skip EFIs that we've already processed. */ efip = (xfs_efi_log_item_t *)lip; -if (efip->efi_flags &XFS_EFI_RECOVERED ) { +if (test_bit (XFS_EFI_RECOVERED , &efip->efi_flags)) { lip =xfs_trans_ail_cursor_next (ailp, &cur);continue ; }
fs/xfs/xfs_trans_extfree.c +6 -2
@@ -69,12 +69,16 @@ xfs_trans_log_efi_extent(xfs_trans_t *tp, tp->t_flags |=XFS_TRANS_DIRTY ; efip->efi_item.li_desc->lid_flags |=XFS_LID_DIRTY ; - next_extent = efip->efi_next_extent; +/* +* atomic_inc_return gives us the value after the increment; +* we want to use it as an array index so we need to subtract 1 from +* it. +*/ + next_extent =atomic_inc_return (&efip->efi_next_extent) -1 ;ASSERT (next_extent < efip->efi_format.efi_nextents); extp = &(efip->efi_format.efi_extents[next_extent]); extp->ext_start = start_block; extp->ext_len = ext_len; - efip->efi_next_extent++; }
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/9] xfs: Pull EFI/EFD handling out from under the AIL lock
Looks good,
Some minor comments below:
fs/xfs/xfs_extfree_item.c xfs_efi_item_free( · line 67
Quoted 10 lines
fs/xfs/xfs_extfree_item.c +10
-0+STATIC void +__xfs_efi_release ( +struct xfs_efi_log_item *efip) +{ +struct xfs_ail *ailp = efip->efi_item.li_ailp; + +if (!test_and_clear_bit (XFS_EFI_COMMITTED , &efip->efi_flags)) { +spin_lock (&ailp->xa_lock); +/* xfs_trans_ail_delete() drops the AIL lock. */ +xfs_trans_ail_delete (ailp, (xfs_log_item_t *)efip);
The second argument should be &efip->efi_item to preserve ty;e safety.
fs/xfs/xfs_extfree_item.c xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt) · line 329
Quoted 9 lines
void
xfs_efi_release(xfs_efi_log_item_t *efip,fs/xfs/xfs_extfree_item.c +4
-0uint nextents) { +ASSERT (atomic_read (&efip->efi_next_extent) >= nextents); +if (!atomic_sub_and_test (nextents, &efip->efi_next_extent)) +return ; +__xfs_efi_release (efip);
Why not just:
if (atomic_sub_and_test(nextents, &efip->efi_next_extent)) __xfs_efi_release(efip);
?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/9] xfs: Pull EFI/EFD handling out from under the AIL lock
Quoted 27 lines · Christoph Hellwig
Looks good,
Reviewed-by Christoph Hellwig <[email protected]>Some minor comments below:
fs/xfs/xfs_extfree_item.c xfs_efi_item_free( · line 67
Quoted 10 lines
fs/xfs/xfs_extfree_item.c +10
-0+STATIC void +__xfs_efi_release ( +struct xfs_efi_log_item *efip) +{ +struct xfs_ail *ailp = efip->efi_item.li_ailp; + +if (!test_and_clear_bit (XFS_EFI_COMMITTED , &efip->efi_flags)) { +spin_lock (&ailp->xa_lock); +/* xfs_trans_ail_delete() drops the AIL lock. */ +xfs_trans_ail_delete (ailp, (xfs_log_item_t *)efip);The second argument should be
&efip->efi_itemto preserve ty;e safety.Quoted 8 lines
void
xfs_efi_release(xfs_efi_log_item_t *efip,fs/xfs/xfs_extfree_item.c +3
-0uint nextents) { +ASSERT (atomic_read (&efip->efi_next_extent) >= nextents); +if (!atomic_sub_and_test (nextents, &efip->efi_next_extent)) +return ;
Quoted 8 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ __xfs_efi_release(efip);Why not just:
if (atomic_sub_and_test(nextents, &efip->efi_next_extent)) __xfs_efi_release(efip);?
Good idea. Fixed up.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/9 xfs: clean up xfs_ail_delete()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_ail_delete() has a needlessly complex interface. It returns the log item that was passed in for deletion (which the callers then assert is identical to the one passed in), and callers of xfs_ail_delete() still need to invalidate current traversal cursors.
Make xfs_ail_delete() return void, move the cursor invalidation inside it, and clean up the callers just to use the log item pointer they passed in.
While cleaning up, remove the messy and unnecessary "/* ARGUSED */" comments around all these functions.
--- fs/xfs/xfs_trans_ail.c | 27 +++++++-------------------- 1 files changed, 7 insertions(+), 20 deletions(-)
fs/xfs/xfs_trans_ail.c +7 -20
@@ -29,7 +29,7 @@#include "xfs_error.h" STATIC void xfs_ail_insert(struct xfs_ail *, xfs_log_item_t *); -STATIC xfs_log_item_t * xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *); +STATIC void xfs_ail_delete(struct xfs_ail *, xfs_log_item_t *); STATIC xfs_log_item_t * xfs_ail_min(struct xfs_ail *); STATIC xfs_log_item_t * xfs_ail_next(struct xfs_ail *, xfs_log_item_t *);
@@ -468,16 +468,13 @@ xfs_trans_ail_update(xfs_log_item_t *lip, xfs_lsn_t lsn) __releases(ailp->xa_lock) { - xfs_log_item_t *dlip = NULL; xfs_log_item_t *mlip; /* ptr to minimum lip */xfs_lsn_t tail_lsn; mlip =xfs_ail_min (ailp);if (lip->li_flags &XFS_LI_IN_AIL ) { - dlip =xfs_ail_delete (ailp, lip); -ASSERT (dlip == lip); -xfs_trans_ail_cursor_clear (ailp, dlip); +xfs_ail_delete (ailp, lip); }else { lip->li_flags |=XFS_LI_IN_AIL ; }
@@ -485,7 +482,7 @@ xfs_trans_ail_update( lip->li_lsn = lsn;xfs_ail_insert (ailp, lip); -if (mlip == dlip) { +if (mlip == lip) { mlip =xfs_ail_min (ailp);/* * It is not safe to access mlip after the AIL lock is
@@ -524,21 +521,18 @@ xfs_trans_ail_delete(struct xfs_ail *ailp, xfs_log_item_t *lip) __releases(ailp->xa_lock) { - xfs_log_item_t *dlip; xfs_log_item_t *mlip;xfs_lsn_t tail_lsn;if (lip->li_flags &XFS_LI_IN_AIL ) { mlip =xfs_ail_min (ailp); - dlip =xfs_ail_delete (ailp, lip); -ASSERT (dlip == lip); -xfs_trans_ail_cursor_clear (ailp, dlip); +xfs_ail_delete (ailp, lip); lip->li_flags &= ~XFS_LI_IN_AIL ; lip->li_lsn =0 ; -if (mlip == dlip) { +if (mlip == lip) { mlip =xfs_ail_min (ailp);/* * It is not safe to access mlip after the AIL lock
@@ -632,7 +626,6 @@ STATIC voidxfs_ail_insert ( struct xfs_ail *ailp, xfs_log_item_t *lip) -/* ARGSUSED */ { xfs_log_item_t *next_lip;
@@ -661,18 +654,14 @@ xfs_ail_insert(/* * Delete the given item from the AIL. Return a pointer to the item. */ -/*ARGSUSED*/ -STATIC xfs_log_item_t * +STATIC voidxfs_ail_delete (struct xfs_ail *ailp,xfs_log_item_t *lip) -/* ARGSUSED */ {xfs_ail_check (ailp, lip); -list_del (&lip->li_ail); - -return lip; +xfs_trans_ail_cursor_clear (ailp, lip); }/*
@@ -682,7 +671,6 @@ xfs_ail_delete( STATIC xfs_log_item_t *xfs_ail_min (struct xfs_ail *ailp) -/* ARGSUSED */ {if (list_empty (&ailp->xa_ail))return NULL ;
@@ -699,7 +687,6 @@ STATIC xfs_log_item_t * xfs_ail_next( struct xfs_ail *ailp, xfs_log_item_t *lip) -/* ARGSUSED */ {if (lip->li_ail.next == &ailp->xa_ail)return NULL ;
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/9 xfs: bulk AIL insertion during transaction commit
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
When inserting items into the AIL from the transaction committed callbacks, we take the AIL lock for every single item that is to be inserted. For a CIL checkpoint commit, this can be tens of thousands of individual inserts, yet almost all of the items will be inserted at the same point in the AIL because they have the same index.
To reduce the overhead and contention on the AIL lock for such operations, introduce a "bulk insert" operation which allows a list of log items with the same LSN to be inserted in a single operation via a list splice. To do this, we need to pre-sort the log items being committed into a temporary list for insertion.
The complexity is that not every log item will end up with the same LSN, and not every item is actually inserted into the AIL. Items that don't match the commit LSN will be inserted and unpinned as per the current one-at-a-time method (relatively rare), while items that are not to be inserted will be unpinned and freed immediately. Items that are to be inserted at the given commit lsn are placed in a temporary array and inserted into the AIL in bulk each time the array fills up.
As a result of this, we trade off AIL hold time for a significant reduction in traffic. lock_stat output shows that the worst case hold time is unchanged, but contention from AIL inserts drops by an order of magnitude and the number of lock traversal decreases significantly.
--- fs/xfs/xfs_log_cil.c | 9 +--- fs/xfs/xfs_trans.c | 80 +++++++++++++++++++++++++++++++++++- fs/xfs/xfs_trans_ail.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans_priv.h | 10 ++++- 4 files changed, 194 insertions(+), 10 deletions(-)
fs/xfs/xfs_log_cil.c +2 -7
@@ -361,15 +361,10 @@ xlog_cil_committed( int abort) {struct xfs_cil_ctx *ctx = args; -struct xfs_log_vec *lv; -int abortflag = abort ?XFS_LI_ABORTED :0 ;struct xfs_busy_extent *busyp, *n; -/* unpin all the log items */ -for (lv = ctx->lv_chain; lv; lv = lv->lv_next ) { -xfs_trans_item_committed (lv->lv_item, ctx->start_lsn, - abortflag); - } +xfs_trans_committed_bulk (ctx->cil->xc_log->l_ailp, ctx->lv_chain, + ctx->start_lsn, abort);list_for_each_entry_safe (busyp, n, &ctx->busy_extents, list)xfs_alloc_busy_clear (ctx->cil->xc_log->l_mp, busyp);
fs/xfs/xfs_trans.c +79 -1
92 lines not on this page · raw message
fs/xfs/xfs_trans_ail.c +105 -0
123 lines not on this page · raw message
fs/xfs/xfs_trans_priv.h +8 -2
@@ -22,15 +22,17 @@ struct xfs_log_item;struct xfs_log_item_desc ;struct xfs_mount ;struct xfs_trans ; +struct xfs_ail ; +struct xfs_log_vec ;void xfs_trans_add_item (struct xfs_trans *,struct xfs_log_item *);void xfs_trans_del_item (struct xfs_log_item *);void xfs_trans_free_items (struct xfs_trans *tp,xfs_lsn_t commit_lsn,int flags); -void xfs_trans_item_committed (struct xfs_log_item *lip, -xfs_lsn_t commit_lsn,int aborted);void xfs_trans_unreserve_and_mod_sb (struct xfs_trans *tp); +void xfs_trans_committed_bulk (struct xfs_ail *ailp,struct xfs_log_vec *lv, +xfs_lsn_t commit_lsn,int aborted);/* * AIL traversal cursor. *
@@ -76,6 +78,10 @@ struct xfs_ail { void xfs_trans_ail_update(struct xfs_ail *ailp, struct xfs_log_item *lip, xfs_lsn_t lsn) __releases(ailp->xa_lock); +void xfs_trans_ail_update_bulk(struct xfs_ail *ailp, + struct xfs_log_item **log_items, + int nr_items, xfs_lsn_t lsn) + __releases(ailp->xa_lock); void xfs_trans_ail_delete(struct xfs_ail *ailp, struct xfs_log_item *lip) __releases(ailp->xa_lock);
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 4/9] xfs: bulk AIL insertion during transaction commit
Looks good,
Minor style nipicks below:
fs/xfs/xfs_trans.c xfs_trans_committed( · line 1484
Quoted 11 lines
fs/xfs/xfs_trans.c +11
-0+/* +* Not a bulk update option due to unusual item_lsn. +* Push into AIL immediately, rechecking the lsn once +* we have the ail lock. Then unpin the item. +*/ +spin_lock (&ailp->xa_lock); +if (XFS_LSN_CMP (item_lsn, lip->li_lsn) >0 ) { +xfs_trans_ail_update (ailp, lip, item_lsn); + }else { +spin_unlock (&ailp->xa_lock); + }
No need for the curly braces.
fs/xfs/xfs_trans_ail.c xfs_ail_insert( · line 753
Quoted 2 lines
fs/xfs/xfs_trans_ail.c +2
-0+ASSERT ((&next_lip->li_ail == &ailp->xa_ail) || + (XFS_LSN_CMP (next_lip->li_lsn, lsn) <=0 ));
No need for the inner braces.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/9 xfs: reduce the number of AIL push wakeups
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The xfaild often tries to rest to wait for congestion to pass of for IO to complete, but is regularly woken in tail-pushing situations. In severe cases, the xfsaild is getting woken tens of thousands of times a second. Reduce the number needless wakeups by only waking the xfsaild if the new target is larger than the old one. Further make short sleeps uninterruptible as they occur when the xfsaild has decided it needs to back off to allow some IO to complete and being woken early is counter-productive.
--- fs/xfs/linux-2.6/xfs_super.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
fs/xfs/linux-2.6/xfs_super.c +16 -4
@@ -834,8 +834,11 @@ xfsaild_wakeup( struct xfs_ail *ailp, xfs_lsn_t threshold_lsn) { - ailp->xa_target = threshold_lsn; -wake_up_process (ailp->xa_task); +/* only ever move the target forwards */ +if (XFS_LSN_CMP (threshold_lsn, ailp->xa_target) >0 ) { + ailp->xa_target = threshold_lsn; +wake_up_process (ailp->xa_task); + } }STATIC int
@@ -847,8 +850,17 @@ xfsaild(long tout =0 ;/* milliseconds */ while (!kthread_should_stop ()) { -schedule_timeout_interruptible (tout ? -msecs_to_jiffies (tout) :MAX_SCHEDULE_TIMEOUT ); +/* +* for short sleeps indicating congestion, don't allow us to +* get woken early. Otherwise all we do is bang on the AIL lock +* without making progress. +*/ +if (tout && tout <=20 ) +__set_current_state (TASK_KILLABLE ); +else +__set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (tout ? +msecs_to_jiffies (tout) :MAX_SCHEDULE_TIMEOUT );/* swsusp */ try_to_freeze ();
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 5/9] xfs: reduce the number of AIL push wakeups
Quoted 10 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The xfaild often tries to rest to wait for congestion to pass of for IO to complete, but is regularly woken in tail-pushing situations. In severe cases, the xfsaild is getting woken tens of thousands of times a second. Reduce the number needless wakeups by only waking the xfsaild if the new target is larger than the old one. Further make short sleeps uninterruptible as they occur when the xfsaild has decided it needs to back off to allow some IO to complete and being woken early is counter-productive.
This patch causes softlockup warnings in xfsaild for various testcases on my 32-bit x86 VM, but the testcases continue otherwise normally.
Example below:
[ 361.692515] INFO: task xfsaild/vdb5:8705 blocked for more than 120 seconds. [ 361.697272] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 361.703929] xfsaild/vdb5 D 00000000 0 8705 2 0x00000000 [ 361.708148] f4933f10 00000046 f4b37464 00000000 00000000 f4b37100 f4b37100 00000046 [ 361.711501] f4933eb4 00000046 f4b37100 c0936092 f4b37264 f4b37268 00000000 c0d52d00 [ 361.714786] c0d52d08 c0e96c00 f5735d38 f4933ec0 f4b37100 f6946c00 f4933eec c0160553 [ 361.718120] Call Trace: [ 361.721856] [<c0936092>] ? _raw_spin_unlock_irq+0x22/0x30 [ 361.723439] [<c0160553>] ? finish_task_switch+0x73/0x100 [ 361.725056] [<c0160517>] ? finish_task_switch+0x37/0x100 [ 361.726592] [<c09334b3>] ? schedule+0x263/0x9d0 [ 361.727932] [<c0198f4b>] ? trace_hardirqs_off+0xb/0x10 [ 361.729548] [<c0933f05>] schedule_timeout+0x185/0x250 [ 361.731258] [<c09360d5>] ? _raw_spin_unlock_irqrestore+0x35/0x60 [ 361.733037] [<c019c68b>] ? trace_hardirqs_on+0xb/0x10 [ 361.734513] [<c04ed504>] xfsaild+0x54/0xc0 [ 361.735786] [<c04ed4b0>] ? xfsaild+0x0/0xc0 [ 361.737171] [<c0187634>] kthread+0x74/0x80 [ 361.738446] [<c01875c0>] ? kthread+0x0/0x80 [ 361.739987] [<c013507a>] kernel_thread_helper+0x6/0x1c [ 361.741589] no locks held by xfsaild/vdb5/8705.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 5/9] xfs: reduce the number of AIL push wakeups
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The xfaild often tries to rest to wait for congestion to pass of for IO to complete, but is regularly woken in tail-pushing situations. In severe cases, the xfsaild is getting woken tens of thousands of times a second. Reduce the number needless wakeups by only waking the xfsaild if the new target is larger than the old one. Further make short sleeps uninterruptible as they occur when the xfsaild has decided it needs to back off to allow some IO to complete and being woken early is counter-productive.
Quoted 2 lines
This patch causes softlockup warnings in xfsaild for various testcases on my 32-bit x86 VM, but the testcases continue otherwise normally.
What tests?
Quoted 15 lines
Example below:
[ 361.692515] INFO: task xfsaild/vdb5:8705 blocked for more than 120 seconds. [ 361.697272] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 361.703929] xfsaild/vdb5 D 00000000 0 8705 2 0x00000000 [ 361.708148] f4933f10 00000046 f4b37464 00000000 00000000 f4b37100 f4b37100 00000046 [ 361.711501] f4933eb4 00000046 f4b37100 c0936092 f4b37264 f4b37268 00000000 c0d52d00 [ 361.714786] c0d52d08 c0e96c00 f5735d38 f4933ec0 f4b37100 f6946c00 f4933eec c0160553 [ 361.718120] Call Trace: [ 361.721856] [<c0936092>] ? _raw_spin_unlock_irq+0x22/0x30 [ 361.723439] [<c0160553>] ? finish_task_switch+0x73/0x100 [ 361.725056] [<c0160517>] ? finish_task_switch+0x37/0x100 [ 361.726592] [<c09334b3>] ? schedule+0x263/0x9d0 [ 361.727932] [<c0198f4b>] ? trace_hardirqs_off+0xb/0x10 [ 361.729548] [<c0933f05>] schedule_timeout+0x185/0x250
Quoted 8 lines
[ 361.731258] [<c09360d5>] ? _raw_spin_unlock_irqrestore+0x35/0x60 [ 361.733037] [<c019c68b>] ? trace_hardirqs_on+0xb/0x10 [ 361.734513] [<c04ed504>] xfsaild+0x54/0xc0 [ 361.735786] [<c04ed4b0>] ? xfsaild+0x0/0xc0 [ 361.737171] [<c0187634>] kthread+0x74/0x80 [ 361.738446] [<c01875c0>] ? kthread+0x0/0x80 [ 361.739987] [<c013507a>] kernel_thread_helper+0x6/0x1c [ 361.741589] no locks held by xfsaild/vdb5/8705.
So this is saying is that a 20ms uninterruptible sleep lasting for more than 120s? Doesn't that imply some kind of scheduler starvation, not an actual XFS problem?
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 5/9] xfs: reduce the number of AIL push wakeups
Quoted 1 line · Dave Chinner
What tests?
I couldn't really see a pattern yet - it's different ones and different amount of warnings during each run.
Quoted 3 lines
So this is saying is that a 20ms uninterruptible sleep lasting for more than 120s? Doesn't that imply some kind of scheduler starvation, not an actual XFS problem?
It does for sure look odd to me. I'll do a sub-commit bisect between the two hunk in the patch tomorrow to drill a bit deeper into what's going on.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/9 xfs: consume iodone callback items on buffers as they are processed
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
To allow buffer iodone callbacks to consume multiple items off the callback list, first we need to convert the xfs_buf_do_callbacks() to consume items and always pull the next item from the head of the list.
The means the item list walk is never dependent on knowing the next item on the list and hence allows callbacks to remove items from the list as well. This allows callbacks to do bulk operations by scanning the list for identical callbacks, consuming them all and then processing them in bulk, negating the need for multiple callbacks of that type.
--- fs/xfs/xfs_buf_item.c | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-)
fs/xfs/xfs_buf_item.c +21 -11
@@ -142,7 +142,7 @@ xfs_buf_item_log_check(#endif STATIC void xfs_buf_error_relse(xfs_buf_t *bp); -STATIC void xfs_buf_do_callbacks(xfs_buf_t *bp, xfs_log_item_t *lip); +STATIC void xfs_buf_do_callbacks(struct xfs_buf *bp);/* * This returns the number of log iovecs needed to log the
@@ -450,7 +450,7 @@ xfs_buf_item_unpin(* xfs_trans_ail_delete() drops the AIL lock. */ if (bip->bli_flags &XFS_BLI_STALE_INODE ) { -xfs_buf_do_callbacks (bp, (xfs_log_item_t *)bip); +xfs_buf_do_callbacks (bp);XFS_BUF_SET_FSPRIVATE (bp,NULL );XFS_BUF_CLR_IODONE_FUNC (bp); }else {
@@ -918,15 +918,26 @@ xfs_buf_attach_iodone(XFS_BUF_SET_IODONE_FUNC (bp, xfs_buf_iodone_callbacks); } +/* +* We can have many callbacks on a buffer. Running the callbacks individually +* can cause a lot of contention on the AIL lock, so we allow for a single +* callback to be able to scan the remaining lip->li_bio_list for other items +* of the same type and callback to be processed in the first call. +* +* As a result, the loop walking the callback list below will also modify the +* list. it removes the first item from the list and then runs the callback. +* The loop then restarts from the new head of the list. This allows the +* callback to scan and modify the list attached to the buffer and we don't +* have to care about maintaining a next item pointer. +*/ STATIC voidxfs_buf_do_callbacks ( -xfs_buf_t *bp, -xfs_log_item_t *lip) +struct xfs_buf *bp) { -xfs_log_item_t *nlip; +struct xfs_log_item *lip; -while (lip !=NULL ) { - nlip = lip->li_bio_list; + while ((lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *)) != NULL) { +XFS_BUF_SET_FSPRIVATE (bp, lip->li_bio_list);ASSERT (lip->li_cb !=NULL );/* * Clear the next pointer so we don't have any
@@ -936,7 +947,6 @@ xfs_buf_do_callbacks(*/ lip->li_bio_list =NULL ; lip->li_cb (bp, lip); - lip = nlip; } }
@@ -970,7 +980,7 @@ xfs_buf_iodone_callbacks(ASSERT (XFS_BUF_TARGET (bp) == mp->m_ddev_targp);XFS_BUF_SUPER_STALE (bp);trace_xfs_buf_item_iodone (bp, _RET_IP_); -xfs_buf_do_callbacks (bp, lip); +xfs_buf_do_callbacks (bp);XFS_BUF_SET_FSPRIVATE (bp,NULL );XFS_BUF_CLR_IODONE_FUNC (bp);xfs_buf_ioend (bp,0 );
@@ -1029,7 +1039,7 @@ xfs_buf_iodone_callbacks(return ; } -xfs_buf_do_callbacks (bp, lip); +xfs_buf_do_callbacks (bp);XFS_BUF_SET_FSPRIVATE (bp,NULL );XFS_BUF_CLR_IODONE_FUNC (bp);xfs_buf_ioend (bp,0 );
@@ -1063,7 +1073,7 @@ xfs_buf_error_relse(* We have to unpin the pinned buffers so do the * callbacks. */ -xfs_buf_do_callbacks (bp, lip); +xfs_buf_do_callbacks (bp);XFS_BUF_SET_FSPRIVATE (bp,NULL );XFS_BUF_CLR_IODONE_FUNC (bp);XFS_BUF_SET_BRELSE_FUNC (bp,NULL );
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/9 xfs: remove all the inodes on a buffer from the AIL in bulk
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
When inode buffer IO completes, usually all of the inodes are removed from the AIL. This involves processing them one at a time and taking the AIL lock once for every inode. When all CPUs are processing inode IO completions, this causes excessive amount sof contention on the AIL lock.
Instead, change the way we process inode IO completion in the buffer IO done callback. Allow the inode IO done callback to walk the list of IO done callbacks and pull all the inodes off the buffer in one go and then process them as a batch.
Once all the inodes for removal are collected, take the AIL lock once and do a bulk removal operation to minimise traffic on the AIL lock.
--- fs/xfs/xfs_inode_item.c | 92 ++++++++++++++++++++++++++++++++++++++--------- fs/xfs/xfs_trans_ail.c | 73 +++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans_priv.h | 4 ++ 3 files changed, 152 insertions(+), 17 deletions(-)
fs/xfs/xfs_inode_item.c +74 -16
@@ -842,15 +842,64 @@ xfs_inode_item_destroy(* flushed to disk. It is responsible for removing the inode item * from the AIL if it has not been re-logged, and unlocking the inode's * flush lock. +* +* To reduce AIL lock traffic as much as possible, we scan the buffer log item +* list for other inodes that will run this function. We remove them from the +* buffer list so we can process all the inode IO completions in one AIL lock +* traversal. */ void xfs_iflush_done (struct xfs_buf *bp,struct xfs_log_item *lip) { -struct xfs_inode_log_item *iip =INODE_ITEM (lip); -xfs_inode_t *ip = iip->ili_inode; +struct xfs_inode_log_item *iip; +struct xfs_log_item *blip; +struct xfs_log_item *next; +struct xfs_log_item *prev;struct xfs_ail *ailp = lip->li_ailp; +int need_ail =0 ; + +/* +* Scan the buffer IO completions for other inodes being completed and +* attach them to the current inode log item. +*/ + blip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); + prev =NULL ; +while (blip !=NULL ) { +if (lip->li_cb != xfs_iflush_done) { + prev = blip; + blip = blip->li_bio_list; +continue ; + } + +/* remove from list */ + next = blip->li_bio_list; +if (!prev) { +XFS_BUF_SET_FSPRIVATE (bp, next); + }else { + prev->li_bio_list = next; + } + +/* add to current list */ + blip->li_bio_list = lip->li_bio_list; + lip->li_bio_list = blip; + +/* +* while we have the item, do the unlocked check for needing +* the AIL lock. +*/ + iip =INODE_ITEM (blip); +if (iip->ili_logged && blip->li_lsn == iip->ili_flush_lsn) + need_ail++; + + blip = next; + } + +/* make sure we capture the state of the initial inode. */ + iip =INODE_ITEM (lip); +if (iip->ili_logged && lip->li_lsn == iip->ili_flush_lsn) + need_ail++;/* * We only want to pull the item from the AIL if it is
@@ -861,28 +910,37 @@ xfs_iflush_done(* the lock since it's cheaper, and then we recheck while * holding the lock before removing the inode from the AIL. */ -if (iip->ili_logged && lip->li_lsn == iip->ili_flush_lsn) { +if (need_ail) { +struct xfs_log_item *log_items[need_ail]; +int i =0 ;spin_lock (&ailp->xa_lock); -if (lip->li_lsn == iip->ili_flush_lsn) { -/* xfs_trans_ail_delete() drops the AIL lock. */ -xfs_trans_ail_delete (ailp, lip); - }else { -spin_unlock (&ailp->xa_lock); +for (blip = lip; blip; blip = blip->li_bio_list) { + iip =INODE_ITEM (blip); +if (iip->ili_logged && + blip->li_lsn == iip->ili_flush_lsn) { + log_items[i++] = blip; + } +ASSERT (i <= need_ail); } +/* xfs_trans_ail_delete_bulk() drops the AIL lock. */ +xfs_trans_ail_delete_bulk (ailp, log_items, i); } - iip->ili_logged =0 ;/* -* Clear the ili_last_fields bits now that we know that the -* data corresponding to them is safely on disk. +* clean up and unlock the flush lock now we are done. We can clear the +* ili_last_fields bits now that we know that the data corresponding to +* them is safely on disk. */ - iip->ili_last_fields =0 ; +for (blip = lip; blip; blip = next) { + next = blip->li_bio_list; + blip->li_bio_list =NULL ; -/* -* Release the inode's flush lock since we're done with it. -*/ -xfs_ifunlock (ip); + iip =INODE_ITEM (blip); + iip->ili_logged =0 ; + iip->ili_last_fields =0 ; +xfs_ifunlock (iip->ili_inode); + } }/*
fs/xfs/xfs_trans_ail.c +73 -0
79 lines not on this page · raw message
fs/xfs/xfs_trans_priv.h +4 -0
@@ -85,6 +85,10 @@ void xfs_trans_ail_update_bulk(struct xfs_ail *ailp, void xfs_trans_ail_delete(struct xfs_ail *ailp, struct xfs_log_item *lip) __releases(ailp->xa_lock); +void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, + struct xfs_log_item **log_items, + int nr_items) + __releases(ailp->xa_lock);void xfs_trans_ail_push (struct xfs_ail *,xfs_lsn_t );void xfs_trans_unlocked_item (struct xfs_ail *,xfs_log_item_t *);
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 7/9] xfs: remove all the inodes on a buffer from the AIL in bulk
Looks good for now,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/9 xfs: use AIL bulk delete function to implement single delete
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
We now have two copies of AIL delete operations that are mostly duplicate functionality. The single log item deletes can be implemented via the bulk updates by turning xfs_trans_ail_delete() into a simple wrapper. This removes all the duplicate delete functionality and associated helpers.
--- fs/xfs/xfs_trans_ail.c | 65 ----------------------------------------------- fs/xfs/xfs_trans_priv.h | 20 +++++++++----- 2 files changed, 13 insertions(+), 72 deletions(-)
fs/xfs/xfs_trans_ail.c +0 -65
@@ -523,70 +523,6 @@ xfs_trans_ail_update_bulk( }/* -* Delete the given item from the AIL. It must already be in -* the AIL. -* -* Wakeup anyone with an lsn less than item's lsn. If the item -* we delete in the AIL is the minimum one, update the tail lsn in the -* log manager. -* -* Clear the IN_AIL flag from the item, reset its lsn to 0, and -* bump the AIL's generation count to indicate that the tree -* has changed. -* -* This function must be called with the AIL lock held. The lock -* is dropped before returning. -*/ -void -xfs_trans_ail_delete ( -struct xfs_ail *ailp, - xfs_log_item_t *lip) __releases(ailp->xa_lock) -{ -xfs_log_item_t *mlip; -xfs_lsn_t tail_lsn; - -if (lip->li_flags &XFS_LI_IN_AIL ) { - mlip =xfs_ail_min (ailp); -xfs_ail_delete (ailp, lip); - - - lip->li_flags &= ~XFS_LI_IN_AIL ; - lip->li_lsn =0 ; - -if (mlip == lip) { - mlip =xfs_ail_min (ailp); -/* -* It is not safe to access mlip after the AIL lock -* is dropped, so we must get a copy of li_lsn -* before we do so. This is especially important -* on 32-bit platforms where accessing and updating -* 64-bit values like li_lsn is not atomic. -*/ - tail_lsn = mlip ? mlip->li_lsn :0 ; -spin_unlock (&ailp->xa_lock); -xfs_log_move_tail (ailp->xa_mount, tail_lsn); - }else { -spin_unlock (&ailp->xa_lock); - } - } -else { -/* -* If the file system is not being shutdown, we are in -* serious trouble if we get to this stage. -*/ -struct xfs_mount *mp = ailp->xa_mount; - -spin_unlock (&ailp->xa_lock); -if (!XFS_FORCED_SHUTDOWN (mp)) { -xfs_cmn_err (XFS_PTAG_AILDELETE ,CE_ALERT , mp, -"%s: attempting to delete a log item that is not in the AIL" , - __func__); -xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE ); - } - } -} - -/* * xfs_trans_ail_delete_bulk - remove multiple log items from the AIL * * @xfs_trans_ail_delete_bulk takes an array of log items that all need to
@@ -660,7 +596,6 @@ xfs_trans_ail_delete_bulk(xfs_log_move_tail (ailp->xa_mount, tail_lsn); } -/* * The active item list (AIL) is a doubly linked list of log * items sorted by ascending lsn. The base of the list is
fs/xfs/xfs_trans_priv.h +13 -7
@@ -89,13 +89,19 @@ xfs_trans_ail_update(xfs_trans_ail_update_bulk (ailp, log_items,1 , lsn); } -void xfs_trans_ail_delete(struct xfs_ail *ailp, - struct xfs_log_item *lip) - __releases(ailp->xa_lock); -void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, - struct xfs_log_item **log_items, - int nr_items) - __releases(ailp->xa_lock); +void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp, + struct xfs_log_item **log_items, int nr_items) + __releases(ailp->xa_lock); +static inline void +xfs_trans_ail_delete ( +struct xfs_ail *ailp, + xfs_log_item_t *lip) __releases(ailp->xa_lock) +{ +struct xfs_log_item *log_items[1 ] = { lip, }; + +xfs_trans_ail_delete_bulk (ailp, log_items,1 ); +} +void xfs_trans_ail_push (struct xfs_ail *,xfs_lsn_t );void xfs_trans_unlocked_item (struct xfs_ail *,xfs_log_item_t *);
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 9/9] xfs: use AIL bulk delete function to implement single delete
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
We now have two copies of AIL delete operations that are mostly duplicate functionality. The single log item deletes can be implemented via the bulk updates by turning
xfs_trans_ail_delete()into a simple wrapper. This removes all the duplicate delete functionality and associated helpers.
Looks good,
The same comment about just taking the address as for the previous patch applies.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs