Whamcloud - gitweb
LU-6142 lustre: don't take spinlock to read a 'long'.
[fs/lustre-release.git] / lustre / llite / lproc_llite.c
index 6ab8e5a..f6a7699 100644 (file)
@@ -324,13 +324,9 @@ static ssize_t max_read_ahead_mb_show(struct kobject *kobj,
 {
        struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
                                              ll_kset.kobj);
-       unsigned long ra_max_mb;
 
-       spin_lock(&sbi->ll_lock);
-       ra_max_mb = PAGES_TO_MiB(sbi->ll_ra_info.ra_max_pages);
-       spin_unlock(&sbi->ll_lock);
-
-       return snprintf(buf, PAGE_SIZE, "%lu\n", ra_max_mb);
+       return scnprintf(buf, PAGE_SIZE, "%lu\n",
+                       PAGES_TO_MiB(sbi->ll_ra_info.ra_max_pages));
 }
 
 static ssize_t max_read_ahead_mb_store(struct kobject *kobj,
@@ -371,13 +367,9 @@ static ssize_t max_read_ahead_per_file_mb_show(struct kobject *kobj,
 {
        struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
                                              ll_kset.kobj);
-       unsigned long ra_max_file_mb;
 
-       spin_lock(&sbi->ll_lock);
-       ra_max_file_mb = PAGES_TO_MiB(sbi->ll_ra_info.ra_max_pages_per_file);
-       spin_unlock(&sbi->ll_lock);
-
-       return snprintf(buf, PAGE_SIZE, "%lu\n", ra_max_file_mb);
+       return scnprintf(buf, PAGE_SIZE, "%lu\n",
+                        PAGES_TO_MiB(sbi->ll_ra_info.ra_max_pages_per_file));
 }
 
 static ssize_t max_read_ahead_per_file_mb_store(struct kobject *kobj,
@@ -415,13 +407,9 @@ static ssize_t max_read_ahead_whole_mb_show(struct kobject *kobj,
 {
        struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
                                              ll_kset.kobj);
-       unsigned long ra_max_whole_mb;
-
-       spin_lock(&sbi->ll_lock);
-       ra_max_whole_mb = PAGES_TO_MiB(sbi->ll_ra_info.ra_max_read_ahead_whole_pages);
-       spin_unlock(&sbi->ll_lock);
 
-       return snprintf(buf, PAGE_SIZE, "%lu\n", ra_max_whole_mb);
+       return scnprintf(buf, PAGE_SIZE, "%lu\n",
+                        PAGES_TO_MiB(sbi->ll_ra_info.ra_max_read_ahead_whole_pages));
 }
 
 static ssize_t max_read_ahead_whole_mb_store(struct kobject *kobj,
@@ -1656,19 +1644,16 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name)
        /* do counter init */
        for (id = 0; id < LPROC_LL_FILE_OPCODES; id++) {
                u32 type = llite_opcode_table[id].type;
-               void *ptr = NULL;
+               void *ptr = "unknown";
 
                if (type & LPROCFS_TYPE_REQS)
                        ptr = "reqs";
                else if (type & LPROCFS_TYPE_BYTES)
                        ptr = "bytes";
-               else if (type & LPROCFS_TYPE_PAGES)
-                       ptr = "pages";
                else if (type & LPROCFS_TYPE_USEC)
                        ptr = "usec";
                lprocfs_counter_init(sbi->ll_stats,
-                                    llite_opcode_table[id].opcode,
-                                    (type & LPROCFS_CNTR_AVGMINMAX),
+                                    llite_opcode_table[id].opcode, type,
                                     llite_opcode_table[id].opname, ptr);
        }