staging/lustre/llite: make llite/lov and lmv symlinks
authorOleg Drokin <green@linuxhacker.ru>
Thu, 21 May 2015 19:32:18 +0000 (15:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 31 May 2015 02:18:24 +0000 (11:18 +0900)
old proc code had /proc/sys/fs/lustre/llite/.../lov and lmv
dirs that contained name of the dir in lustre/lov and lustre/lmv
to better be able to find correct obd device there, but
I imagien a better solution would be to just create a symlink with
the same name. The name is then pointless and the target dir would
have uuid file just as if it was the old-style dir.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/lproc_llite.c

index e1fc620..2c84bed 100644 (file)
@@ -950,24 +950,17 @@ static const char *ra_stat_string[] = {
        [RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page",
 };
 
-LPROC_SEQ_FOPS_RO_TYPE(llite, name);
-LPROC_SEQ_FOPS_RO_TYPE(llite, uuid);
-
 int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
                                struct super_block *sb, char *osc, char *mdc)
 {
-       struct lprocfs_vars lvars[2];
        struct lustre_sb_info *lsi = s2lsi(sb);
        struct ll_sb_info *sbi = ll_s2sbi(sb);
        struct obd_device *obd;
-       struct proc_dir_entry *dir;
        char name[MAX_STRING_SIZE + 1], *ptr;
        int err, id, len, rc;
 
-       memset(lvars, 0, sizeof(lvars));
 
        name[MAX_STRING_SIZE] = '\0';
-       lvars[0].name = name;
 
        LASSERT(sbi != NULL);
        LASSERT(mdc != NULL);
@@ -1066,50 +1059,16 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
        /* MDC info */
        obd = class_name2obd(mdc);
 
-       LASSERT(obd != NULL);
-       LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
-       LASSERT(obd->obd_type->typ_name != NULL);
-
-       dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
-       if (dir == NULL) {
-               err = -ENOMEM;
-               goto out;
-       }
-
-       snprintf(name, MAX_STRING_SIZE, "common_name");
-       lvars[0].fops = &llite_name_fops;
-       err = lprocfs_add_vars(dir, lvars, obd);
-       if (err)
-               goto out;
-
-       snprintf(name, MAX_STRING_SIZE, "uuid");
-       lvars[0].fops = &llite_uuid_fops;
-       err = lprocfs_add_vars(dir, lvars, obd);
+       err = sysfs_create_link(&sbi->ll_kobj, &obd->obd_kobj,
+                               obd->obd_type->typ_name);
        if (err)
                goto out;
 
        /* OSC */
        obd = class_name2obd(osc);
 
-       LASSERT(obd != NULL);
-       LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
-       LASSERT(obd->obd_type->typ_name != NULL);
-
-       dir = proc_mkdir(obd->obd_type->typ_name, sbi->ll_proc_root);
-       if (dir == NULL) {
-               err = -ENOMEM;
-               goto out;
-       }
-
-       snprintf(name, MAX_STRING_SIZE, "common_name");
-       lvars[0].fops = &llite_name_fops;
-       err = lprocfs_add_vars(dir, lvars, obd);
-       if (err)
-               goto out;
-
-       snprintf(name, MAX_STRING_SIZE, "uuid");
-       lvars[0].fops = &llite_uuid_fops;
-       err = lprocfs_add_vars(dir, lvars, obd);
+       err = sysfs_create_link(&sbi->ll_kobj, &obd->obd_kobj,
+                               obd->obd_type->typ_name);
 out:
        if (err) {
                lprocfs_remove(&sbi->ll_proc_root);