name++;
/* the filename is composed of the most signicant bits of the global
- * FID, that's to say the oid which encodes the pool id, pool type and
+ * FID, that's to say the oid which encodes the pool type and
* quota type, followed by the export UUID */
sprintf(filename, "0x%x-%s", glb_fid->f_oid, name);
if (IS_ERR(qt_dir))
GOTO(out, rc = PTR_ERR(qt_dir));
- if (!dt_try_as_dir(env, qt_dir))
+ if (!dt_try_as_dir(env, qt_dir, true))
GOTO(out, rc = -ENOTDIR);
EXIT;
out:
idx_feat = &dt_quota_glb_features;
/* the filename is composed of the most signicant bits of the FID,
- * that's to say the oid which encodes the pool id, pool type and quota
- * type */
+ * that's to say the oid which encodes the pool type and quota type */
sprintf(qti->qti_buf, "0x%x", fid->f_oid);
if (local) {
if (local) {
int pool_type, qtype;
- rc = lquota_extract_fid(glb_fid, NULL, &pool_type, &qtype);
+ rc = lquota_extract_fid(glb_fid, &pool_type, &qtype);
if (rc)
RETURN(ERR_PTR(rc));
if (qti->qti_fid.f_seq != FID_SEQ_QUOTA)
goto next;
- rc = func(env, glb_fid, (char *)key, &qti->qti_fid, arg);
+ rc = func(env, glb_fid, qti->qti_buf, &qti->qti_fid, arg);
if (rc)
break;
next:
return rc;
}
+int lquota_disk_delete(const struct lu_env *env, struct thandle *th,
+ struct dt_object *obj, __u64 qid, __u64 *ver)
+{
+ struct lquota_thread_info *qti = lquota_info(env);
+ struct dt_key *key = (struct dt_key *)&qid;
+ int rc;
+
+ ENTRY;
+
+ LASSERT(dt_object_exists(obj));
+ LASSERT(obj->do_index_ops != NULL);
+
+ /* lock index */
+ dt_write_lock(env, obj, 0);
+
+ /* check whether there is already an existing record for this ID */
+ rc = dt_lookup(env, obj, (struct dt_rec *)&qti->qti_rec, key);
+ if (rc == 0) {
+ rc = dt_delete(env, obj, key, th);
+ if (rc == 0 && ver != NULL) {
+ *ver = dt_version_get(env, obj);
+ (*ver)++;
+ dt_version_set(env, obj, *ver, th);
+ }
+ }
+
+ dt_write_unlock(env, obj);
+ RETURN(rc);
+}
+
/*
* Update version of an index file
*