struct lu_object *lu_object_find(struct lu_context *ctxt,
struct lu_site *s, const struct lu_fid *f);
-int lu_site_init(struct lu_site *, struct lu_device *, struct lustre_cfg *);
+int lu_site_init(struct lu_site *, struct lu_device *);
void lu_site_fini(struct lu_site *s);
void lu_device_get(struct lu_device *d);
static void mdt_fini(struct mdt_device *m)
{
struct lu_device *d = &m->mdt_md_dev.md_lu_dev;
-
+
mdt_stop_ptlrpc_service(m);
+
+ /* finish the stack */
+ mdt_stack_fini(m);
+
if (d->ld_site != NULL) {
+ struct lustre_mount_info *lmi = d->ld_site->ls_lmi;
+ if (lmi)
+ server_put_mount(lmi->lmi_name, lmi->lmi_mnt);
lu_site_fini(d->ld_site);
OBD_FREE_PTR(d->ld_site);
d->ld_site = NULL;
m->mdt_namespace = NULL;
}
- /* finish the stack */
- mdt_stack_fini(m);
-
if (m->mdt_seq_mgr) {
seq_mgr_fini(m->mdt_seq_mgr);
m->mdt_seq_mgr = NULL;
struct lu_site *s;
char ns_name[48];
struct lu_context ctx;
+ const char *dev = lustre_cfg_string(cfg, 0);
+ struct lustre_mount_info *lmi;
+
ENTRY;
OBD_ALLOC_PTR(s);
md_device_init(&m->mdt_md_dev, t);
m->mdt_md_dev.md_lu_dev.ld_ops = &mdt_lu_ops;
- rc = lu_site_init(s, &m->mdt_md_dev.md_lu_dev, cfg);
+ rc = lu_site_init(s, &m->mdt_md_dev.md_lu_dev);
if (rc) {
CERROR("can't init lu_site, rc %d\n", rc);
GOTO(err_fini_site, rc);
}
+
+ /* get mount */
+ lmi = server_get_mount(dev);
+ if (lmi == NULL) {
+ CERROR("Cannot get mount info for %s!\n", dev);
+ GOTO(err_fini_site, rc = -EFAULT);
+ }
+ //put lmi into lu_site
+ s->ls_lmi = lmi;
+
/* init the stack */
rc = mdt_stack_init(m, cfg);
if (rc) {
CERROR("can't init device stack, rc %d\n", rc);
- GOTO(err_fini_site, rc);
+ GOTO(err_fini_mount, rc);
}
m->mdt_seq_mgr = seq_mgr_init(&seq_mgr_ops, m);
m->mdt_seq_mgr = NULL;
err_fini_stack:
mdt_stack_fini(m);
-
+err_fini_mount:
+ server_put_mount(lmi->lmi_name, lmi->lmi_mnt);
err_fini_site:
lu_site_fini(s);
OBD_FREE_PTR(s);
LU_SITE_HTABLE_MASK = LU_SITE_HTABLE_SIZE - 1
};
-int lu_site_init(struct lu_site *s, struct lu_device *top,
- struct lustre_cfg *cfg)
+int lu_site_init(struct lu_site *s, struct lu_device *top)
{
int result;
- const char *dev = lustre_cfg_string(cfg, 0);
- struct lustre_mount_info *lmi;
-
ENTRY;
memset(s, 0, sizeof *s);
- /* get mount */
- lmi = server_get_mount(dev);
- if (lmi != NULL) {
- s->ls_lmi = lmi;
- spin_lock_init(&s->ls_guard);
- CFS_INIT_LIST_HEAD(&s->ls_lru);
- s->ls_top_dev = top;
- top->ld_site = s;
- lu_device_get(top);
- /*
- * XXX nikita: fixed size hash-table.
- */
- s->ls_hash_mask = LU_SITE_HTABLE_MASK;
- OBD_ALLOC(s->ls_hash,
- LU_SITE_HTABLE_SIZE * sizeof s->ls_hash[0]);
- if (s->ls_hash != NULL) {
- int i;
- for (i = 0; i < LU_SITE_HTABLE_SIZE; i++)
- INIT_HLIST_HEAD(&s->ls_hash[i]);
- result = 0;
- } else
- result = -ENOMEM;
+ spin_lock_init(&s->ls_guard);
+ CFS_INIT_LIST_HEAD(&s->ls_lru);
+ s->ls_top_dev = top;
+ top->ld_site = s;
+ lu_device_get(top);
+ /*
+ * XXX nikita: fixed size hash-table.
+ */
+ s->ls_hash_mask = LU_SITE_HTABLE_MASK;
+ OBD_ALLOC(s->ls_hash, LU_SITE_HTABLE_SIZE * sizeof s->ls_hash[0]);
+ if (s->ls_hash != NULL) {
+ int i;
+ for (i = 0; i < LU_SITE_HTABLE_SIZE; i++)
+ INIT_HLIST_HEAD(&s->ls_hash[i]);
+ result = 0;
} else {
- CERROR("Cannot get mount info for %s!\n", dev);
- result = -EFAULT;
+ result = -ENOMEM;
}
+
RETURN(result);
}
EXPORT_SYMBOL(lu_site_init);
LASSERT(s->ls_total == 0);
LASSERT(s->ls_busy == 0);
- if (s->ls_lmi)
- server_put_mount(s->ls_lmi->lmi_name, s->ls_lmi->lmi_mnt);
-
if (s->ls_hash != NULL) {
int i;
for (i = 0; i < LU_SITE_HTABLE_SIZE; i++)