From: Qian Yingjin Date: Wed, 5 Jul 2023 09:05:57 +0000 (-0400) Subject: LU-14361 statahead: add tunable for fname pattern statahead X-Git-Tag: 2.15.59~30 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6fbffd9c09ad4526ce3a03b8d85f0ce273cac037;p=fs%2Flustre-release.git LU-14361 statahead: add tunable for fname pattern statahead This patch adds a tunable parameter for fname pattern statahead. Currenty fname pattern statahead is disabled. It will be enabled by default once the patch series of fname pattern statahead work is finished and stable. Signed-off-by: Qian Yingjin Change-Id: I7a207e66df10b45bff1b3993e8724116489365b7 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51572 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao --- diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 4d96376..fa238a1 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -819,7 +819,8 @@ struct ll_sb_info { ll_xattr_cache_set:1, /* already set to 0/1 */ ll_client_common_fill_super_succeeded:1, ll_checksum_set:1, - ll_inode_cache_enabled:1; + ll_inode_cache_enabled:1, + ll_enable_statahead_fname:1; struct lustre_client_ocd ll_lco; diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 5f55b07..ef8fabf 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -739,6 +739,36 @@ static ssize_t stats_track_gid_store(struct kobject *kobj, } LUSTRE_RW_ATTR(stats_track_gid); +static ssize_t enable_statahead_fname_show(struct kobject *kobj, + struct attribute *attr, + char *buf) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); + + return snprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_enable_statahead_fname); +} + +static ssize_t enable_statahead_fname_store(struct kobject *kobj, + struct attribute *attr, + const char *buffer, + size_t count) +{ + struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info, + ll_kset.kobj); + bool val; + int rc; + + rc = kstrtobool(buffer, &val); + if (rc) + return rc; + + sbi->ll_enable_statahead_fname = val; + + return count; +} +LUSTRE_RW_ATTR(enable_statahead_fname); + static ssize_t statahead_running_max_show(struct kobject *kobj, struct attribute *attr, char *buf) @@ -1916,6 +1946,7 @@ static struct attribute *llite_attrs[] = { &lustre_attr_stats_track_pid.attr, &lustre_attr_stats_track_ppid.attr, &lustre_attr_stats_track_gid.attr, + &lustre_attr_enable_statahead_fname.attr, &lustre_attr_statahead_running_max.attr, &lustre_attr_statahead_batch_max.attr, &lustre_attr_statahead_max.attr,