MGS won't be able to get device names directly on top of OSD.
Change-Id: Ief808f058a785cc4bacf1743ff534a81be234544
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Signed-off-by: Li Wei <liwei@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/3672
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
-static int lprocfs_mgs_rd_mntdev(char *page, char **start, off_t off, int count,
- int *eof, void *data)
-{
- struct obd_device *obd = (struct obd_device *)data;
-
- LASSERT(obd != NULL);
-#if 0
- /* will be fixed in the subsequent patch */
- LASSERT(mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
- *eof = 1;
-
- return snprintf(page, count, "%s\n",
- mnt_get_devname(obd->u.mgs.mgs_vfsmnt));
-#else
- return 0;
-#endif
-}
-
static int mgs_fs_seq_show(struct seq_file *seq, void *v)
{
struct obd_device *obd = seq->private;
static int mgs_fs_seq_show(struct seq_file *seq, void *v)
{
struct obd_device *obd = seq->private;
LPROC_SEQ_FOPS_RO(mgsself_srpc);
LPROC_SEQ_FOPS_RO(mgsself_srpc);
-int lproc_mgs_setup(struct mgs_device *mgs)
+int lproc_mgs_setup(struct mgs_device *mgs, char *osd_name)
{
struct obd_device *obd = mgs->mgs_obd;
{
struct obd_device *obd = mgs->mgs_obd;
+ struct obd_device *osd_obd = mgs->mgs_bottom->dd_lu_dev.ld_obd;
+ int osd_suffix = strlen(osd_name) - strlen("-osd");
+ char c = osd_name[osd_suffix];
+ int rc;
rc = lprocfs_obd_seq_create(obd, "filesystems", 0444,
&mgs_fs_fops, obd);
rc = lprocfs_obd_seq_create(obd, "filesystems", 0444,
&mgs_fs_fops, obd);
obd->obd_proc_exports_entry = NULL;
}
obd->obd_proc_exports_entry = NULL;
}
+ osd_name[osd_suffix] = '\0'; /* Remove the "-osd" suffix. */
+ mgs->mgs_proc_mntdev = lprocfs_add_symlink("mntdev",
+ obd->obd_proc_entry,
+ "../../%s/%s/mntdev",
+ osd_obd->obd_type->typ_name,
+ osd_name);
+ osd_name[osd_suffix] = c;
+ if (mgs->mgs_proc_mntdev == NULL)
+ rc = -ENOMEM;
+
+ return rc;
}
int lproc_mgs_cleanup(struct mgs_device *mgs)
}
int lproc_mgs_cleanup(struct mgs_device *mgs)
if (!obd)
return -EINVAL;
if (!obd)
return -EINVAL;
+ if (mgs->mgs_proc_mntdev)
+ lprocfs_remove(&mgs->mgs_proc_mntdev);
if (mgs->mgs_proc_live) {
/* Should be no live entries */
LASSERT(mgs->mgs_proc_live->subdir == NULL);
if (mgs->mgs_proc_live) {
/* Should be no live entries */
LASSERT(mgs->mgs_proc_live->subdir == NULL);
struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
{ "fstype", lprocfs_rd_fstype, 0, 0 },
struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
{ "fstype", lprocfs_rd_fstype, 0, 0 },
- { "mntdev", lprocfs_mgs_rd_mntdev, 0, 0 },
{ "num_exports", lprocfs_rd_num_exports, 0, 0 },
{ "hash_stats", lprocfs_obd_rd_hash, 0, 0 },
{ "evict_client", 0, lprocfs_wr_evict_client, 0 },
{ "num_exports", lprocfs_rd_num_exports, 0, 0 },
{ "hash_stats", lprocfs_obd_rd_hash, 0, 0 },
{ "evict_client", 0, lprocfs_wr_evict_client, 0 },
/* Setup proc */
lprocfs_mgs_init_vars(&lvars);
if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0) {
/* Setup proc */
lprocfs_mgs_init_vars(&lvars);
if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0) {
+ lproc_mgs_setup(mgs, lustre_cfg_string(lcfg, 3));
rc = lprocfs_alloc_md_stats(obd, LPROC_MGS_LAST);
if (rc)
GOTO(err_llog, rc);
rc = lprocfs_alloc_md_stats(obd, LPROC_MGS_LAST);
if (rc)
GOTO(err_llog, rc);
cfs_list_t mgs_fs_db_list;
cfs_spinlock_t mgs_lock; /* covers mgs_fs_db_list */
cfs_proc_dir_entry_t *mgs_proc_live;
cfs_list_t mgs_fs_db_list;
cfs_spinlock_t mgs_lock; /* covers mgs_fs_db_list */
cfs_proc_dir_entry_t *mgs_proc_live;
+ cfs_proc_dir_entry_t *mgs_proc_mntdev;
cfs_time_t mgs_start_time;
struct obd_device *mgs_obd;
struct local_oid_storage *mgs_los;
cfs_time_t mgs_start_time;
struct obd_device *mgs_obd;
struct local_oid_storage *mgs_los;
#define strsuf(buf, suffix) (strcmp((buf)+strlen(buf)-strlen(suffix), (suffix)))
#ifdef LPROCFS
#define strsuf(buf, suffix) (strcmp((buf)+strlen(buf)-strlen(suffix), (suffix)))
#ifdef LPROCFS
-int lproc_mgs_setup(struct mgs_device *mgs);
+int lproc_mgs_setup(struct mgs_device *mgs, char *osd_name);
int lproc_mgs_cleanup(struct mgs_device *mgs);
int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb);
int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb);
int lproc_mgs_cleanup(struct mgs_device *mgs);
int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb);
int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb);