bool osc_discard_cb(const struct lu_env *env, struct cl_io *io,
void **pvec, int count, void *cbdata);
-/* osc_dev.c */
-int osc_device_init(const struct lu_env *env, struct lu_device *d,
- const char *name, struct lu_device *next);
-struct lu_device *osc_device_fini(const struct lu_env *env,
- struct lu_device *d);
-struct lu_device *osc_device_free(const struct lu_env *env,
- struct lu_device *d);
-
/* osc_object.c */
int osc_object_init(const struct lu_env *env, struct lu_object *obj,
const struct lu_object_conf *conf);
.ldo_recovery_complete = NULL,
};
+static struct lu_device *mdc_device_free(const struct lu_env *env,
+ struct lu_device *lu)
+{
+ struct obd_device *obd = lu->ld_obd;
+ struct client_obd *cli = &obd->u.cli;
+ struct osc_device *osc = lu2osc_dev(lu);
+
+ LASSERT(cli->cl_mod_rpcs_in_flight == 0);
+ cl_device_fini(lu2cl_dev(lu));
+ osc_cleanup_common(obd);
+ OBD_FREE_PTR(osc);
+
+ return NULL;
+}
+
static struct lu_device *mdc_device_alloc(const struct lu_env *env,
struct lu_device_type *t,
struct lustre_cfg *cfg)
{
struct lu_device *d;
- struct osc_device *oc;
+ struct osc_device *osc;
struct obd_device *obd;
int rc;
- OBD_ALLOC_PTR(oc);
- if (oc == NULL)
+ OBD_ALLOC_PTR(osc);
+ if (osc == NULL)
RETURN(ERR_PTR(-ENOMEM));
- cl_device_init(&oc->osc_cl, t);
- d = osc2lu_dev(oc);
+ cl_device_init(&osc->osc_cl, t);
+ d = osc2lu_dev(osc);
d->ld_ops = &mdc_lu_ops;
/* Setup MDC OBD */
rc = mdc_setup(obd, cfg);
if (rc < 0) {
- osc_device_free(env, d);
+ mdc_device_free(env, d);
RETURN(ERR_PTR(rc));
}
- oc->osc_exp = obd->obd_self_export;
- oc->osc_stats.os_init = ktime_get_real();
+ osc->osc_exp = obd->obd_self_export;
+ osc->osc_stats.os_init = ktime_get_real();
RETURN(d);
}
+static int mdc_device_init(const struct lu_env *env, struct lu_device *d,
+ const char *name, struct lu_device *next)
+{
+ RETURN(0);
+}
+
+static struct lu_device *mdc_device_fini(const struct lu_env *env,
+ struct lu_device *lu)
+{
+ struct obd_device *obd = lu->ld_obd;
+
+ ENTRY;
+
+ osc_precleanup_common(obd);
+ mdc_changelog_cdev_finish(obd);
+ mdc_llog_finish(obd);
+ lprocfs_free_md_stats(obd);
+ ptlrpc_lprocfs_unregister_obd(obd);
+
+ RETURN(NULL);
+}
+
static const struct lu_device_type_operations mdc_device_type_ops = {
.ldto_device_alloc = mdc_device_alloc,
- .ldto_device_free = osc_device_free,
- .ldto_device_init = osc_device_init,
- .ldto_device_fini = osc_device_fini
+ .ldto_device_free = mdc_device_free,
+ .ldto_device_init = mdc_device_init,
+ .ldto_device_fini = mdc_device_fini
};
struct lu_device_type mdc_device_type = {
int mdc_fid_alloc(const struct lu_env *env, struct obd_export *exp,
struct lu_fid *fid, struct md_op_data *op_data);
int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg);
+void mdc_llog_finish(struct obd_device *obd);
struct obd_client_handle;
#define REQUEST_MINOR 244
-static int mdc_cleanup(struct obd_device *obd);
-
static inline int mdc_queue_wait(struct ptlrpc_request *req)
{
struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
RETURN(0);
}
-static void mdc_llog_finish(struct obd_device *obd)
+void mdc_llog_finish(struct obd_device *obd)
{
struct llog_ctxt *ctxt;
RETURN(0);
}
-static int mdc_precleanup(struct obd_device *obd)
-{
- ENTRY;
- osc_precleanup_common(obd);
-
- mdc_changelog_cdev_finish(obd);
- mdc_llog_finish(obd);
- lprocfs_free_md_stats(obd);
- ptlrpc_lprocfs_unregister_obd(obd);
-
- RETURN(0);
-}
-
-static int mdc_cleanup(struct obd_device *obd)
-{
- struct client_obd *cli = &obd->u.cli;
-
- LASSERT(cli->cl_mod_rpcs_in_flight == 0);
- return osc_cleanup_common(obd);
-}
-
static const struct obd_ops mdc_obd_ops = {
.o_owner = THIS_MODULE,
- .o_setup = mdc_setup,
- .o_precleanup = mdc_precleanup,
- .o_cleanup = mdc_cleanup,
.o_add_conn = client_import_add_conn,
.o_del_conn = client_import_del_conn,
.o_connect = client_connect_import,
lu_site_purge(env, site, ~0);
for (scan = top; scan != NULL; scan = next) {
- next = ldto_device_fini(env, scan);
+ if (strcmp(scan->ld_type->ldt_name, LUSTRE_MDC_NAME) == 0)
+ next = NULL;
+ else
+ next = ldto_device_fini(env, scan);
+
lu_device_put(scan);
}
/* purge again. */
lu_site_purge(env, site, ~0);
- for (scan = top; scan != NULL; scan = next)
+ for (scan = top; scan != NULL; scan = next) {
+ if (strcmp(scan->ld_type->ldt_name, LUSTRE_MDC_NAME) == 0)
+ break;
+
next = ldto_device_free(env, scan);
+ }
}
EXPORT_SYMBOL(lu_stack_fini);
.ldo_recovery_complete = NULL
};
-int osc_device_init(const struct lu_env *env, struct lu_device *d,
- const char *name, struct lu_device *next)
+static int osc_device_init(const struct lu_env *env, struct lu_device *d,
+ const char *name, struct lu_device *next)
{
RETURN(0);
}
-EXPORT_SYMBOL(osc_device_init);
-struct lu_device *osc_device_fini(const struct lu_env *env,
- struct lu_device *d)
+static struct lu_device *osc_device_fini(const struct lu_env *env,
+ struct lu_device *d)
{
return NULL;
}
-EXPORT_SYMBOL(osc_device_fini);
-struct lu_device *osc_device_free(const struct lu_env *env,
- struct lu_device *d)
+static struct lu_device *osc_device_free(const struct lu_env *env,
+ struct lu_device *d)
{
struct osc_device *oc = lu2osc_dev(d);
OBD_FREE_PTR(oc);
return NULL;
}
-EXPORT_SYMBOL(osc_device_free);
static struct lu_device *osc_device_alloc(const struct lu_env *env,
struct lu_device_type *t,