diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-12-06 21:58:17 +0000 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2011-12-13 16:46:28 -0600 |
commit | be7ffc38a80a78e6b68d0f51fae8e8d57b55324c (patch) | |
tree | bb5ca49fd1dc92051e9898a653d7bdd26c93af59 /fs/xfs/xfs_qm.c | |
parent | 80a376bfb7f8ff8f1942cb1bdd0052e908918252 (diff) |
xfs: implement lazy removal for the dquot freelist
Do not remove dquots from the freelist when we grab a reference to them in
xfs_qm_dqlookup, but leave them on the freelist util scanning notices that
they have a reference. This speeds up the lookup fastpath, and greatly
simplifies the lock ordering constraints. Note that the same scheme is
used by the VFS inode and dentry caches.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_qm.c')
-rw-r--r-- | fs/xfs/xfs_qm.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index be1df6839237..6a0c4f0d9306 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -517,13 +517,12 @@ xfs_qm_dqpurge_int( * get them off mplist and hashlist, but leave them on freelist. */ list_for_each_entry_safe(dqp, n, &q->qi_dqlist, q_mplist) { - /* - * It's OK to look at the type without taking dqlock here. - * We're holding the mplist lock here, and that's needed for - * a dqreclaim. - */ - if ((dqp->dq_flags & dqtype) == 0) + xfs_dqlock(dqp); + if ((dqp->dq_flags & dqtype) == 0) { + xfs_dqunlock(dqp); continue; + } + xfs_dqunlock(dqp); if (!mutex_trylock(&dqp->q_hash->qh_lock)) { nrecl = q->qi_dqreclaims; @@ -1692,14 +1691,15 @@ again: xfs_dqlock(dqp); /* - * We are racing with dqlookup here. Naturally we don't - * want to reclaim a dquot that lookup wants. We release the - * freelist lock and start over, so that lookup will grab - * both the dquot and the freelistlock. + * This dquot has already been grabbed by dqlookup. + * Remove it from the freelist and try again. */ - if (dqp->dq_flags & XFS_DQ_WANT) { + if (dqp->q_nrefs) { trace_xfs_dqreclaim_want(dqp); XQM_STATS_INC(xqmstats.xs_qm_dqwants); + + list_del_init(&dqp->q_freelist); + xfs_Gqm->qm_dqfrlist_cnt--; restarts++; startagain = 1; goto dqunlock; |