diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-12-06 16:58:15 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2011-12-13 12:43:35 -0500 |
commit | 497507b9ee63499d364ad7149c584285cd925dfc (patch) | |
tree | a0377653cae16e61443a6fb46bd52b511f28e86f /fs/xfs | |
parent | 800b484ec0262946262ad20561a8081fd31f4a6f (diff) |
xfs: cleanup xfs_qm_dqlookup
Rearrange the code to avoid the conditional locking around the flist_locked
variable. This means we lose a (rather pointless) assert, and hold the
freelist lock a bit longer for one corner case.
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')
-rw-r--r-- | fs/xfs/xfs_dquot.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c index 13eef1f92d20..2a9ffc1086bc 100644 --- a/fs/xfs/xfs_dquot.c +++ b/fs/xfs/xfs_dquot.c | |||
@@ -710,12 +710,9 @@ xfs_qm_dqlookup( | |||
710 | xfs_dquot_t **O_dqpp) | 710 | xfs_dquot_t **O_dqpp) |
711 | { | 711 | { |
712 | xfs_dquot_t *dqp; | 712 | xfs_dquot_t *dqp; |
713 | uint flist_locked; | ||
714 | 713 | ||
715 | ASSERT(mutex_is_locked(&qh->qh_lock)); | 714 | ASSERT(mutex_is_locked(&qh->qh_lock)); |
716 | 715 | ||
717 | flist_locked = B_FALSE; | ||
718 | |||
719 | /* | 716 | /* |
720 | * Traverse the hashchain looking for a match | 717 | * Traverse the hashchain looking for a match |
721 | */ | 718 | */ |
@@ -750,31 +747,19 @@ xfs_qm_dqlookup( | |||
750 | xfs_dqlock(dqp); | 747 | xfs_dqlock(dqp); |
751 | dqp->dq_flags &= ~(XFS_DQ_WANT); | 748 | dqp->dq_flags &= ~(XFS_DQ_WANT); |
752 | } | 749 | } |
753 | flist_locked = B_TRUE; | ||
754 | } | ||
755 | |||
756 | /* | ||
757 | * id couldn't have changed; we had the hashlock all | ||
758 | * along | ||
759 | */ | ||
760 | ASSERT(be32_to_cpu(dqp->q_core.d_id) == id); | ||
761 | 750 | ||
762 | if (flist_locked) { | 751 | if (dqp->q_nrefs == 0) { |
763 | if (dqp->q_nrefs != 0) { | ||
764 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); | ||
765 | flist_locked = B_FALSE; | ||
766 | } else { | ||
767 | /* take it off the freelist */ | 752 | /* take it off the freelist */ |
768 | trace_xfs_dqlookup_freelist(dqp); | 753 | trace_xfs_dqlookup_freelist(dqp); |
769 | list_del_init(&dqp->q_freelist); | 754 | list_del_init(&dqp->q_freelist); |
770 | xfs_Gqm->qm_dqfrlist_cnt--; | 755 | xfs_Gqm->qm_dqfrlist_cnt--; |
771 | } | 756 | } |
757 | XFS_DQHOLD(dqp); | ||
758 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); | ||
759 | } else { | ||
760 | XFS_DQHOLD(dqp); | ||
772 | } | 761 | } |
773 | 762 | ||
774 | XFS_DQHOLD(dqp); | ||
775 | |||
776 | if (flist_locked) | ||
777 | mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock); | ||
778 | /* | 763 | /* |
779 | * move the dquot to the front of the hashchain | 764 | * move the dquot to the front of the hashchain |
780 | */ | 765 | */ |