From: James Simmons Date: Tue, 3 Jul 2018 00:35:05 +0000 (-0400) Subject: LU-8066 llite: replace ll_process_config with class_modify_config X-Git-Tag: 2.11.53~9 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=64b5c219b1fdb48cb0f37ffe59eaedd8137d9757;p=fs%2Flustre-release.git LU-8066 llite: replace ll_process_config with class_modify_config 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 Reviewed-on: https://review.whamcloud.com/32722 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/conf/99-lustre.rules b/lustre/conf/99-lustre.rules index 61cdbdf..62b5cb8 100644 --- a/lustre/conf/99-lustre.rules +++ b/lustre/conf/99-lustre.rules @@ -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}'" diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index c34a833..82a8afc 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -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]; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index f0b839f..31f25b3 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -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, diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 90b1290..cba385c 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -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, diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index ee96bac..7602ac4 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -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); diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 32d1ec9..f789033 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -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(); diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 64aca1a..e7a9ca4 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -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 */