/*
* XXX for now. Tags in lu_device_type->ldt_something are needed.
*/
- return ergo(d->ld_ops != NULL, d->ld_ops == &cmm_lu_ops);
+ return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &cmm_lu_ops);
}
static struct md_device_operations cmm_md_ops = {
return next;
}
-static int cmm_process_config(struct lu_device *d, struct lustre_cfg *cfg)
+static int cmm_process_config(struct lu_device *d, struct lustre_cfg *cfg)
{
struct cmm_device *m = lu2cmm_dev(d);
struct lu_device *next = md2lu_dev(m->cmm_child);
default:
err = next->ld_ops->ldo_process_config(next, cfg);
}
-
RETURN(err);
}
static inline struct cmm_device *md2cmm_dev(struct md_device *m)
{
- return container_of(m, struct cmm_device, cmm_md_dev);
+ return container_of0(m, struct cmm_device, cmm_md_dev);
}
-static struct cmm_device *lu2cmm_dev(struct lu_device *d)
+static inline struct cmm_device *lu2cmm_dev(struct lu_device *d)
{
//LASSERT(lu_device_is_cmm(d));
- return container_of(d, struct cmm_device, cmm_md_dev.md_lu_dev);
+ return container_of0(d, struct cmm_device, cmm_md_dev.md_lu_dev);
}
static inline struct lu_device *cmm2lu_dev(struct cmm_device *d)
static inline struct cmm_object *lu2cmm_obj(struct lu_object *o)
{
//LASSERT(lu_device_is_cmm(o->lo_dev));
- return container_of(o, struct cmm_object, cmo_obj.mo_lu);
+ return container_of0(o, struct cmm_object, cmo_obj.mo_lu);
}
/* get cmm object from md_object */
static inline struct cmm_object *md2cmm_obj(struct md_object *o)
{
- return container_of(o, struct cmm_object, cmo_obj);
+ return container_of0(o, struct cmm_object, cmo_obj);
}
/* get lower-layer object */
static inline struct md_object *cmm2child_obj(struct cmm_object *o)
static inline int lu_device_is_md(const struct lu_device *d)
{
- return d->ld_type->ldt_tags & LU_DEVICE_MD;
+ return ergo(d != NULL, d->ld_type->ldt_tags & LU_DEVICE_MD);
}
static inline struct md_device *lu2md_dev(const struct lu_device *d)
{
LASSERT(lu_device_is_md(d));
- return container_of(d, struct md_device, md_lu_dev);
+ return container_of0(d, struct md_device, md_lu_dev);
}
static inline struct lu_device *md2lu_dev(struct md_device *d)
static inline struct md_object *lu2md(const struct lu_object *o)
{
LASSERT(lu_device_is_md(o->lo_dev));
- return container_of(o, struct md_object, mo_lu);
+ return container_of0(o, struct md_object, mo_lu);
}
static inline struct md_object *md_object_next(const struct md_object *obj)
static inline struct md_device *md_device_get(const struct md_object *o)
{
LASSERT(lu_device_is_md(o->mo_lu.lo_dev));
- return container_of(o->mo_lu.lo_dev, struct md_device, md_lu_dev);
+ return container_of0(o->mo_lu.lo_dev, struct md_device, md_lu_dev);
}
static inline int md_device_init(struct md_device *md, struct lu_device_type *t)
/*
* XXX for now. Tags in lu_device_type->ldt_something are needed.
*/
- return ergo(d->ld_ops != NULL, d->ld_ops == &mdd_lu_ops);
+ return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &mdd_lu_ops);
}
static struct mdd_device* lu2mdd_dev(struct lu_device *d)
{
LASSERT(lu_device_is_mdd(d));
- return container_of(d, struct mdd_device, mdd_md_dev.md_lu_dev);
+ return container_of0(d, struct mdd_device, mdd_md_dev.md_lu_dev);
}
static inline struct lu_device *mdd2lu_dev(struct mdd_device *d)
static struct mdd_object *mdd_obj(struct lu_object *o)
{
LASSERT(lu_device_is_mdd(o->lo_dev));
- return container_of(o, struct mdd_object, mod_obj.mo_lu);
+ return container_of0(o, struct mdd_object, mod_obj.mo_lu);
}
static struct mdd_device* mdo2mdd(struct md_object *mdo)
static struct mdd_object* mdo2mddo(struct md_object *mdo)
{
- return container_of(mdo, struct mdd_object, mod_obj);
+ return container_of0(mdo, struct mdd_object, mod_obj);
}
static inline struct dt_device_operations *mdd_child_ops(struct mdd_device *d)
return next;
}
-static int mdd_process_config(struct lu_device *d, struct lustre_cfg *cfg)
+static int mdd_process_config(struct lu_device *d, struct lustre_cfg *cfg)
{
struct mdd_device *m = lu2mdd_dev(d);
struct lu_device *next = &m->mdd_child->dd_lu_dev;
static struct dt_object* mdd_object_child(struct mdd_object *o)
{
- return container_of(lu_object_next(&o->mod_obj.mo_lu),
- struct dt_object, do_lu);
+ return container_of0(lu_object_next(&o->mod_obj.mo_lu),
+ struct dt_object, do_lu);
}
static void mdd_lock(struct lu_context *ctxt,
INIT_LIST_HEAD(&splice);
list_splice_init(&o->lo_header->loh_layers, &splice);
while (!list_empty(&splice)) {
- o = container_of(splice.next, struct lu_object, lo_linkage);
+ o = container_of0(splice.next, struct lu_object, lo_linkage);
list_del_init(&o->lo_linkage);
LASSERT(lu_object_ops(o)->ldo_object_free != NULL);
lu_object_ops(o)->ldo_object_free(ctx, o);
}
spin_unlock(&s->ls_guard);
while (!list_empty(&dispose)) {
- h = container_of(dispose.next,
+ h = container_of0(dispose.next,
struct lu_object_header, loh_lru);
list_del_init(&h->loh_lru);
lu_object_free(ctx, lu_object_top(h));
s->ls_hash = NULL;
}
if (s->ls_top_dev != NULL) {
+ s->ls_top_dev->ld_site = NULL;
lu_device_put(s->ls_top_dev);
s->ls_top_dev = NULL;
}
static int osd_object_print (struct lu_context *ctx,
struct seq_file *f, const struct lu_object *o);
static void osd_device_free (struct lu_device *m);
-static struct lu_device *osd_device_fini (struct lu_device *d);
static int osd_device_init (struct lu_device *d, struct lu_device *);
static void *osd_key_init (struct lu_context *ctx);
static void osd_key_fini (struct lu_context *ctx, void *data);
static struct osd_object *osd_obj (const struct lu_object *o);
static struct osd_device *osd_dev (const struct lu_device *d);
static struct osd_device *osd_dt_dev (const struct dt_device *d);
+static struct lu_device *osd_device_fini (struct lu_device *d);
static struct lu_device *osd_device_alloc (struct lu_device_type *t,
struct lustre_cfg *cfg);
static struct lu_object *osd_object_alloc (struct lu_context *ctx,
int result;
ENTRY;
-
+
/* get mount */
lmi = server_get_mount(dev);
if (lmi == NULL) {
o->od_root_dir = NULL;
}
osd_oi_fini(&o->od_oi);
-
+
if (o->od_mount)
server_put_mount(o->od_mount->lmi_name, o->od_mount->lmi_mnt);
OBD_FREE_PTR(o);
}
-static int osd_process_config(struct lu_device *d, struct lustre_cfg *cfg)
+static int osd_process_config(struct lu_device *d, struct lustre_cfg *cfg)
{
struct osd_device *o = lu2osd_dev(d);
int err;
switch(cfg->lcfg_command) {
case LCFG_SETUP:
err = osd_mount(o, cfg);
+ break;
+ default:
+ err = -ENOTTY;
}
RETURN(err);
/*
* XXX for now. Tags in lu_device_type->ldt_something are needed.
*/
- return ergo(d->ld_ops != NULL, d->ld_ops == &osd_lu_ops);
+ return ergo(d != NULL && d->ld_ops != NULL, d->ld_ops == &osd_lu_ops);
}
static struct osd_object *osd_obj(const struct lu_object *o)
{
LASSERT(lu_device_is_osd(o->lo_dev));
- return container_of(o, struct osd_object, oo_dt.do_lu);
+ return container_of0(o, struct osd_object, oo_dt.do_lu);
}
static struct osd_device *osd_dt_dev(const struct dt_device *d)
{
LASSERT(lu_device_is_osd(&d->dd_lu_dev));
- return container_of(d, struct osd_device, od_dt_dev);
+ return container_of0(d, struct osd_device, od_dt_dev);
}
static struct osd_device *osd_dev(const struct lu_device *d)
{
LASSERT(lu_device_is_osd(d));
- return osd_dt_dev(container_of(d, struct dt_device, dd_lu_dev));
+ return osd_dt_dev(container_of0(d, struct dt_device, dd_lu_dev));
}
static struct super_block *osd_sb(const struct osd_device *dev)
static inline struct osd_object * dt2osd_obj(struct dt_object *o)
{
- return container_of(o, struct osd_object, oo_dt);
+ return container_of0(o, struct osd_object, oo_dt);
}
static inline struct osd_device * osd_obj2dev(struct osd_object *o) {
struct lu_device *lu = o->oo_dt.do_lu.lo_dev;
- struct dt_device *dt = container_of(lu, struct dt_device, dd_lu_dev);
+ struct dt_device *dt = container_of0(lu, struct dt_device, dd_lu_dev);
- return container_of(dt, struct osd_device, od_dt_dev);
+ return container_of0(dt, struct osd_device, od_dt_dev);
}
static inline struct osd_device * dt2osd_dev(struct dt_device *dt) {
- return container_of(dt, struct osd_device, od_dt_dev);
+ return container_of0(dt, struct osd_device, od_dt_dev);
}
static inline struct osd_device * lu2osd_dev(struct lu_device *d) {
- return dt2osd_dev(container_of(d, struct dt_device, dd_lu_dev));
+ return dt2osd_dev(container_of0(d, struct dt_device, dd_lu_dev));
}
static inline struct lu_device * osd2lu_dev(struct osd_device * osd)