Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269917
b: refs/heads/master
c: 670ce93
h: refs/heads/master
i:
  269915: fa22a4f
v: v3
  • Loading branch information
Dave Chinner authored and Alex Elder committed Oct 12, 2011
1 parent a466a96 commit 095a3e8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3815832a2aa4df9815d15dac05227e0c8551833f
refs/heads/master: 670ce93fef93bba8c8a422a79747385bec8e846a
33 changes: 20 additions & 13 deletions trunk/fs/xfs/xfs_trans_ail.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,24 @@ xfs_ail_worker(
xfs_lsn_t lsn;
xfs_lsn_t target;
long tout = 10;
int flush_log = 0;
int stuck = 0;
int count = 0;
int push_xfsbufd = 0;

/*
* If last time we ran we encountered pinned items, force the log first
* and wait for it before pushing again.
*/
spin_lock(&ailp->xa_lock);
if (ailp->xa_last_pushed_lsn == 0 && ailp->xa_log_flush &&
!list_empty(&ailp->xa_ail)) {
ailp->xa_log_flush = 0;
spin_unlock(&ailp->xa_lock);
XFS_STATS_INC(xs_push_ail_flush);
xfs_log_force(mp, XFS_LOG_SYNC);
spin_lock(&ailp->xa_lock);
}

target = ailp->xa_target;
lip = xfs_trans_ail_cursor_first(ailp, &cur, ailp->xa_last_pushed_lsn);
if (!lip || XFS_FORCED_SHUTDOWN(mp)) {
Expand Down Expand Up @@ -435,7 +447,7 @@ xfs_ail_worker(
case XFS_ITEM_PINNED:
XFS_STATS_INC(xs_push_ail_pinned);
stuck++;
flush_log = 1;
ailp->xa_log_flush++;
break;

case XFS_ITEM_LOCKED:
Expand Down Expand Up @@ -480,16 +492,6 @@ xfs_ail_worker(
xfs_trans_ail_cursor_done(ailp, &cur);
spin_unlock(&ailp->xa_lock);

if (flush_log) {
/*
* If something we need to push out was pinned, then
* push out the log so it will become unpinned and
* move forward in the AIL.
*/
XFS_STATS_INC(xs_push_ail_flush);
xfs_log_force(mp, 0);
}

if (push_xfsbufd) {
/* we've got delayed write buffers to flush */
wake_up_process(mp->m_ddev_targp->bt_task);
Expand All @@ -500,6 +502,7 @@ xfs_ail_worker(
if (!count) {
/* We're past our target or empty, so idle */
ailp->xa_last_pushed_lsn = 0;
ailp->xa_log_flush = 0;

/*
* We clear the XFS_AIL_PUSHING_BIT first before checking
Expand Down Expand Up @@ -532,9 +535,13 @@ xfs_ail_worker(
* were stuck.
*
* Backoff a bit more to allow some I/O to complete before
* continuing from where we were.
* restarting from the start of the AIL. This prevents us
* from spinning on the same items, and if they are pinned will
* all the restart to issue a log force to unpin the stuck
* items.
*/
tout = 20;
ailp->xa_last_pushed_lsn = 0;
}

/* There is more to do, requeue us. */
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/xfs/xfs_trans_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct xfs_ail {
struct delayed_work xa_work;
xfs_lsn_t xa_last_pushed_lsn;
unsigned long xa_flags;
int xa_log_flush;
};

#define XFS_AIL_PUSHING_BIT 0
Expand Down

0 comments on commit 095a3e8

Please sign in to comment.