RETURN(rc);
if (likely(S_ISDIR(mdd_object_type(mdd_obj)) &&
- dt_try_as_dir(env, dir))) {
-
- rc = dir->do_index_ops->dio_lookup(env, dir,
- (struct dt_rec *)fid, key,
- mdd_object_capa(env, mdd_obj));
- if (rc > 0)
- rc = 0;
- else if (rc == 0)
- rc = -ENOENT;
- } else
+ dt_try_as_dir(env, dir)))
+ rc = dt_lookup(env, dir, (struct dt_rec *)fid, key,
+ mdd_object_capa(env, mdd_obj));
+ else
rc = -ENOTDIR;
RETURN(rc);
}
static int __mdd_index_delete_only(const struct lu_env *env, struct mdd_object *pobj,
- const char *name, struct thandle *handle,
- struct lustre_capa *capa)
+ const char *name, struct thandle *handle,
+ struct lustre_capa *capa)
{
- struct dt_object *next = mdd_object_child(pobj);
- int rc;
- ENTRY;
+ struct dt_object *next = mdd_object_child(pobj);
+ int rc;
+ ENTRY;
- if (dt_try_as_dir(env, next)) {
- rc = next->do_index_ops->dio_delete(env, next,
- (struct dt_key *)name,
- handle, capa);
- } else
- rc = -ENOTDIR;
+ if (dt_try_as_dir(env, next))
+ rc = dt_delete(env, next, (struct dt_key *)name, handle, capa);
+ else
+ rc = -ENOTDIR;
- RETURN(rc);
+ RETURN(rc);
}
static int __mdd_index_insert_only(const struct lu_env *env,
rec->rec_fid = lf;
rec->rec_type = type;
ignore_quota = uc ? uc->uc_cap & CFS_CAP_SYS_RESOURCE_MASK : 1;
- rc = next->do_index_ops->dio_insert(env, next,
- (const struct dt_rec *)rec,
- (const struct dt_key *)name,
- handle, capa, ignore_quota);
+ rc = dt_insert(env, next, (const struct dt_rec *)rec,
+ (const struct dt_key *)name, handle, capa,
+ ignore_quota);
} else {
rc = -ENOTDIR;
}
if (dt_try_as_dir(env, dt_tobj)) {
struct lu_fid *fid = &mdd_env_info(env)->mti_fid2;
- rc = dt_tobj->do_index_ops->dio_lookup(env, dt_tobj,
- (struct dt_rec *)fid,
- (struct dt_key *)name,
- mdd_object_capa(env, mdd_tobj));
+ rc = dt_lookup(env, dt_tobj, (struct dt_rec *)fid,
+ (struct dt_key *)name,
+ mdd_object_capa(env, mdd_tobj));
if (unlikely(rc == 0))
target_exist = true;
}
/* mdd inline func for calling osd_dt_object ops */
static inline int mdo_attr_get(const struct lu_env *env, struct mdd_object *obj,
- struct lu_attr *la, struct lustre_capa *capa)
+ struct lu_attr *la, struct lustre_capa *capa)
{
- struct dt_object *next = mdd_object_child(obj);
- return next->do_ops->do_attr_get(env, next, la, capa);
+ struct dt_object *next = mdd_object_child(obj);
+ return dt_attr_get(env, next, la, capa);
}
static inline int mdo_declare_attr_set(const struct lu_env *env,
}
static inline int mdo_attr_set(const struct lu_env *env,
- struct mdd_object *obj,
- const struct lu_attr *la,
- struct thandle *handle,
- struct lustre_capa *capa)
+ struct mdd_object *obj,
+ const struct lu_attr *la,
+ struct thandle *handle,
+ struct lustre_capa *capa)
{
- struct dt_object *next = mdd_object_child(obj);
- if (mdd_object_exists(obj) == 0) {
- CERROR("%s: object "DFID" not found: rc = -2\n",
- mdd_obj_dev_name(obj), PFID(mdd_object_fid(obj)));
- return -ENOENT;
- }
- return next->do_ops->do_attr_set(env, next, la, handle, capa);
+ struct dt_object *next = mdd_object_child(obj);
+
+ if (!mdd_object_exists(obj))
+ return -ENOENT;
+
+ return dt_attr_set(env, next, la, handle, capa);
}
static inline int mdo_xattr_get(const struct lu_env *env,struct mdd_object *obj,
- struct lu_buf *buf, const char *name,
- struct lustre_capa *capa)
+ struct lu_buf *buf, const char *name,
+ struct lustre_capa *capa)
{
- struct dt_object *next = mdd_object_child(obj);
- return next->do_ops->do_xattr_get(env, next, buf, name, capa);
+ struct dt_object *next = mdd_object_child(obj);
+ return dt_xattr_get(env, next, buf, name, capa);
}
static inline int mdo_declare_xattr_set(const struct lu_env *env,
}
static inline int mdo_xattr_set(const struct lu_env *env,struct mdd_object *obj,
- const struct lu_buf *buf, const char *name,
- int fl, struct thandle *handle,
- struct lustre_capa *capa)
+ const struct lu_buf *buf, const char *name,
+ int fl, struct thandle *handle,
+ struct lustre_capa *capa)
{
- struct dt_object *next = mdd_object_child(obj);
- if (mdd_object_exists(obj) == 0) {
- CERROR("%s: object "DFID" not found: rc = -2\n",
- mdd_obj_dev_name(obj), PFID(mdd_object_fid(obj)));
- return -ENOENT;
- }
- return next->do_ops->do_xattr_set(env, next, buf, name, fl, handle,
- capa);
+ struct dt_object *next = mdd_object_child(obj);
+
+ if (!mdd_object_exists(obj))
+ return -ENOENT;
+
+ return dt_xattr_set(env, next, buf, name, fl, handle, capa);
}
static inline int mdo_declare_xattr_del(const struct lu_env *env,
}
static inline int mdo_xattr_del(const struct lu_env *env,struct mdd_object *obj,
- const char *name, struct thandle *handle,
- struct lustre_capa *capa)
+ const char *name, struct thandle *handle,
+ struct lustre_capa *capa)
{
- struct dt_object *next = mdd_object_child(obj);
- if (mdd_object_exists(obj) == 0) {
- CERROR("%s: object "DFID" not found: rc = -2\n",
- mdd_obj_dev_name(obj), PFID(mdd_object_fid(obj)));
- return -ENOENT;
- }
- return next->do_ops->do_xattr_del(env, next, name, handle, capa);
+ struct dt_object *next = mdd_object_child(obj);
+
+ if (!mdd_object_exists(obj))
+ return -ENOENT;
+
+ return dt_xattr_del(env, next, name, handle, capa);
}
-static inline
-int mdo_xattr_list(const struct lu_env *env, struct mdd_object *obj,
- struct lu_buf *buf, struct lustre_capa *capa)
+static inline int
+mdo_xattr_list(const struct lu_env *env, struct mdd_object *obj,
+ struct lu_buf *buf, struct lustre_capa *capa)
{
- struct dt_object *next = mdd_object_child(obj);
- if (mdd_object_exists(obj) == 0) {
- CERROR("%s: object "DFID" not found: rc = -2\n",
- mdd_obj_dev_name(obj), PFID(mdd_object_fid(obj)));
- return -ENOENT;
- }
- return next->do_ops->do_xattr_list(env, next, buf, capa);
+ struct dt_object *next = mdd_object_child(obj);
+
+ if (!mdd_object_exists(obj))
+ return -ENOENT;
+
+ return dt_xattr_list(env, next, buf, capa);
}
static inline
}
static inline int mdo_ref_add(const struct lu_env *env, struct mdd_object *obj,
- struct thandle *handle)
+ struct thandle *handle)
{
- struct dt_object *next = mdd_object_child(obj);
- if (mdd_object_exists(obj) == 0) {
- CERROR("%s: object "DFID" not found: rc = -2\n",
- mdd_obj_dev_name(obj), PFID(mdd_object_fid(obj)));
- return -ENOENT;
- }
- return next->do_ops->do_ref_add(env, next, handle);
+ struct dt_object *next = mdd_object_child(obj);
+
+ if (!mdd_object_exists(obj))
+ return -ENOENT;
+
+ return dt_ref_add(env, next, handle);
}
static inline int mdo_declare_ref_del(const struct lu_env *env,
}
static inline int mdo_ref_del(const struct lu_env *env, struct mdd_object *obj,
- struct thandle *handle)
+ struct thandle *handle)
{
- struct dt_object *next = mdd_object_child(obj);
- if (mdd_object_exists(obj) == 0) {
- CERROR("%s: object "DFID" not found: rc = -2\n",
- mdd_obj_dev_name(obj), PFID(mdd_object_fid(obj)));
- return -ENOENT;
- }
- return next->do_ops->do_ref_del(env, next, handle);
+ struct dt_object *next = mdd_object_child(obj);
+
+ if (!mdd_object_exists(obj))
+ return -ENOENT;
+
+ return dt_ref_del(env, next, handle);
}
-static inline
-int mdo_declare_create_obj(const struct lu_env *env, struct mdd_object *o,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *handle)
+static inline int
+mdo_declare_create_obj(const struct lu_env *env, struct mdd_object *o,
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof,
+ struct thandle *handle)
{
- struct dt_object *next = mdd_object_child(o);
- return next->do_ops->do_declare_create(env, next, attr, hint,
- dof, handle);
+ struct dt_object *next = mdd_object_child(o);
+ return dt_declare_create(env, next, attr, hint, dof, handle);
}
-static inline
-int mdo_create_obj(const struct lu_env *env, struct mdd_object *o,
- struct lu_attr *attr,
- struct dt_allocation_hint *hint,
- struct dt_object_format *dof,
- struct thandle *handle)
+static inline int
+mdo_create_obj(const struct lu_env *env, struct mdd_object *o,
+ struct lu_attr *attr,
+ struct dt_allocation_hint *hint,
+ struct dt_object_format *dof,
+ struct thandle *handle)
{
- struct dt_object *next = mdd_object_child(o);
- int rc;
-
- rc = next->do_ops->do_create(env, next, attr, hint, dof, handle);
-
- return rc;
+ struct dt_object *next = mdd_object_child(o);
+ return dt_create(env, next, attr, hint, dof, handle);
}
static inline
return dt_destroy(env, next, handle);
}
-static inline struct obd_capa *mdo_capa_get(const struct lu_env *env,
- struct mdd_object *obj,
- struct lustre_capa *old,
- __u64 opc)
+static inline struct obd_capa *
+mdo_capa_get(const struct lu_env *env, struct mdd_object *obj,
+ struct lustre_capa *old, __u64 opc)
{
- struct dt_object *next = mdd_object_child(obj);
- if (mdd_object_exists(obj) == 0) {
- CERROR("%s: object "DFID" not found: rc = -2\n",
- mdd_obj_dev_name(obj), PFID(mdd_object_fid(obj)));
- return ERR_PTR(-ENOENT);
- }
- return next->do_ops->do_capa_get(env, next, old, opc);
+ struct dt_object *next = mdd_object_child(obj);
+
+ if (!mdd_object_exists(obj))
+ return ERR_PTR(-ENOENT);
+
+ return dt_capa_get(env, next, old, opc);
}
#endif
}
static inline void mdd_orphan_write_lock(const struct lu_env *env,
- struct mdd_device *mdd)
+ struct mdd_device *mdd)
{
-
- struct dt_object *dor = mdd->mdd_orphans;
- dor->do_ops->do_write_lock(env, dor, MOR_TGT_ORPHAN);
+ struct dt_object *dor = mdd->mdd_orphans;
+ dt_write_lock(env, dor, MOR_TGT_ORPHAN);
}
static inline void mdd_orphan_write_unlock(const struct lu_env *env,
- struct mdd_device *mdd)
+ struct mdd_device *mdd)
{
-
- struct dt_object *dor = mdd->mdd_orphans;
- dor->do_ops->do_write_unlock(env, dor);
+ struct dt_object *dor = mdd->mdd_orphans;
+ dt_write_unlock(env, dor);
}
static inline int mdd_orphan_insert_obj(const struct lu_env *env,
rec->rec_fid = lf;
rec->rec_type = mdd_object_type(obj);
- return dor->do_index_ops->dio_insert(env, dor,
- (const struct dt_rec *)rec,
- key, th, BYPASS_CAPA, 1);
+ return dt_insert(env, dor, (const struct dt_rec *)rec, key, th,
+ BYPASS_CAPA, 1);
}
static inline int mdd_orphan_delete_obj(const struct lu_env *env,
struct dt_key *key,
struct thandle *th)
{
- struct dt_object *dor = mdd->mdd_orphans;
+ struct dt_object *dor = mdd->mdd_orphans;
- return dor->do_index_ops->dio_delete(env, dor,
- key, th,
- BYPASS_CAPA);
+ return dt_delete(env, dor, key, th, BYPASS_CAPA);
}
-static inline void mdd_orphan_ref_add(const struct lu_env *env,
- struct mdd_device *mdd,
- struct thandle *th)
+static inline int mdd_orphan_ref_add(const struct lu_env *env,
+ struct mdd_device *mdd,
+ struct thandle *th)
{
- struct dt_object *dor = mdd->mdd_orphans;
- dor->do_ops->do_ref_add(env, dor, th);
+ struct dt_object *dor = mdd->mdd_orphans;
+ return dt_ref_add(env, dor, th);
}
-static inline void mdd_orphan_ref_del(const struct lu_env *env,
- struct mdd_device *mdd,
- struct thandle *th)
+static inline int mdd_orphan_ref_del(const struct lu_env *env,
+ struct mdd_device *mdd,
+ struct thandle *th)
{
- struct dt_object *dor = mdd->mdd_orphans;
- dor->do_ops->do_ref_del(env, dor, th);
+ struct dt_object *dor = mdd->mdd_orphans;
+ return dt_ref_del(env, dor, th);
}
* from here */
if (!dt_try_as_dir(env, next))
GOTO(out, rc = 0);
- next->do_index_ops->dio_delete(env, next,
- (const struct dt_key *)dotdot,
- th, BYPASS_CAPA);
+
+ dt_delete(env, next, (const struct dt_key *)dotdot, th, BYPASS_CAPA);
rec->rec_fid = lf_dor;
rec->rec_type = S_IFDIR;
- next->do_index_ops->dio_insert(env, next, (const struct dt_rec *)rec,
- (const struct dt_key *)dotdot,
- th, BYPASS_CAPA, 1);
+ dt_insert(env, next, (const struct dt_rec *)rec,
+ (const struct dt_key *)dotdot, th, BYPASS_CAPA, 1);
out:
if (rc == 0)