previously it was created by MDT, which is started after MGS.
so we relocate lu_site in OSD and now it's created before
any service like MDS/MGS.
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I43312218c293df509064cc6a854074e652a6e691
Reviewed-on: http://review.whamcloud.com/3651
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
if (range_is_exhausted(loset)) {
/* reached high water mark. */
- struct lu_device *dev = seq->lss_site->ms_lu.ls_top_dev;
+ struct lu_device *dev = seq->lss_site->ms_lu->ls_top_dev;
int obd_num_clients = dev->ld_obd->obd_num_exports;
__u64 set_sz;
*/
struct lprocfs_stats *ls_stats;
struct lprocfs_stats *ls_time_stats;
+ /**
+ * XXX: a hack! fld has to find md_site via site, remove when possible
+ */
+ struct md_site *ld_md_site;
};
static inline struct lu_site_bkt_data *
* md-server site.
*/
struct md_site {
- struct lu_site ms_lu;
+ struct lu_site *ms_lu;
/**
* mds number of this site.
*/
static inline struct md_site *lu_site2md(const struct lu_site *s)
{
- return container_of0(s, struct md_site, ms_lu);
+ return s->ld_md_site;
}
static inline int md_device_init(struct md_device *md, struct lu_device_type *t)
tmp = m->mdt_bottom_exp->exp_obd->obd_lu_dev;
LASSERT(tmp);
m->mdt_bottom = lu2dt_dev(tmp);
- tmp->ld_site = d->ld_site;
+
+ /* initialize site's pointers: md_site, top device */
+ d->ld_site = tmp->ld_site;
+ d->ld_site->ls_top_dev = d;
+ m->mdt_mite.ms_lu = tmp->ld_site;
+ tmp->ld_site->ld_md_site = &m->mdt_mite;
+ LASSERT(d->ld_site);
d = tmp;
tmp = mdt_layer_setup(env, LUSTRE_MDD_NAME, d, cfg);
{
struct md_device *next = m->mdt_child;
struct lu_device *d = &m->mdt_md_dev.md_lu_dev;
- struct lu_site *ls = d->ld_site;
struct obd_device *obd = mdt2obd_dev(m);
ENTRY;
*/
mdt_stack_fini(env, m, md2lu_dev(m->mdt_child));
- if (ls) {
- struct md_site *mite;
-
- lu_site_fini(ls);
- mite = lu_site2md(ls);
- OBD_FREE_PTR(mite);
- d->ld_site = NULL;
- }
LASSERT(cfs_atomic_read(&d->ld_ref) == 0);
server_put_mount(mdt2obd_dev(m)->obd_name, NULL);
m->mdt_nosquash_strlen = 0;
cfs_init_rwsem(&m->mdt_squash_sem);
- OBD_ALLOC_PTR(mite);
- if (mite == NULL)
- GOTO(err_lmi, rc = -ENOMEM);
-
- s = &mite->ms_lu;
-
m->mdt_md_dev.md_lu_dev.ld_ops = &mdt_lu_ops;
m->mdt_md_dev.md_lu_dev.ld_obd = obd;
/* set this lu_device to obd, because error handling need it */
obd->obd_lu_dev = &m->mdt_md_dev.md_lu_dev;
- 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_free_site, rc);
- }
+ /* init the stack */
+ rc = mdt_stack_init((struct lu_env *)env, m, cfg, lmi);
+ if (rc) {
+ CERROR("Can't init device stack, rc %d\n", rc);
+ RETURN(rc);
+ }
+
+ s = m->mdt_md_dev.md_lu_dev.ld_site;
+ mite = &m->mdt_mite;
/* set server index */
- lu_site2md(s)->ms_node_id = node_id;
+ mite->ms_node_id = node_id;
/* failover is the default
* FIXME: we do not failout mds0/mgs, which may cause some problems.
}
}
- /* init the stack */
- rc = mdt_stack_init((struct lu_env *)env, m, cfg, lmi);
- if (rc) {
- CERROR("Can't init device stack, rc %d\n", rc);
- GOTO(err_lu_site, rc);
- }
-
rc = lut_init(env, &m->mdt_lut, obd, m->mdt_bottom);
if (rc)
GOTO(err_fini_stack, rc);
ping_evictor_start();
- rc = lu_site_init_finish(s);
- if (rc)
- GOTO(err_stop_service, rc);
-
if (obd->obd_recovering == 0)
mdt_postrecov(env, m);
RETURN(0);
-err_stop_service:
ping_evictor_stop();
mdt_stop_ptlrpc_service(m);
err_procfs:
lut_fini(env, &m->mdt_lut);
err_fini_stack:
mdt_stack_fini(env, m, md2lu_dev(m->mdt_child));
-err_lu_site:
- lu_site_fini(s);
-err_free_site:
- OBD_FREE_PTR(mite);
err_lmi:
if (lmi)
server_put_mount(dev, lmi->lmi_mnt);
struct mdt_device {
/* super-class */
struct md_device mdt_md_dev;
+ struct md_site mdt_mite;
struct ptlrpc_service *mdt_regular_service;
struct ptlrpc_service *mdt_readpage_service;
struct ptlrpc_service *mdt_xmds_service;
return mdt->mdt_md_dev.md_lu_dev.ld_site;
}
-static inline struct md_site *mdt_md_site(const struct mdt_device *mdt)
+static inline struct md_site *mdt_md_site(struct mdt_device *mdt)
{
- return lu_site2md(mdt_lu_site(mdt));
+ return &mdt->mdt_mite;
}
static inline void mdt_export_evict(struct obd_export *exp)
/* purge again. */
lu_site_purge(env, site, ~0);
- if (!cfs_hash_is_empty(site->ls_obj_hash)) {
- /*
- * Uh-oh, objects still exist.
- */
- LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL);
-
- lu_site_print(env, site, &msgdata, lu_cdebug_printer);
- }
-
for (scan = top; scan != NULL; scan = next) {
const struct lu_device_type *ldt = scan->ld_type;
struct obd_type *type;
GOTO(out, rc);
}
+ m->ofd_dt_dev.dd_lu_dev.ld_site =
+ m->ofd_osd_exp->exp_obd->obd_lu_dev->ld_site;
+ LASSERT(m->ofd_dt_dev.dd_lu_dev.ld_site);
+ m->ofd_osd = lu2dt_dev(m->ofd_osd_exp->exp_obd->obd_lu_dev);
+ m->ofd_dt_dev.dd_lu_dev.ld_site->ls_top_dev = &m->ofd_dt_dev.dd_lu_dev;
+
out:
if (data)
OBD_FREE_PTR(data);
static int ofd_stack_init(const struct lu_env *env,
struct ofd_device *m, struct lustre_cfg *cfg)
{
- struct lu_device *ofd_lu = &m->ofd_dt_dev.dd_lu_dev;
const char *dev = lustre_cfg_string(cfg, 0);
struct lu_device *d;
struct ofd_thread_info *info = ofd_info(env);
LASSERT(d);
m->ofd_osd = lu2dt_dev(d);
- LASSERT(ofd_lu->ld_site);
- d->ld_site = ofd_lu->ld_site;
-
snprintf(info->fti_u.name, sizeof(info->fti_u.name),
"%s-osd", lustre_cfg_string(cfg, 0));
if (info == NULL)
RETURN(-EFAULT);
- rc = lu_site_init(&m->ofd_site, &m->ofd_dt_dev.dd_lu_dev);
- if (rc)
- GOTO(err_fini_proc, rc);
- m->ofd_site.ls_top_dev = &m->ofd_dt_dev.dd_lu_dev;
-
rc = ofd_stack_init(env, m, cfg);
if (rc) {
CERROR("Can't init device stack, rc %d\n", rc);
- GOTO(err_lu_site, rc);
+ GOTO(err_fini_proc, rc);
}
/* populate cached statfs data */
target_recovery_init(&m->ofd_lut, ost_handle);
- rc = lu_site_init_finish(&m->ofd_site);
- if (rc)
- GOTO(err_fs_cleanup, rc);
-
RETURN(0);
-err_fs_cleanup:
- target_recovery_fini(obd);
- ofd_fs_cleanup(env, m);
err_fini_lut:
lut_fini(env, &m->ofd_lut);
err_free_ns:
obd->obd_namespace = m->ofd_namespace = NULL;
err_fini_stack:
ofd_stack_fini(env, m, &m->ofd_osd->dd_lu_dev);
-err_lu_site:
- lu_site_fini(&m->ofd_site);
err_fini_proc:
ofd_procfs_fini(m);
return rc;
}
ofd_stack_fini(env, m, &m->ofd_dt_dev.dd_lu_dev);
- lu_site_fini(&m->ofd_site);
ofd_procfs_fini(m);
LASSERT(cfs_atomic_read(&d->ld_ref) == 0);
server_put_mount(obd->obd_name, NULL);
/* shall we grant space to clients not
* supporting OBD_CONNECT_GRANT_PARAM? */
ofd_grant_compat_disable:1;
-
- struct lu_site ofd_site;
};
static inline struct ofd_device *ofd_dev(struct lu_device *d)
GOTO(out_mnt, rc);
}
+ rc = lu_site_init(&o->od_site, l);
+ if (rc)
+ GOTO(out_compat, rc);
+
+ rc = lu_site_init_finish(&o->od_site);
+ if (rc)
+ GOTO(out_compat, rc);
+
rc = osd_procfs_init(o, o->od_svname);
if (rc != 0) {
CERROR("%s: can't initialize procfs: rc = %d\n",
GOTO(out_compat, rc);
}
+ LASSERT(l->ld_site->ls_linkage.next && l->ld_site->ls_linkage.prev);
+
RETURN(0);
out_compat:
osd_compat_fini(o);
ENTRY;
cleanup_capa_hash(o->od_capa_hash);
+ /* XXX: make osd top device in order to release reference */
+ d->ld_site->ls_top_dev = d;
+ lu_site_purge(env, d->ld_site, -1);
+ if (!cfs_hash_is_empty(d->ld_site->ls_obj_hash)) {
+ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL);
+ lu_site_print(env, d->ld_site, &msgdata, lu_cdebug_printer);
+ }
+ lu_site_fini(&o->od_site);
dt_device_fini(&o->od_dt_dev);
OBD_FREE_PTR(o);
RETURN(NULL);
struct fsfilt_operations *od_fsops;
int od_connects;
+ struct lu_site od_site;
/*
* mapping for legacy OST objids
if (rc)
GOTO(err, rc);
+ rc = lu_site_init(&o->od_site, osd2lu_dev(o));
+ if (rc)
+ GOTO(err, rc);
+
+ rc = lu_site_init_finish(&o->od_site);
+ if (rc)
+ GOTO(err, rc);
+
/* Use our own ZAP for inode accounting by default, this can be changed
* via procfs to estimate the inode usage from the block usage */
o->od_quota_iused_est = 0;
cleanup_capa_hash(o->od_capa_hash);
/* XXX: make osd top device in order to release reference */
- /*d->ld_site->ls_top_dev = d;
+ d->ld_site->ls_top_dev = d;
lu_site_purge(env, d->ld_site, -1);
- lu_site_fini(&o->od_site);*/
+ if (!cfs_hash_is_empty(d->ld_site->ls_obj_hash)) {
+ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL);
+ lu_site_print(env, d->ld_site, &msgdata, lu_cdebug_printer);
+ }
+ lu_site_fini(&o->od_site);
dt_device_fini(&o->od_dt_dev);
OBD_FREE_PTR(o);