#include "mdd_internal.h"
-static struct lu_object_operations mdd_lu_obj_ops;
+static const struct lu_object_operations mdd_lu_obj_ops;
int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
struct lu_attr *la, struct lustre_capa *capa)
}
if (unlikely(mti->mti_max_cookie == NULL)) {
OBD_ALLOC(mti->mti_max_cookie, max_cookie_size);
- if (unlikely(mti->mti_max_cookie != NULL))
+ if (likely(mti->mti_max_cookie != NULL))
mti->mti_max_cookie_size = max_cookie_size;
}
+ if (likely(mti->mti_max_cookie != NULL))
+ memset(mti->mti_max_cookie, 0, mti->mti_max_cookie_size);
return mti->mti_max_cookie;
}
}
}
-static int mdd_object_init(const struct lu_env *env, struct lu_object *o)
+static int mdd_object_init(const struct lu_env *env, struct lu_object *o,
+ const struct lu_object_conf *_)
{
struct mdd_device *d = lu2mdd_dev(o->lo_dev);
struct lu_object *below;
OBD_FREE_PTR(mdd);
}
-static int mdd_object_print(const struct lu_env *env, void *cookie,
- lu_printer_t p, const struct lu_object *o)
-{
- return (*p)(env, cookie, LUSTRE_MDD_NAME"-object@%p", o);
-}
-
/* orphan handling is here */
-static void mdd_object_delete(const struct lu_env *env,
- struct lu_object *o)
+static void mdd_object_delete(const struct lu_env *env, struct lu_object *o)
{
struct mdd_object *mdd_obj = lu2mdd_obj(o);
struct thandle *handle = NULL;
}
}
-static struct lu_object_operations mdd_lu_obj_ops = {
+static const struct lu_object_operations mdd_lu_obj_ops = {
.loo_object_init = mdd_object_init,
.loo_object_start = mdd_object_start,
.loo_object_free = mdd_object_free,
- .loo_object_print = mdd_object_print,
.loo_object_delete = mdd_object_delete
};
struct mdd_device *d,
const struct lu_fid *f)
{
- struct lu_object *o, *lo;
- struct mdd_object *m;
- ENTRY;
-
- o = lu_object_find(env, mdd2lu_dev(d)->ld_site, f);
- if (IS_ERR(o))
- m = (struct mdd_object *)o;
- else {
- lo = lu_object_locate(o->lo_header, mdd2lu_dev(d)->ld_type);
- /* remote object can't be located and should be put then */
- if (lo == NULL)
- lu_object_put(env, o);
- m = lu2mdd_obj(lo);
- }
- RETURN(m);
+ return md2mdd_obj(md_object_find_slice(env, &d->mdd_md_dev, f));
}
int mdd_get_flags(const struct lu_env *env, struct mdd_object *obj)
}
static int mdd_dir_page_build(const struct lu_env *env, int first,
- void *area, int nob, struct dt_it_ops *iops,
+ void *area, int nob, const struct dt_it_ops *iops,
struct dt_it *it, __u64 *start, __u64 *end,
struct lu_dirent **last)
{
{
struct dt_it *it;
struct dt_object *next = mdd_object_child(obj);
- struct dt_it_ops *iops;
+ const struct dt_it_ops *iops;
struct page *pg;
struct lu_dirent *last = NULL;
int i;
return next->do_ops->do_object_sync(env, next);
}
-struct md_object_operations mdd_obj_ops = {
+const struct md_object_operations mdd_obj_ops = {
.moo_permission = mdd_permission,
.moo_attr_get = mdd_attr_get,
.moo_attr_set = mdd_attr_set,