X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Flquota_disk.c;h=c823873fb625462f74db6d795e49830467694f52;hb=c3a836364892cacbc4737645893b094971c6ec49;hp=ee416731944905f42913bf18f19719558a7b67b4;hpb=d20d17e9cb62333616b2ba197c727887d5d8f77c;p=fs%2Flustre-release.git diff --git a/lustre/quota/lquota_disk.c b/lustre/quota/lquota_disk.c index ee41673..c823873 100644 --- a/lustre/quota/lquota_disk.c +++ b/lustre/quota/lquota_disk.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, 2014, Intel Corporation. + * Copyright (c) 2012, 2017, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -64,10 +64,10 @@ lquota_disk_find_create(const struct lu_env *env, struct dt_device *dev, const struct dt_index_features *idx_feat, char *name) { - struct lquota_thread_info *qti = lquota_info(env); - struct dt_object *obj; - struct local_oid_storage *los; - int rc; + struct lquota_thread_info *qti = lquota_info(env); + struct dt_object *obj; + struct local_oid_storage *los; + int rc; ENTRY; /* Set up local storage */ @@ -84,7 +84,7 @@ lquota_disk_find_create(const struct lu_env *env, struct dt_device *dev, /* local_oid_storage_fini() will finalize the local storage device, * we have to open the object in another device stack */ qti->qti_fid = obj->do_lu.lo_header->loh_fid; - lu_object_put_nocache(env, &obj->do_lu); + dt_object_put_nocache(env, obj); obj = dt_locate(env, dev, &qti->qti_fid); if (IS_ERR(obj)) GOTO(out, obj); @@ -196,7 +196,7 @@ struct dt_object *lquota_disk_dir_find_create(const struct lu_env *env, /* local_oid_storage_fini() will finalize the local storage device, * we have to open the object in another device stack */ qti->qti_fid = qt_dir->do_lu.lo_header->loh_fid; - lu_object_put_nocache(env, &qt_dir->do_lu); + dt_object_put_nocache(env, qt_dir); qt_dir = dt_locate(env, dev, &qti->qti_fid); if (IS_ERR(qt_dir)) GOTO(out, rc = PTR_ERR(qt_dir)); @@ -206,12 +206,12 @@ struct dt_object *lquota_disk_dir_find_create(const struct lu_env *env, EXIT; out: if (parent != NULL && !IS_ERR(parent)) - lu_object_put(env, &parent->do_lu); + dt_object_put(env, parent); if (los != NULL) local_oid_storage_fini(env, los); if (rc) { if (qt_dir != NULL && !IS_ERR(qt_dir)) - lu_object_put(env, &qt_dir->do_lu); + dt_object_put(env, qt_dir); qt_dir = ERR_PTR(rc); } return qt_dir; @@ -244,15 +244,7 @@ struct dt_object *lquota_disk_glb_find_create(const struct lu_env *env, CDEBUG(D_QUOTA, "look-up/create %sglobal idx file ("DFID")\n", local ? "local " : "", PFID(fid)); -#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 56, 0) - /* we use different index feature for each quota type and target type - * for the time being. This is done for on-disk conversion from the old - * quota format. Once this is no longer required, we should just be - * using dt_quota_glb_features for all global index file */ - idx_feat = glb_idx_feature(fid); -#else idx_feat = &dt_quota_glb_features; -#endif /* 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 @@ -290,7 +282,7 @@ struct dt_object *lquota_disk_glb_find_create(const struct lu_env *env, CERROR("%s: failed to setup index operations for "DFID " rc:%d\n", dev->dd_lu_dev.ld_obd->obd_name, PFID(lu_object_fid(&glb_idx->do_lu)), rc); - lu_object_put(env, &glb_idx->do_lu); + dt_object_put(env, glb_idx); glb_idx = ERR_PTR(rc); } } @@ -350,7 +342,7 @@ struct dt_object *lquota_disk_slv_find(const struct lu_env *env, CERROR("%s: failed to setup slave index operations for " "%s, rc:%d\n", dev->dd_lu_dev.ld_obd->obd_name, obd_uuid2str(uuid), rc); - lu_object_put(env, &slv_idx->do_lu); + dt_object_put(env, slv_idx); slv_idx = ERR_PTR(rc); } } @@ -414,8 +406,7 @@ struct dt_object *lquota_disk_slv_find_create(const struct lu_env *env, RETURN(ERR_PTR(rc)); /* use predefined fid in the reserved oid list */ - qti->qti_fid.f_oid = (type == USRQUOTA) ? LQUOTA_USR_OID - : LQUOTA_GRP_OID; + qti->qti_fid.f_oid = qtype2slv_oid(type); slv_idx = local_index_find_or_create_with_fid(env, dev, &qti->qti_fid, @@ -445,7 +436,7 @@ struct dt_object *lquota_disk_slv_find_create(const struct lu_env *env, CERROR("%s: failed to setup index operations for "DFID " rc:%d\n", dev->dd_lu_dev.ld_obd->obd_name, PFID(lu_object_fid(&slv_idx->do_lu)), rc); - lu_object_put(env, &slv_idx->do_lu); + dt_object_put(env, slv_idx); slv_idx = ERR_PTR(rc); } } @@ -669,11 +660,11 @@ int lquota_disk_write(const struct lu_env *env, struct thandle *th, if (rec != NULL) { /* insert record with updated quota settings */ - rc = dt_insert(env, obj, rec, key, th, 1); + rc = dt_insert(env, obj, rec, key, th); if (rc) { /* try to insert the old one */ rc = dt_insert(env, obj, (struct dt_rec *)&qti->qti_rec, - key, th, 1); + key, th); LASSERTF(rc == 0, "failed to insert record in quota " "index "DFID"\n", PFID(lu_object_fid(&obj->do_lu))); @@ -791,11 +782,10 @@ int lquota_disk_write_glb(const struct lu_env *env, struct dt_object *obj, rc = 0; } - rc = dt_insert(env, obj, (struct dt_rec *)rec, key, th, 1); + rc = dt_insert(env, obj, (struct dt_rec *)rec, key, th); out_lock: dt_write_unlock(env, obj); out: dt_trans_stop(env, dev, th); RETURN(rc); } -EXPORT_SYMBOL(lquota_disk_write_glb);