Skip to content

Commit

Permalink
[XFS] Make xfs_ail_check check less by default
Browse files Browse the repository at this point in the history
Checking the entire AIL on every insert and remove is prohibitively
expensive - the sustained sequntial create rate on a single disk drops
from about 1800/s to 60/s because of this checking resulting in the
xfslogd becoming cpu bound.

By default on debug builds, only check the next and previous entries in
the list to ensure they are ordered correctly. If you really want, define
XFS_TRANS_DEBUG to use the old behaviour.

SGI-PV: 972759
SGI-Modid: xfs-linux-melb:xfs-kern:30372a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
  • Loading branch information
David Chinner authored and Lachlan McIlroy committed Feb 7, 2008
1 parent 249a8c1 commit de08dbc
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions fs/xfs/xfs_trans_ail.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ STATIC xfs_log_item_t * xfs_ail_min(xfs_ail_entry_t *);
STATIC xfs_log_item_t * xfs_ail_next(xfs_ail_entry_t *, xfs_log_item_t *);

#ifdef DEBUG
STATIC void xfs_ail_check(xfs_ail_entry_t *);
STATIC void xfs_ail_check(xfs_ail_entry_t *, xfs_log_item_t *);
#else
#define xfs_ail_check(a)
#define xfs_ail_check(a,l)
#endif /* DEBUG */


Expand Down Expand Up @@ -563,7 +563,7 @@ xfs_ail_insert(
next_lip->li_ail.ail_forw = lip;
lip->li_ail.ail_forw->li_ail.ail_back = lip;

xfs_ail_check(base);
xfs_ail_check(base, lip);
return;
}

Expand All @@ -577,12 +577,12 @@ xfs_ail_delete(
xfs_log_item_t *lip)
/* ARGSUSED */
{
xfs_ail_check(base, lip);
lip->li_ail.ail_forw->li_ail.ail_back = lip->li_ail.ail_back;
lip->li_ail.ail_back->li_ail.ail_forw = lip->li_ail.ail_forw;
lip->li_ail.ail_forw = NULL;
lip->li_ail.ail_back = NULL;

xfs_ail_check(base);
return lip;
}

Expand Down Expand Up @@ -626,13 +626,13 @@ xfs_ail_next(
*/
STATIC void
xfs_ail_check(
xfs_ail_entry_t *base)
xfs_ail_entry_t *base,
xfs_log_item_t *lip)
{
xfs_log_item_t *lip;
xfs_log_item_t *prev_lip;

lip = base->ail_forw;
if (lip == (xfs_log_item_t*)base) {
prev_lip = base->ail_forw;
if (prev_lip == (xfs_log_item_t*)base) {
/*
* Make sure the pointers are correct when the list
* is empty.
Expand All @@ -641,10 +641,28 @@ xfs_ail_check(
return;
}

/*
* Check the next and previous entries are valid.
*/
ASSERT((lip->li_flags & XFS_LI_IN_AIL) != 0);
prev_lip = lip->li_ail.ail_back;
if (prev_lip != (xfs_log_item_t*)base) {
ASSERT(prev_lip->li_ail.ail_forw == lip);
ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) <= 0);
}
prev_lip = lip->li_ail.ail_forw;
if (prev_lip != (xfs_log_item_t*)base) {
ASSERT(prev_lip->li_ail.ail_back == lip);
ASSERT(XFS_LSN_CMP(prev_lip->li_lsn, lip->li_lsn) >= 0);
}


#ifdef XFS_TRANS_DEBUG
/*
* Walk the list checking forward and backward pointers,
* lsn ordering, and that every entry has the XFS_LI_IN_AIL
* flag set.
* flag set. This is really expensive, so only do it when
* specifically debugging the transaction subsystem.
*/
prev_lip = (xfs_log_item_t*)base;
while (lip != (xfs_log_item_t*)base) {
Expand All @@ -659,5 +677,6 @@ xfs_ail_check(
}
ASSERT(lip == (xfs_log_item_t*)base);
ASSERT(base->ail_back == prev_lip);
#endif /* XFS_TRANS_DEBUG */
}
#endif /* DEBUG */

0 comments on commit de08dbc

Please sign in to comment.