rc = 0;
} else
rc = PTR_ERR(root);
- RETURN(rc);
-}
-static int mdd_fs_setup(const struct lu_context *ctx, struct mdd_device *mdd)
-{
- /*create PENDING and OBJECTS dir for open and llog*/
- return 0;
-}
-
-static int mdd_fs_cleanup(struct mdd_device *mdd)
-{
- /*create PENDING and OBJECTS dir for open and llog*/
- return 0;
+ RETURN(rc);
}
static int mdd_device_init(const struct lu_context *ctx,
struct lu_device *d, struct lu_device *next)
{
struct mdd_device *mdd = lu2mdd_dev(d);
- int rc;
+ int rc = 0;
ENTRY;
mdd->mdd_child = lu2dt_dev(next);
- rc = mdd_fs_setup(ctx, mdd);
- if (rc)
- mdd_fs_cleanup(mdd);
RETURN(rc);
}
return next;
}
+static void mdd_device_shutdown(const struct lu_context *ctxt,
+ struct mdd_device *m)
+{
+ mdd_fini_obd(ctxt, m);
+}
static int mdd_process_config(const struct lu_context *ctxt,
struct lu_device *d, struct lustre_cfg *cfg)
GOTO(out, rc);
}
break;
+ case LCFG_CLEANUP:
+ mdd_device_shutdown(ctxt, m);
default:
rc = next->ld_ops->ldo_process_config(ctxt, next, cfg);
break;
.o_owner = THIS_MODULE
};
-struct lu_device *mdd_device_alloc(const struct lu_context *ctx,
- struct lu_device_type *t,
- struct lustre_cfg *lcfg)
+static struct lu_device *mdd_device_alloc(const struct lu_context *ctx,
+ struct lu_device_type *t,
+ struct lustre_cfg *lcfg)
{
struct lu_device *l;
struct mdd_device *m;
return l;
}
-static void mdd_device_free(const struct lu_context *ctx, struct lu_device *lu)
+static void mdd_device_free(const struct lu_context *ctx,
+ struct lu_device *lu)
{
struct mdd_device *m = lu2mdd_dev(lu);
struct mdd_device {
struct md_device mdd_md_dev;
struct dt_device *mdd_child;
+ struct obd_device *mdd_obd_dev;
struct lu_fid mdd_root_fid;
struct dt_device_param mdd_dt_conf;
};
int mdd_init_obd(const struct lu_context *ctxt, struct mdd_device *mdd,
char *dev);
+int mdd_fini_obd(const struct lu_context *, struct mdd_device *);
int mdd_xattr_set_txn(const struct lu_context *ctxt, struct mdd_object *obj,
const void *buf, int buf_len, const char *name, int fl,
struct thandle *txn);
return container_of0(lu_object_next(mdd2lu_obj(o)),
struct dt_object, do_lu);
}
-static inline struct obd_device *mdd2_obd(struct mdd_device *mdd)
+static inline struct obd_device *mdd2obd_dev(struct mdd_device *mdd)
{
- return mdd->mdd_md_dev.md_lu_dev.ld_obd;
+ return mdd->mdd_obd_dev;
}
static inline const struct lu_fid *mdo2fid(const struct mdd_object *obj)
static inline int mdd_lov_mdsize(const struct lu_context *ctxt,
struct mdd_device *mdd)
{
- struct obd_device *obd = mdd2_obd(mdd);
+ struct obd_device *obd = mdd2obd_dev(mdd);
return obd->u.mds.mds_max_mdsize;
}
static inline int mdd_lov_cookiesize(const struct lu_context *ctxt,
struct mdd_device *mdd)
{
- struct obd_device *obd = mdd2_obd(mdd);
+ struct obd_device *obd = mdd2obd_dev(mdd);
return obd->u.mds.mds_max_cookiesize;
}
ENTRY;
LASSERT(owner != NULL);
- obd = mdd2_obd(mdd);
+ obd = mdd2obd_dev(mdd);
upcall_dev = mdd->mdd_md_dev.md_upcall.mu_upcall_dev;
GOTO(class_detach, rc);
/*Add here for obd notify mechiasm,
*when adding a new ost, the mds will notify this mdd*/
-
obd->obd_upcall.onu_owner = mdd;
obd->obd_upcall.onu_upcall = mdd_lov_update;
- mdd->mdd_md_dev.md_lu_dev.ld_obd = obd;
+
+ mdd->mdd_obd_dev = obd;
class_detach:
if (rc)
class_detach(obd, lcfg);
RETURN(rc);
}
-int mdd_cleanup_obd(struct mdd_device *mdd)
+int mdd_fini_obd(const struct lu_context *ctxt, struct mdd_device *mdd)
{
struct lustre_cfg_bufs bufs;
struct lustre_cfg *lcfg;
int rc;
ENTRY;
- obd = mdd->mdd_md_dev.md_lu_dev.ld_obd;
+ obd = mdd2obd_dev(mdd);
LASSERT(obd);
lustre_cfg_bufs_reset(&bufs, MDD_OBD_NAME);
rc = class_detach(obd, lcfg);
if (rc)
GOTO(lcfg_cleanup, rc);
- mdd->mdd_md_dev.md_lu_dev.ld_obd = NULL;
+ mdd->mdd_obd_dev = NULL;
lcfg_cleanup:
lustre_cfg_free(lcfg);
RETURN(rc);
int lmm_size, struct thandle *handle)
{
struct mdd_device *mdd = mdo2mdd(&obj->mod_obj);
- struct obd_device *obd = mdd2_obd(mdd);
+ struct obd_device *obd = mdd2obd_dev(mdd);
struct obd_export *lov_exp = obd->u.mds.mds_osc_exp;
struct lov_stripe_md *lsm = NULL;
int rc;
struct lov_mds_md **lmm, int *lmm_size,
const struct md_create_spec *spec, struct lu_attr *la)
{
- struct obd_device *obd = mdd2_obd(mdd);
+ struct obd_device *obd = mdd2obd_dev(mdd);
struct obd_export *lov_exp = obd->u.mds.mds_osc_exp;
struct obdo *oa;
struct lov_stripe_md *lsm = NULL;
int mdd_unlink_log(const struct lu_context *ctxt, struct mdd_device *mdd,
struct mdd_object *mdd_cobj, struct md_attr *ma)
{
- struct obd_device *obd = mdd2_obd(mdd);
+ struct obd_device *obd = mdd2obd_dev(mdd);
if (mds_log_op_unlink(obd, NULL, ma->ma_lmm, ma->ma_lmm_size,
ma->ma_cookie, ma->ma_cookie_size) > 0) {
struct lov_mds_md *lmm, int lmm_size)
{
struct mdd_device *mdd = mdo2mdd(&obj->mod_obj);
- struct obd_device *obd = mdd2_obd(mdd);
+ struct obd_device *obd = mdd2obd_dev(mdd);
struct lu_attr *tmp_la = &mdd_ctx_info(ctxt)->mti_la;
struct dt_object *next = mdd_object_child(obj);
__u32 seq = lu_object_fid(mdd2lu_obj(obj))->f_seq;