Whamcloud - gitweb
LU-2358 procfs: Implement /proc/fs/lustre/mgs/MGS/fstype as symlink
authorJohn L. Hammond <jhammond@tacc.utexas.edu>
Tue, 20 Nov 2012 17:33:04 +0000 (11:33 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 17 Dec 2012 06:34:31 +0000 (01:34 -0500)
Add symlinks:
  /proc/fs/lustre/mgs/MGS/osd    -> ../../osd-ldiskfs/lustre-MDT0000
  /proc/fs/lustre/mgs/MGS/fstype -> osd/fstype
  /proc/fs/lustre/mgs/MGS/mntdev -> osd/mntdev
Remove unused lprocfs_rd_fstype().

Change-Id: Ic5cce7cf31962c7d6ea97c5d3117fba81539cb68
Signed-off-by: John L. Hammond <jhammond@tacc.utexas.edu>
Reviewed-on: http://review.whamcloud.com/4635
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/include/lprocfs_status.h
lustre/mgs/lproc_mgs.c
lustre/mgs/mgs_internal.h
lustre/obdclass/lprocfs_status.c

index d0ae402..1c2b906 100644 (file)
@@ -581,8 +581,6 @@ extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
                            int count, int *eof, void *data);
 extern int lprocfs_rd_name(char *page, char **start, off_t off,
                            int count, int *eof, void *data);
-extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
-                             int count, int *eof, void *data);
 extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
                                   int count, int *eof, void *data);
 extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
index 9b0a4ad..3002e20 100644 (file)
@@ -149,8 +149,7 @@ int lproc_mgs_setup(struct mgs_device *mgs, char *osd_name)
 {
        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                osd_len = strlen(osd_name) - strlen("-osd");
        int                rc;
 
         rc = lprocfs_obd_seq_create(obd, "filesystems", 0444,
@@ -175,16 +174,27 @@ int lproc_mgs_setup(struct mgs_device *mgs, char *osd_name)
                 obd->obd_proc_exports_entry = NULL;
         }
 
-       osd_name[osd_suffix] = '\0'; /* Remove the "-osd" suffix. */
+       mgs->mgs_proc_osd = lprocfs_add_symlink("osd",
+                                               obd->obd_proc_entry,
+                                               "../../%s/%.*s",
+                                               osd_obd->obd_type->typ_name,
+                                               osd_len, /* Strip "-osd". */
+                                               osd_name);
+       if (mgs->mgs_proc_osd == NULL)
+               rc = -ENOMEM;
+
        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;
+                                                  "osd/mntdev");
        if (mgs->mgs_proc_mntdev == NULL)
                rc = -ENOMEM;
 
+       mgs->mgs_proc_fstype = lprocfs_add_symlink("fstype",
+                                                  obd->obd_proc_entry,
+                                                  "osd/fstype");
+       if (mgs->mgs_proc_fstype == NULL)
+               rc = -ENOMEM;
+
        return rc;
 }
 
@@ -195,6 +205,12 @@ int lproc_mgs_cleanup(struct mgs_device *mgs)
         if (!obd)
                 return -EINVAL;
 
+       if (mgs->mgs_proc_osd != NULL)
+               lprocfs_remove(&mgs->mgs_proc_osd);
+
+       if (mgs->mgs_proc_fstype != NULL)
+               lprocfs_remove(&mgs->mgs_proc_fstype);
+
        if (mgs->mgs_proc_mntdev)
                lprocfs_remove(&mgs->mgs_proc_mntdev);
         if (mgs->mgs_proc_live) {
@@ -283,7 +299,6 @@ int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
 
 struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
         { "uuid",            lprocfs_rd_uuid,        0, 0 },
-        { "fstype",          lprocfs_rd_fstype,      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 },
index 89a9261..6ddfe13 100644 (file)
@@ -166,6 +166,8 @@ struct mgs_device {
        cfs_list_t                       mgs_fs_db_list;
        spinlock_t                       mgs_lock; /* covers mgs_fs_db_list */
        cfs_proc_dir_entry_t            *mgs_proc_live;
+       cfs_proc_dir_entry_t            *mgs_proc_osd;
+       cfs_proc_dir_entry_t            *mgs_proc_fstype;
        cfs_proc_dir_entry_t            *mgs_proc_mntdev;
        cfs_time_t                       mgs_start_time;
        struct obd_device               *mgs_obd;
index 61f4915..5d4b3fb 100644 (file)
@@ -595,18 +595,6 @@ int lprocfs_rd_name(char *page, char **start, off_t off, int count,
 }
 EXPORT_SYMBOL(lprocfs_rd_name);
 
-int lprocfs_rd_fstype(char *page, char **start, off_t off, int count, int *eof,
-                      void *data)
-{
-        struct obd_device *obd = data;
-
-        LASSERT(obd != NULL);
-        LASSERT(obd->obd_fsops != NULL);
-        LASSERT(obd->obd_fsops->fs_type != NULL);
-        return snprintf(page, count, "%s\n", obd->obd_fsops->fs_type);
-}
-EXPORT_SYMBOL(lprocfs_rd_fstype);
-
 int lprocfs_rd_blksize(char *page, char **start, off_t off, int count,
                        int *eof, void *data)
 {