Whamcloud - gitweb
LU-8066 llite: replace ll_process_config with class_modify_config 22/32722/4
authorJames Simmons <uja.ornl@yahoo.com>
Tue, 3 Jul 2018 00:35:05 +0000 (20:35 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 18 Jul 2018 06:01:07 +0000 (06:01 +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: I7ef5a4b1ee47827711a9d6654fda279abde06268
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/32722
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.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..82a8afc 100644 (file)
@@ -111,6 +111,7 @@ struct lustre_mount_data {
 
 /****************** superblock additional info *********************/
 struct ll_sb_info;
+struct kobject;
 
 struct lustre_sb_info {
        int                       lsi_flags;
@@ -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 f0b839f..31f25b3 100644 (file)
@@ -946,7 +946,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 90b1290..cba385c 100644 (file)
@@ -2457,32 +2457,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 ee96bac..7602ac4 100644 (file)
@@ -1343,6 +1343,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;
@@ -1435,6 +1436,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);
@@ -1497,8 +1501,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..f789033 100644 (file)
@@ -95,9 +95,6 @@ struct super_operations lustre_super_operations =
         .show_options  = ll_show_options,
 };
 
-
-void lustre_register_client_process_config(int (*cpc)(struct lustre_cfg *lcfg));
-
 static int __init lustre_init(void)
 {
        struct lnet_process_id lnet_id;
@@ -160,7 +157,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 +176,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..e7a9ca4 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) == 0) {
+                       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 */