Whamcloud - gitweb
LU-14361 statahead: add tunable for fname pattern statahead 72/51572/9
authorQian Yingjin <qian@ddn.com>
Wed, 5 Jul 2023 09:05:57 +0000 (05:05 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 8 Nov 2023 22:01:15 +0000 (22:01 +0000)
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 <qian@ddn.com>
Change-Id: I7a207e66df10b45bff1b3993e8724116489365b7
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51572
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
lustre/llite/llite_internal.h
lustre/llite/lproc_llite.c

index 4d96376..fa238a1 100644 (file)
@@ -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;
 
index 5f55b07..ef8fabf 100644 (file)
@@ -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,