trace_xfs_dqget_hit(dqp);
XFS_STATS_INC(mp, xs_qm_dqcachehits);
- mutex_lock(&dqp->q_qlock);
return dqp;
}
/*
* Try to insert a new dquot into the in-core cache. If an error occurs the
* caller should throw away the dquot and start over. Otherwise, the dquot
- * is returned locked (and held by the cache) as if there had been a cache
- * hit.
+ * is returned (and held by the cache) as if there had been a cache hit.
*
* The insert needs to be done under memalloc_nofs context because the radix
* tree can do memory allocation during insert. The qi->qi_tree_lock is taken in
goto out_unlock;
}
- /* Return a locked dquot to the caller, with a reference taken. */
- mutex_lock(&dqp->q_qlock);
lockref_init(&dqp->q_lockref);
qi->qi_dquots++;
restart:
dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
- if (dqp) {
- *O_dqpp = dqp;
- return 0;
- }
+ if (dqp)
+ goto found;
error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
if (error)
}
trace_xfs_dqget_miss(dqp);
+found:
*O_dqpp = dqp;
+ mutex_lock(&dqp->q_qlock);
return 0;
}
restart:
dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
- if (dqp) {
- *O_dqpp = dqp;
- return 0;
- }
+ if (dqp)
+ goto found;
/*
* Dquot cache miss. We don't want to keep the inode lock across
if (dqp1) {
xfs_qm_dqdestroy(dqp);
dqp = dqp1;
- mutex_lock(&dqp->q_qlock);
goto dqret;
}
} else {
dqret:
xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
trace_xfs_dqget_miss(dqp);
+found:
*O_dqpp = dqp;
+ mutex_lock(&dqp->q_qlock);
return 0;
}