Whamcloud - gitweb
Revert "LU-8066 llite: replace ll_process_config with class_modify_config" 21/32721/2
authorOleg Drokin <oleg.drokin@intel.com>
Thu, 14 Jun 2018 18:08:55 +0000 (18:08 +0000)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 14 Jun 2018 18:09:09 +0000 (18:09 +0000)
This patch was landed by mistake.

This reverts commit db67e686d9abcf750359820bfbdb754ab611bf5c.

Change-Id: I2cbfe808eb7d5c448bdf06d4c36229813e6978d2
Reviewed-on: https://review.whamcloud.com/32721
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.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 62b5cb8..61cdbdf 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 fe39f3b..c34a833 100644 (file)
@@ -46,7 +46,6 @@
 #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>
@@ -120,7 +119,6 @@ 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 b598f7f..5c46e34 100644 (file)
@@ -944,6 +944,7 @@ 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 74779e7..a56ffb5 100644 (file)
@@ -2456,6 +2456,32 @@ 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 7e2cb19..91f003c 100644 (file)
@@ -1306,7 +1306,6 @@ 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;
@@ -1399,9 +1398,6 @@ 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);
@@ -1464,11 +1460,8 @@ 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 381a579..32d1ec9 100644 (file)
@@ -160,6 +160,7 @@ 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);
 
@@ -179,6 +180,7 @@ 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 66a96d8..64aca1a 100644 (file)
@@ -948,13 +948,20 @@ void class_del_profiles(void)
 }
 EXPORT_SYMBOL(class_del_profiles);
 
-/* We can't call lquota_process_config directly because
+/* We can't call ll_process_config or 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.
  *
@@ -1200,32 +1207,12 @@ 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)) {
-                       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);
+                if ((class_match_param(lustre_cfg_string(lcfg, 1),
+                                      PARAM_LLITE, NULL) == 0) &&
+                    client_process_config) {
+                        err = (*client_process_config)(lcfg);
+                        GOTO(out, err);
                 } else if ((class_match_param(lustre_cfg_string(lcfg, 1),
                                               PARAM_SYS, &tmp) == 0)) {
                         /* Global param settings */