- else
- return lqs;
-}
-
-struct lustre_qunit_size *quota_search_lqs(unsigned long long lqs_key,
- struct lustre_quota_ctxt *qctxt,
- int create)
-{
- struct lustre_qunit_size *lqs;
- int rc = 0;
-
- search_lqs:
- lqs = cfs_hash_lookup(qctxt->lqc_lqs_hash, &lqs_key);
- if (IS_ERR(lqs))
- GOTO(out, rc = PTR_ERR(lqs));
-
- if (create && lqs == NULL) {
- /* if quota_create_lqs is successful, it will get a
- * ref to the lqs. The ref will be released when
- * qctxt_cleanup() or quota is nullified */
- lqs = quota_create_lqs(lqs_key, qctxt);
- if (IS_ERR(lqs))
- rc = PTR_ERR(lqs);
- if (rc == -EALREADY)
- GOTO(search_lqs, rc = 0);
- /* get a reference for the caller when creating lqs
- * successfully */
- if (rc == 0)
- lqs_getref(lqs);