Whamcloud - gitweb
LU-8066 llite: replace ll_process_config with class_modify_config 95/32495/5
authorJames Simmons <uja.ornl@yahoo.com>
Sat, 9 Jun 2018 14:16:59 +0000 (10:16 -0400)
committerJohn L. Hammond <john.hammond@intel.com>
Thu, 14 Jun 2018 17:33:09 +0000 (17:33 +0000)
The current method of handling tunables with ll_process_config can
not work with sysfs. So replace ll_process_config handling with
class_modify_config() which can handle sysfs, debugfs and procfs.

Change-Id: I40611930ab2b769c0661aa7dce0c7dd0f2d90204
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/32495
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
lustre/conf/99-lustre.rules
lustre/include/lustre_disk.h
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/lproc_llite.c
lustre/llite/super25.c
lustre/obdclass/obd_config.c

index 61cdbdf..62b5cb8 100644 (file)
@@ -4,4 +4,4 @@ KERNEL=="obd", MODE="0666"
 ACTION=="add|change", SUBSYSTEM=="block", RUN+="/usr/sbin/l_tunedisk /dev/%k"
 
 # set sysfs values on client
-SUBSYSTEM=="lustre", ACTION=="change", ENV{PARAM}=="?*", RUN+="/usr/sbin/lctl set_param $env{PARAM}=$env{SETTING}"
+SUBSYSTEM=="lustre", ACTION=="change", ENV{PARAM}=="?*", RUN+="/usr/sbin/lctl set_param '$env{PARAM}=$env{SETTING}'"
index c34a833..fe39f3b 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/byteorder.h>
 #include <linux/types.h>
 #include <linux/backing-dev.h>
+#include <linux/kobject.h>
 #include <linux/list.h>
 #include <libcfs/libcfs.h>
 #include <uapi/linux/lustre/lustre_disk.h>
@@ -119,6 +120,7 @@ struct lustre_sb_info {
        struct ll_sb_info        *lsi_llsbi;   /* add'l client sbi info */
        struct dt_device         *lsi_dt_dev;  /* dt device to access disk fs*/
        atomic_t                  lsi_mounts;  /* references to the srv_mnt */
+       struct kobject           *lsi_kobj;
        char                      lsi_svname[MTI_NAME_MAXLEN];
        /* lsi_osd_obdname format = 'lsi->ls_svname'-osd */
        char                      lsi_osd_obdname[MTI_NAME_MAXLEN + 4];
index 5c46e34..b598f7f 100644 (file)
@@ -944,7 +944,6 @@ int ll_obd_statfs(struct inode *inode, void __user *arg);
 int ll_get_max_mdsize(struct ll_sb_info *sbi, int *max_mdsize);
 int ll_get_default_mdsize(struct ll_sb_info *sbi, int *default_mdsize);
 int ll_set_default_mdsize(struct ll_sb_info *sbi, int default_mdsize);
-int ll_process_config(struct lustre_cfg *lcfg);
 
 enum {
        LUSTRE_OPC_MKDIR        = 0,
index a56ffb5..74779e7 100644 (file)
@@ -2456,32 +2456,6 @@ out_statfs:
        return rc;
 }
 
-int ll_process_config(struct lustre_cfg *lcfg)
-{
-       struct super_block *sb;
-       unsigned long x;
-       int rc = 0;
-       char *ptr;
-
-       /* The instance name contains the sb: lustre-client-aacfe000 */
-       ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
-       if (!ptr || !*(++ptr))
-               return -EINVAL;
-       if (sscanf(ptr, "%lx", &x) != 1)
-               return -EINVAL;
-       sb = (struct super_block *)x;
-       /* This better be a real Lustre superblock! */
-       LASSERT(s2lsi(sb)->lsi_lmd->lmd_magic == LMD_MAGIC);
-
-       /* Note we have not called client_common_fill_super yet, so
-          proc fns must be able to handle that! */
-       rc = class_process_proc_param(PARAM_LLITE, lprocfs_llite_obd_vars,
-                                     lcfg, sb);
-       if (rc > 0)
-               rc = 0;
-       return rc;
-}
-
 /* this function prepares md_op_data hint for passing it down to MD stack. */
 struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
                                      struct inode *i1, struct inode *i2,
index 91f003c..7e2cb19 100644 (file)
@@ -1306,6 +1306,7 @@ LPROC_SEQ_FOPS_RO_TYPE(llite, uuid);
 
 int ll_debugfs_register_super(struct super_block *sb, const char *name)
 {
+       struct lustre_sb_info *lsi = s2lsi(sb);
        struct ll_sb_info *sbi = ll_s2sbi(sb);
        struct lprocfs_vars lvars[2];
        int err, id, rc;
@@ -1398,6 +1399,9 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name)
        err = kset_register(&sbi->ll_kset);
        if (err)
                GOTO(out_ra_stats, err);
+
+       lsi->lsi_kobj = kobject_get(&sbi->ll_kset.kobj);
+
        RETURN(0);
 out_ra_stats:
        lprocfs_free_stats(&sbi->ll_ra_stats);
@@ -1460,8 +1464,11 @@ out:
 
 void ll_debugfs_unregister_super(struct super_block *sb)
 {
+       struct lustre_sb_info *lsi = s2lsi(sb);
        struct ll_sb_info *sbi = ll_s2sbi(sb);
 
+       kobject_put(lsi->lsi_kobj);
+
        kset_unregister(&sbi->ll_kset);
        wait_for_completion(&sbi->ll_kobj_unregister);
 
index 32d1ec9..381a579 100644 (file)
@@ -160,7 +160,6 @@ static int __init lustre_init(void)
 
        lustre_register_client_fill_super(ll_fill_super);
        lustre_register_kill_super_cb(ll_kill_super);
-       lustre_register_client_process_config(ll_process_config);
 
        RETURN(0);
 
@@ -180,7 +179,6 @@ static void __exit lustre_exit(void)
 {
        lustre_register_client_fill_super(NULL);
        lustre_register_kill_super_cb(NULL);
-       lustre_register_client_process_config(NULL);
 
        llite_tunables_unregister();
 
index 64aca1a..66a96d8 100644 (file)
@@ -948,20 +948,13 @@ void class_del_profiles(void)
 }
 EXPORT_SYMBOL(class_del_profiles);
 
-/* We can't call ll_process_config or lquota_process_config directly because
+/* We can't call lquota_process_config directly because
  * it lives in a module that must be loaded after this one.
  */
-static int (*client_process_config)(struct lustre_cfg *lcfg) = NULL;
 #ifdef HAVE_SERVER_SUPPORT
 static int (*quota_process_config)(struct lustre_cfg *lcfg) = NULL;
 #endif /* HAVE_SERVER_SUPPORT */
 
-void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg))
-{
-        client_process_config = cpc;
-}
-EXPORT_SYMBOL(lustre_register_client_process_config);
-
 /**
  * Rename the proc parameter in \a cfg with a new name \a new_name.
  *
@@ -1207,12 +1200,32 @@ int class_process_config(struct lustre_cfg *lcfg)
         }
         case LCFG_PARAM: {
                 char *tmp;
+
                 /* llite has no obd */
-                if ((class_match_param(lustre_cfg_string(lcfg, 1),
-                                      PARAM_LLITE, NULL) == 0) &&
-                    client_process_config) {
-                        err = (*client_process_config)(lcfg);
-                        GOTO(out, err);
+               if (!class_match_param(lustre_cfg_string(lcfg, 1),
+                                      PARAM_LLITE, NULL)) {
+                       struct lustre_sb_info *lsi;
+                       unsigned long addr;
+                       ssize_t count;
+
+                       /* The instance name contains the sb:
+                        * lustre-client-aacfe000
+                        */
+                       tmp = strrchr(lustre_cfg_string(lcfg, 0), '-');
+                       if (!tmp || !*(++tmp))
+                               GOTO(out, err = -EINVAL);
+
+                       if (sscanf(tmp, "%lx", &addr) != 1)
+                               GOTO(out, err = -EINVAL);
+
+                       lsi = s2lsi((struct super_block *)addr);
+                       /* This better be a real Lustre superblock! */
+                       LASSERT(lsi->lsi_lmd->lmd_magic == LMD_MAGIC);
+
+                       count = class_modify_config(lcfg, PARAM_LLITE,
+                                                   lsi->lsi_kobj);
+                       err = count < 0 ? count : 0;
+                       GOTO(out, err);
                 } else if ((class_match_param(lustre_cfg_string(lcfg, 1),
                                               PARAM_SYS, &tmp) == 0)) {
                         /* Global param settings */