/*TODO check this MDC exists already */
- ld = ldt->ldt_ops->ldto_device_alloc(ldt, cfg);
+ ld = ldt->ldt_ops->ldto_device_alloc(ctx, ldt, cfg);
ld->ld_site = cmm2lu_dev(cm)->ld_site;
rc = ldt->ldt_ops->ldto_device_init(ctx, ld, NULL);
if (rc)
- ldt->ldt_ops->ldto_device_free(ld);
+ ldt->ldt_ops->ldto_device_free(ctx, ld);
/* pass config to the just created MDC */
rc = ld->ld_ops->ldo_process_config(ctx, ld, cfg);
/* --- lu_device_type operations --- */
-struct lu_device *cmm_device_alloc(struct lu_device_type *t,
+struct lu_device *cmm_device_alloc(struct lu_context *ctx,
+ struct lu_device_type *t,
struct lustre_cfg *cfg)
{
struct lu_device *l;
return l;
}
-void cmm_device_free(struct lu_device *d)
+void cmm_device_free(struct lu_context *ctx, struct lu_device *d)
{
struct cmm_device *m = lu2cmm_dev(d);
list_del(&mc->mc_linkage);
lu_device_put(cmm2lu_dev(cm));
ld->ld_type->ldt_ops->ldto_device_fini(ctx, ld_m);
- ld->ld_type->ldt_ops->ldto_device_free(ld_m);
+ ld->ld_type->ldt_ops->ldto_device_free(ctx, ld_m);
}
EXIT;
RETURN (NULL);
}
-struct lu_device *mdc_device_alloc(struct lu_device_type *ldt,
+struct lu_device *mdc_device_alloc(struct lu_context *ctx,
+ struct lu_device_type *ldt,
struct lustre_cfg *cfg)
{
struct lu_device *ld;
RETURN (NULL);
}
-struct lu_device *mdc_device_alloc(struct lu_device_type *ldt,
+struct lu_device *mdc_device_alloc(struct lu_context *ctx,
+ struct lu_device_type *ldt,
struct lustre_cfg *cfg)
{
struct lu_device *ld;
RETURN (ld);
}
-void mdc_device_free(struct lu_device *ld)
+void mdc_device_free(struct lu_context *ctx, struct lu_device *ld)
{
struct mdc_device *mc = lu2mdc_dev(ld);
/*
* Allocate new device.
*/
- struct lu_device *(*ldto_device_alloc)(struct lu_device_type *t,
+ struct lu_device *(*ldto_device_alloc)(struct lu_context *ctx,
+ struct lu_device_type *t,
struct lustre_cfg *lcfg);
/*
* Free device. Dual to ->ldto_device_alloc().
*/
- void (*ldto_device_free)(struct lu_device *d);
+ void (*ldto_device_free)(struct lu_context *ctx, struct lu_device *d);
/*
* Initialize the devices after allocation
ldt = obd->obd_type->typ_lu;
if (ldt != NULL) {
+#ifdef __KERNEL__
+ struct lu_context ctx;
struct lu_device *d;
- d = ldt->ldt_ops->ldto_device_alloc(ldt, cfg);
- if (!IS_ERR(d)) {
- obd->obd_lu_dev = d;
- d->ld_obd = obd;
- rc = 0;
- } else
- rc = PTR_ERR(d);
+ rc = lu_context_init(&ctx);
+ if (rc == 0) {
+ lu_context_enter(&ctx);
+
+ d = ldt->ldt_ops->ldto_device_alloc(&ctx, ldt, cfg);
+ if (!IS_ERR(d)) {
+ obd->obd_lu_dev = d;
+ d->ld_obd = obd;
+ rc = 0;
+ } else
+ rc = PTR_ERR(d);
+ }
+#endif
} else {
OBD_CHECK_DT_OP(obd, setup, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(obd, setup);
ldt = obd->obd_type->typ_lu;
d = obd->obd_lu_dev;
if (ldt != NULL && d != NULL) {
- ldt->ldt_ops->ldto_device_free(d);
- obd->obd_lu_dev = NULL;
- rc = 0;
+#ifdef __KERNEL__
+ struct lu_context ctx;
+
+ rc = lu_context_init(&ctx);
+ if (rc == 0) {
+ lu_context_enter(&ctx);
+ ldt->ldt_ops->ldto_device_free(&ctx, d);
+ lu_context_exit(&ctx);
+ lu_context_fini(&ctx);
+ obd->obd_lu_dev = NULL;
+ rc = 0;
+ }
+#endif
} else {
OBD_CHECK_DT_OP(obd, cleanup, 0);
rc = OBP(obd, cleanup)(obd);
.o_owner = THIS_MODULE
};
-struct lu_device *mdd_device_alloc(struct lu_device_type *t,
+struct lu_device *mdd_device_alloc(struct lu_context *ctx,
+ struct lu_device_type *t,
struct lustre_cfg *lcfg)
{
struct lu_device *l;
return l;
}
-static void mdd_device_free(struct lu_device *lu)
+static void mdd_device_free(struct lu_context *ctx, struct lu_device *lu)
{
struct mdd_device *m = lu2mdd_dev(lu);
/* get the LOV EA from @inode and store it into @md. It can be at most
* @size bytes, and @size is updated with the actual EA size.
- * The EA size is also returned on success, and -ve errno on failure.
+ * The EA size is also returned on success, and -ve errno on failure.
* If there is no EA then 0 is returned. */
int mds_get_md(struct obd_device *obd, struct inode *inode, void *md,
int *size, int lock)
quota_interface_t *quota_interface;
quota_interface_t mds_quota_interface;
-static int __init mds_init(void)
+static __attribute__((unused)) int __init mds_init(void)
{
int rc;
struct lprocfs_static_vars lvars;
return 0;
}
-static void /*__exit*/ mds_exit(void)
+static __attribute__((unused)) void /*__exit*/ mds_exit(void)
{
lquota_exit(quota_interface);
if (quota_interface)
/* each fini() returns next device in stack of layers
* * so we can avoid the recursion */
n = ldt->ldt_ops->ldto_device_fini(ctx, d);
- ldt->ldt_ops->ldto_device_free(d);
+ ldt->ldt_ops->ldto_device_free(ctx, d);
type = ldt->ldt_obd_type;
type->typ_refcnt--;
GOTO(out_type, rc = -EINVAL);
}
- d = ldt->ldt_ops->ldto_device_alloc(ldt, cfg);
+ d = ldt->ldt_ops->ldto_device_alloc(ctx, ldt, cfg);
if (IS_ERR(d)) {
CERROR("Cannot allocate device: '%s'\n", typename);
GOTO(out_type, rc = -ENODEV);
RETURN(d);
out_alloc:
- ldt->ldt_ops->ldto_device_free(d);
+ ldt->ldt_ops->ldto_device_free(ctx, d);
type->typ_refcnt--;
out_type:
class_put_type(type);
.o_disconnect = mdt_obd_disconnect,
};
-static void mdt_device_free(struct lu_device *d)
+static void mdt_device_free(struct lu_context *ctx, struct lu_device *d)
{
struct mdt_device *m = mdt_dev(d);
OBD_FREE_PTR(m);
}
-static struct lu_device *mdt_device_alloc(struct lu_device_type *t,
+static struct lu_device *mdt_device_alloc(struct lu_context *ctx,
+ struct lu_device_type *t,
struct lustre_cfg *cfg)
{
struct lu_device *l;
l = &m->mdt_md_dev.md_lu_dev;
result = mdt_init0(m, t, cfg);
if (result != 0) {
- mdt_device_free(l);
+ mdt_device_free(ctx, l);
return ERR_PTR(result);
}
static int osd_object_exists (struct lu_context *ctx, struct lu_object *o);
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 void osd_device_free (struct lu_context *ctx, struct lu_device *m);
static void *osd_key_init (struct lu_context *ctx);
static void osd_key_fini (struct lu_context *ctx, void *data);
static int osd_has_index (struct osd_object *obj);
static struct lu_device *osd2lu_dev (struct osd_device * osd);
static struct lu_device *osd_device_fini (struct lu_context *ctx,
struct lu_device *d);
-static struct lu_device *osd_device_alloc (struct lu_device_type *t,
+static struct lu_device *osd_device_alloc (struct lu_context *ctx,
+ struct lu_device_type *t,
struct lustre_cfg *cfg);
static struct lu_object *osd_object_alloc (struct lu_context *ctx,
struct lu_device *d);
RETURN(NULL);
}
-static struct lu_device *osd_device_alloc(struct lu_device_type *t,
+static struct lu_device *osd_device_alloc(struct lu_context *ctx,
+ struct lu_device_type *t,
struct lustre_cfg *cfg)
{
struct lu_device *l;
return l;
}
-static void osd_device_free(struct lu_device *d)
+static void osd_device_free(struct lu_context *ctx, struct lu_device *d)
{
struct osd_device *o = osd_dev(d);