4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2012, 2013, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 #define DEBUG_SUBSYSTEM S_LLITE
38 #include <linux/version.h>
39 #include <lustre_lite.h>
40 #include <lprocfs_status.h>
41 #include <linux/seq_file.h>
42 #include <obd_support.h>
44 #include "llite_internal.h"
46 struct proc_dir_entry *proc_lustre_fs_root;
49 /* /proc/lustre/llite mount point registration */
50 extern struct file_operations vvp_dump_pgcache_file_ops;
51 struct file_operations ll_rw_extents_stats_fops;
52 struct file_operations ll_rw_extents_stats_pp_fops;
53 struct file_operations ll_rw_offset_stats_fops;
55 static int ll_rd_blksize(char *page, char **start, off_t off, int count,
58 struct super_block *sb = (struct super_block *)data;
59 struct obd_statfs osfs;
63 rc = ll_statfs_internal(sb, &osfs,
64 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
68 rc = snprintf(page, count, "%u\n", osfs.os_bsize);
74 static int ll_rd_kbytestotal(char *page, char **start, off_t off, int count,
77 struct super_block *sb = (struct super_block *)data;
78 struct obd_statfs osfs;
82 rc = ll_statfs_internal(sb, &osfs,
83 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
86 __u32 blk_size = osfs.os_bsize >> 10;
87 __u64 result = osfs.os_blocks;
89 while (blk_size >>= 1)
93 rc = snprintf(page, count, LPU64"\n", result);
99 static int ll_rd_kbytesfree(char *page, char **start, off_t off, int count,
100 int *eof, void *data)
102 struct super_block *sb = (struct super_block *)data;
103 struct obd_statfs osfs;
107 rc = ll_statfs_internal(sb, &osfs,
108 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
111 __u32 blk_size = osfs.os_bsize >> 10;
112 __u64 result = osfs.os_bfree;
114 while (blk_size >>= 1)
118 rc = snprintf(page, count, LPU64"\n", result);
123 static int ll_rd_kbytesavail(char *page, char **start, off_t off, int count,
124 int *eof, void *data)
126 struct super_block *sb = (struct super_block *)data;
127 struct obd_statfs osfs;
131 rc = ll_statfs_internal(sb, &osfs,
132 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
135 __u32 blk_size = osfs.os_bsize >> 10;
136 __u64 result = osfs.os_bavail;
138 while (blk_size >>= 1)
142 rc = snprintf(page, count, LPU64"\n", result);
147 static int ll_rd_filestotal(char *page, char **start, off_t off, int count,
148 int *eof, void *data)
150 struct super_block *sb = (struct super_block *)data;
151 struct obd_statfs osfs;
155 rc = ll_statfs_internal(sb, &osfs,
156 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
160 rc = snprintf(page, count, LPU64"\n", osfs.os_files);
165 static int ll_rd_filesfree(char *page, char **start, off_t off, int count,
166 int *eof, void *data)
168 struct super_block *sb = (struct super_block *)data;
169 struct obd_statfs osfs;
173 rc = ll_statfs_internal(sb, &osfs,
174 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
178 rc = snprintf(page, count, LPU64"\n", osfs.os_ffree);
184 static int ll_rd_client_type(char *page, char **start, off_t off, int count,
185 int *eof, void *data)
187 struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)data);
190 LASSERT(sbi != NULL);
193 if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
194 rc = snprintf(page, count, "remote client\n");
196 rc = snprintf(page, count, "local client\n");
201 static int ll_rd_fstype(char *page, char **start, off_t off, int count,
202 int *eof, void *data)
204 struct super_block *sb = (struct super_block*)data;
208 return snprintf(page, count, "%s\n", sb->s_type->name);
211 static int ll_rd_sb_uuid(char *page, char **start, off_t off, int count,
212 int *eof, void *data)
214 struct super_block *sb = (struct super_block *)data;
218 return snprintf(page, count, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
221 static int ll_rd_xattr_cache(char *page, char **start, off_t off,
222 int count, int *eof, void *data)
224 struct super_block *sb = (struct super_block *)data;
225 struct ll_sb_info *sbi = ll_s2sbi(sb);
228 rc = snprintf(page, count, "%u\n", sbi->ll_xattr_cache_enabled);
233 static int ll_wr_xattr_cache(struct file *file, const char *buffer,
234 unsigned long count, void *data)
236 struct super_block *sb = (struct super_block *)data;
237 struct ll_sb_info *sbi = ll_s2sbi(sb);
240 rc = lprocfs_write_helper(buffer, count, &val);
244 if (val != 0 && val != 1)
247 if (val == 1 && !(sbi->ll_flags & LL_SBI_XATTR_CACHE))
250 sbi->ll_xattr_cache_enabled = val;
255 static int ll_rd_site_stats(char *page, char **start, off_t off,
256 int count, int *eof, void *data)
258 struct super_block *sb = data;
261 * See description of statistical counters in struct cl_site, and
264 return cl_site_stats_print(lu2cl_site(ll_s2sbi(sb)->ll_site),
268 static int ll_rd_max_readahead_mb(char *page, char **start, off_t off,
269 int count, int *eof, void *data)
271 struct super_block *sb = data;
272 struct ll_sb_info *sbi = ll_s2sbi(sb);
276 spin_lock(&sbi->ll_lock);
277 pages_number = sbi->ll_ra_info.ra_max_pages;
278 spin_unlock(&sbi->ll_lock);
280 mult = 1 << (20 - PAGE_CACHE_SHIFT);
281 return lprocfs_read_frac_helper(page, count, pages_number, mult);
284 static int ll_wr_max_readahead_mb(struct file *file, const char *buffer,
285 unsigned long count, void *data)
287 struct super_block *sb = data;
288 struct ll_sb_info *sbi = ll_s2sbi(sb);
289 int mult, rc, pages_number;
291 mult = 1 << (20 - PAGE_CACHE_SHIFT);
292 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
296 if (pages_number < 0 || pages_number > totalram_pages / 2) {
298 CERROR("can't set file readahead more than %lu MB\n",
299 totalram_pages >> (20 - PAGE_CACHE_SHIFT + 1));
303 spin_lock(&sbi->ll_lock);
304 sbi->ll_ra_info.ra_max_pages = pages_number;
305 spin_unlock(&sbi->ll_lock);
310 static int ll_rd_max_readahead_per_file_mb(char *page, char **start, off_t off,
311 int count, int *eof, void *data)
313 struct super_block *sb = data;
314 struct ll_sb_info *sbi = ll_s2sbi(sb);
318 spin_lock(&sbi->ll_lock);
319 pages_number = sbi->ll_ra_info.ra_max_pages_per_file;
320 spin_unlock(&sbi->ll_lock);
322 mult = 1 << (20 - PAGE_CACHE_SHIFT);
323 return lprocfs_read_frac_helper(page, count, pages_number, mult);
326 static int ll_wr_max_readahead_per_file_mb(struct file *file, const char *buffer,
327 unsigned long count, void *data)
329 struct super_block *sb = data;
330 struct ll_sb_info *sbi = ll_s2sbi(sb);
331 int mult, rc, pages_number;
333 mult = 1 << (20 - PAGE_CACHE_SHIFT);
334 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
338 if (pages_number < 0 ||
339 pages_number > sbi->ll_ra_info.ra_max_pages) {
340 CERROR("can't set file readahead more than"
341 "max_read_ahead_mb %lu MB\n",
342 sbi->ll_ra_info.ra_max_pages);
346 spin_lock(&sbi->ll_lock);
347 sbi->ll_ra_info.ra_max_pages_per_file = pages_number;
348 spin_unlock(&sbi->ll_lock);
353 static int ll_rd_max_read_ahead_whole_mb(char *page, char **start, off_t off,
354 int count, int *eof, void *data)
356 struct super_block *sb = data;
357 struct ll_sb_info *sbi = ll_s2sbi(sb);
361 spin_lock(&sbi->ll_lock);
362 pages_number = sbi->ll_ra_info.ra_max_read_ahead_whole_pages;
363 spin_unlock(&sbi->ll_lock);
365 mult = 1 << (20 - PAGE_CACHE_SHIFT);
366 return lprocfs_read_frac_helper(page, count, pages_number, mult);
369 static int ll_wr_max_read_ahead_whole_mb(struct file *file, const char *buffer,
370 unsigned long count, void *data)
372 struct super_block *sb = data;
373 struct ll_sb_info *sbi = ll_s2sbi(sb);
374 int mult, rc, pages_number;
376 mult = 1 << (20 - PAGE_CACHE_SHIFT);
377 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
381 /* Cap this at the current max readahead window size, the readahead
382 * algorithm does this anyway so it's pointless to set it larger. */
383 if (pages_number < 0 ||
384 pages_number > sbi->ll_ra_info.ra_max_pages_per_file) {
385 CERROR("can't set max_read_ahead_whole_mb more than "
386 "max_read_ahead_per_file_mb: %lu\n",
387 sbi->ll_ra_info.ra_max_pages_per_file >>
388 (20 - PAGE_CACHE_SHIFT));
392 spin_lock(&sbi->ll_lock);
393 sbi->ll_ra_info.ra_max_read_ahead_whole_pages = pages_number;
394 spin_unlock(&sbi->ll_lock);
399 static int ll_rd_max_cached_mb(char *page, char **start, off_t off,
400 int count, int *eof, void *data)
402 struct super_block *sb = data;
403 struct ll_sb_info *sbi = ll_s2sbi(sb);
404 struct cl_client_cache *cache = &sbi->ll_cache;
405 int shift = 20 - PAGE_CACHE_SHIFT;
410 max_cached_mb = cache->ccc_lru_max >> shift;
411 unused_mb = cfs_atomic_read(&cache->ccc_lru_left) >> shift;
412 return snprintf(page, count,
414 "max_cached_mb: %d\n"
417 "reclaim_count: %u\n",
418 cfs_atomic_read(&cache->ccc_users),
420 max_cached_mb - unused_mb,
422 cache->ccc_lru_shrinkers);
425 static int ll_wr_max_cached_mb(struct file *file, const char *buffer,
426 unsigned long count, void *data)
428 struct super_block *sb = data;
429 struct ll_sb_info *sbi = ll_s2sbi(sb);
430 struct cl_client_cache *cache = &sbi->ll_cache;
431 int mult, rc, pages_number;
436 mult = 1 << (20 - PAGE_CACHE_SHIFT);
437 buffer = lprocfs_find_named_value(buffer, "max_cached_mb:", &count);
438 rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
442 if (pages_number < 0 || pages_number > totalram_pages) {
443 CERROR("%s: can't set max cache more than %lu MB\n",
444 ll_get_fsname(sb, NULL, 0),
445 totalram_pages >> (20 - PAGE_CACHE_SHIFT));
449 if (sbi->ll_dt_exp == NULL) /* being initialized */
452 spin_lock(&sbi->ll_lock);
453 diff = pages_number - cache->ccc_lru_max;
454 spin_unlock(&sbi->ll_lock);
456 /* easy - add more LRU slots. */
458 cfs_atomic_add(diff, &cache->ccc_lru_left);
466 /* reduce LRU budget from free slots. */
470 ov = cfs_atomic_read(&cache->ccc_lru_left);
474 nv = ov > diff ? ov - diff : 0;
475 rc = cfs_atomic_cmpxchg(&cache->ccc_lru_left, ov, nv);
476 if (likely(ov == rc)) {
486 /* difficult - have to ask OSCs to drop LRU slots. */
488 rc = obd_set_info_async(NULL, sbi->ll_dt_exp,
489 sizeof(KEY_CACHE_LRU_SHRINK),
490 KEY_CACHE_LRU_SHRINK,
491 sizeof(tmp), &tmp, NULL);
498 spin_lock(&sbi->ll_lock);
499 cache->ccc_lru_max = pages_number;
500 spin_unlock(&sbi->ll_lock);
503 cfs_atomic_add(nrpages, &cache->ccc_lru_left);
508 static int ll_rd_checksum(char *page, char **start, off_t off,
509 int count, int *eof, void *data)
511 struct super_block *sb = data;
512 struct ll_sb_info *sbi = ll_s2sbi(sb);
514 return snprintf(page, count, "%u\n",
515 (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
518 static int ll_wr_checksum(struct file *file, const char *buffer,
519 unsigned long count, void *data)
521 struct super_block *sb = data;
522 struct ll_sb_info *sbi = ll_s2sbi(sb);
529 rc = lprocfs_write_helper(buffer, count, &val);
533 sbi->ll_flags |= LL_SBI_CHECKSUM;
535 sbi->ll_flags &= ~LL_SBI_CHECKSUM;
537 rc = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CHECKSUM),
538 KEY_CHECKSUM, sizeof(val), &val, NULL);
540 CWARN("Failed to set OSC checksum flags: %d\n", rc);
545 static int ll_rd_max_rw_chunk(char *page, char **start, off_t off,
546 int count, int *eof, void *data)
548 struct super_block *sb = data;
550 return snprintf(page, count, "%lu\n", ll_s2sbi(sb)->ll_max_rw_chunk);
553 static int ll_wr_max_rw_chunk(struct file *file, const char *buffer,
554 unsigned long count, void *data)
556 struct super_block *sb = data;
559 rc = lprocfs_write_helper(buffer, count, &val);
562 ll_s2sbi(sb)->ll_max_rw_chunk = val;
566 static int ll_rd_track_id(char *page, int count, void *data,
567 enum stats_track_type type)
569 struct super_block *sb = data;
571 if (ll_s2sbi(sb)->ll_stats_track_type == type) {
572 return snprintf(page, count, "%d\n",
573 ll_s2sbi(sb)->ll_stats_track_id);
575 } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
576 return snprintf(page, count, "0 (all)\n");
578 return snprintf(page, count, "untracked\n");
582 static int ll_wr_track_id(const char *buffer, unsigned long count, void *data,
583 enum stats_track_type type)
585 struct super_block *sb = data;
588 rc = lprocfs_write_helper(buffer, count, &pid);
591 ll_s2sbi(sb)->ll_stats_track_id = pid;
593 ll_s2sbi(sb)->ll_stats_track_type = STATS_TRACK_ALL;
595 ll_s2sbi(sb)->ll_stats_track_type = type;
596 lprocfs_clear_stats(ll_s2sbi(sb)->ll_stats);
600 static int ll_rd_track_pid(char *page, char **start, off_t off,
601 int count, int *eof, void *data)
603 return (ll_rd_track_id(page, count, data, STATS_TRACK_PID));
606 static int ll_wr_track_pid(struct file *file, const char *buffer,
607 unsigned long count, void *data)
609 return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PID));
612 static int ll_rd_track_ppid(char *page, char **start, off_t off,
613 int count, int *eof, void *data)
615 return (ll_rd_track_id(page, count, data, STATS_TRACK_PPID));
618 static int ll_wr_track_ppid(struct file *file, const char *buffer,
619 unsigned long count, void *data)
621 return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PPID));
624 static int ll_rd_track_gid(char *page, char **start, off_t off,
625 int count, int *eof, void *data)
627 return (ll_rd_track_id(page, count, data, STATS_TRACK_GID));
630 static int ll_wr_track_gid(struct file *file, const char *buffer,
631 unsigned long count, void *data)
633 return (ll_wr_track_id(buffer, count, data, STATS_TRACK_GID));
636 static int ll_rd_statahead_max(char *page, char **start, off_t off,
637 int count, int *eof, void *data)
639 struct super_block *sb = data;
640 struct ll_sb_info *sbi = ll_s2sbi(sb);
642 return snprintf(page, count, "%u\n", sbi->ll_sa_max);
645 static int ll_wr_statahead_max(struct file *file, const char *buffer,
646 unsigned long count, void *data)
648 struct super_block *sb = data;
649 struct ll_sb_info *sbi = ll_s2sbi(sb);
652 rc = lprocfs_write_helper(buffer, count, &val);
656 if (val >= 0 && val <= LL_SA_RPC_MAX)
657 sbi->ll_sa_max = val;
659 CERROR("Bad statahead_max value %d. Valid values are in the "
660 "range [0, %d]\n", val, LL_SA_RPC_MAX);
665 static int ll_rd_statahead_agl(char *page, char **start, off_t off,
666 int count, int *eof, void *data)
668 struct super_block *sb = data;
669 struct ll_sb_info *sbi = ll_s2sbi(sb);
671 return snprintf(page, count, "%u\n",
672 sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
675 static int ll_wr_statahead_agl(struct file *file, const char *buffer,
676 unsigned long count, void *data)
678 struct super_block *sb = data;
679 struct ll_sb_info *sbi = ll_s2sbi(sb);
682 rc = lprocfs_write_helper(buffer, count, &val);
687 sbi->ll_flags |= LL_SBI_AGL_ENABLED;
689 sbi->ll_flags &= ~LL_SBI_AGL_ENABLED;
694 static int ll_rd_statahead_stats(char *page, char **start, off_t off,
695 int count, int *eof, void *data)
697 struct super_block *sb = data;
698 struct ll_sb_info *sbi = ll_s2sbi(sb);
700 return snprintf(page, count,
701 "statahead total: %u\n"
702 "statahead wrong: %u\n"
704 atomic_read(&sbi->ll_sa_total),
705 atomic_read(&sbi->ll_sa_wrong),
706 atomic_read(&sbi->ll_agl_total));
709 static int ll_rd_lazystatfs(char *page, char **start, off_t off,
710 int count, int *eof, void *data)
712 struct super_block *sb = data;
713 struct ll_sb_info *sbi = ll_s2sbi(sb);
715 return snprintf(page, count, "%u\n",
716 (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
719 static int ll_wr_lazystatfs(struct file *file, const char *buffer,
720 unsigned long count, void *data)
722 struct super_block *sb = data;
723 struct ll_sb_info *sbi = ll_s2sbi(sb);
726 rc = lprocfs_write_helper(buffer, count, &val);
731 sbi->ll_flags |= LL_SBI_LAZYSTATFS;
733 sbi->ll_flags &= ~LL_SBI_LAZYSTATFS;
738 static int ll_rd_maxea_size(char *page, char **start, off_t off,
739 int count, int *eof, void *data)
741 struct super_block *sb = data;
742 struct ll_sb_info *sbi = ll_s2sbi(sb);
746 rc = ll_get_max_mdsize(sbi, &ealen);
750 return snprintf(page, count, "%u\n", ealen);
753 static int ll_rd_sbi_flags(char *page, char **start, off_t off,
754 int count, int *eof, void *data)
756 const char *str[] = LL_SBI_FLAGS;
757 struct super_block *sb = data;
758 int flags = ll_s2sbi(sb)->ll_flags;
763 if (ARRAY_SIZE(str) <= i) {
764 CERROR("%s: Revise array LL_SBI_FLAGS to match sbi "
765 "flags please.\n", ll_get_fsname(sb, NULL, 0));
770 rc += snprintf(page + rc, count - rc, "%s ", str[i]);
775 rc += snprintf(page + rc, count - rc, "\b\n");
779 static int ll_rd_unstable_stats(char *page, char **start, off_t off,
780 int count, int *eof, void *data)
782 struct super_block *sb = data;
783 struct ll_sb_info *sbi = ll_s2sbi(sb);
784 struct cl_client_cache *cache = &sbi->ll_cache;
787 pages = cfs_atomic_read(&cache->ccc_unstable_nr);
788 mb = (pages * PAGE_CACHE_SIZE) >> 20;
790 rc = snprintf(page, count, "unstable_pages: %8d\n"
791 "unstable_mb: %8d\n", pages, mb);
796 static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
797 { "uuid", ll_rd_sb_uuid, 0, 0 },
798 //{ "mntpt_path", ll_rd_path, 0, 0 },
799 { "fstype", ll_rd_fstype, 0, 0 },
800 { "site", ll_rd_site_stats, 0, 0 },
801 { "blocksize", ll_rd_blksize, 0, 0 },
802 { "kbytestotal", ll_rd_kbytestotal, 0, 0 },
803 { "kbytesfree", ll_rd_kbytesfree, 0, 0 },
804 { "kbytesavail", ll_rd_kbytesavail, 0, 0 },
805 { "filestotal", ll_rd_filestotal, 0, 0 },
806 { "filesfree", ll_rd_filesfree, 0, 0 },
807 { "client_type", ll_rd_client_type, 0, 0 },
808 //{ "filegroups", lprocfs_rd_filegroups, 0, 0 },
809 { "max_read_ahead_mb", ll_rd_max_readahead_mb,
810 ll_wr_max_readahead_mb, 0 },
811 { "max_read_ahead_per_file_mb", ll_rd_max_readahead_per_file_mb,
812 ll_wr_max_readahead_per_file_mb, 0 },
813 { "max_read_ahead_whole_mb", ll_rd_max_read_ahead_whole_mb,
814 ll_wr_max_read_ahead_whole_mb, 0 },
815 { "max_cached_mb", ll_rd_max_cached_mb, ll_wr_max_cached_mb, 0 },
816 { "checksum_pages", ll_rd_checksum, ll_wr_checksum, 0 },
817 { "max_rw_chunk", ll_rd_max_rw_chunk, ll_wr_max_rw_chunk, 0 },
818 { "stats_track_pid", ll_rd_track_pid, ll_wr_track_pid, 0 },
819 { "stats_track_ppid", ll_rd_track_ppid, ll_wr_track_ppid, 0 },
820 { "stats_track_gid", ll_rd_track_gid, ll_wr_track_gid, 0 },
821 { "statahead_max", ll_rd_statahead_max, ll_wr_statahead_max, 0 },
822 { "statahead_agl", ll_rd_statahead_agl, ll_wr_statahead_agl, 0 },
823 { "statahead_stats", ll_rd_statahead_stats, 0, 0 },
824 { "lazystatfs", ll_rd_lazystatfs, ll_wr_lazystatfs, 0 },
825 { "max_easize", ll_rd_maxea_size, 0, 0 },
826 { "sbi_flags", ll_rd_sbi_flags, 0, 0 },
827 { "xattr_cache", ll_rd_xattr_cache, ll_wr_xattr_cache, 0 },
828 { "unstable_stats", ll_rd_unstable_stats, 0, 0},
832 #define MAX_STRING_SIZE 128
834 struct llite_file_opcode {
838 } llite_opcode_table[LPROC_LL_FILE_OPCODES] = {
840 { LPROC_LL_DIRTY_HITS, LPROCFS_TYPE_REGS, "dirty_pages_hits" },
841 { LPROC_LL_DIRTY_MISSES, LPROCFS_TYPE_REGS, "dirty_pages_misses" },
842 { LPROC_LL_READ_BYTES, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES,
844 { LPROC_LL_WRITE_BYTES, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES,
846 { LPROC_LL_BRW_READ, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_PAGES,
848 { LPROC_LL_BRW_WRITE, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_PAGES,
850 { LPROC_LL_OSC_READ, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES,
852 { LPROC_LL_OSC_WRITE, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES,
854 { LPROC_LL_IOCTL, LPROCFS_TYPE_REGS, "ioctl" },
855 { LPROC_LL_OPEN, LPROCFS_TYPE_REGS, "open" },
856 { LPROC_LL_RELEASE, LPROCFS_TYPE_REGS, "close" },
857 { LPROC_LL_MAP, LPROCFS_TYPE_REGS, "mmap" },
858 { LPROC_LL_LLSEEK, LPROCFS_TYPE_REGS, "seek" },
859 { LPROC_LL_FSYNC, LPROCFS_TYPE_REGS, "fsync" },
860 { LPROC_LL_READDIR, LPROCFS_TYPE_REGS, "readdir" },
861 /* inode operation */
862 { LPROC_LL_SETATTR, LPROCFS_TYPE_REGS, "setattr" },
863 { LPROC_LL_TRUNC, LPROCFS_TYPE_REGS, "truncate" },
864 { LPROC_LL_FLOCK, LPROCFS_TYPE_REGS, "flock" },
865 { LPROC_LL_GETATTR, LPROCFS_TYPE_REGS, "getattr" },
866 /* dir inode operation */
867 { LPROC_LL_CREATE, LPROCFS_TYPE_REGS, "create" },
868 { LPROC_LL_LINK, LPROCFS_TYPE_REGS, "link" },
869 { LPROC_LL_UNLINK, LPROCFS_TYPE_REGS, "unlink" },
870 { LPROC_LL_SYMLINK, LPROCFS_TYPE_REGS, "symlink" },
871 { LPROC_LL_MKDIR, LPROCFS_TYPE_REGS, "mkdir" },
872 { LPROC_LL_RMDIR, LPROCFS_TYPE_REGS, "rmdir" },
873 { LPROC_LL_MKNOD, LPROCFS_TYPE_REGS, "mknod" },
874 { LPROC_LL_RENAME, LPROCFS_TYPE_REGS, "rename" },
875 /* special inode operation */
876 { LPROC_LL_STAFS, LPROCFS_TYPE_REGS, "statfs" },
877 { LPROC_LL_ALLOC_INODE, LPROCFS_TYPE_REGS, "alloc_inode" },
878 { LPROC_LL_SETXATTR, LPROCFS_TYPE_REGS, "setxattr" },
879 { LPROC_LL_GETXATTR, LPROCFS_TYPE_REGS, "getxattr" },
880 { LPROC_LL_GETXATTR_HITS, LPROCFS_TYPE_REGS, "getxattr_hits" },
881 { LPROC_LL_LISTXATTR, LPROCFS_TYPE_REGS, "listxattr" },
882 { LPROC_LL_REMOVEXATTR, LPROCFS_TYPE_REGS, "removexattr" },
883 { LPROC_LL_INODE_PERM, LPROCFS_TYPE_REGS, "inode_permission" },
886 void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count)
890 if (sbi->ll_stats_track_type == STATS_TRACK_ALL)
891 lprocfs_counter_add(sbi->ll_stats, op, count);
892 else if (sbi->ll_stats_track_type == STATS_TRACK_PID &&
893 sbi->ll_stats_track_id == current->pid)
894 lprocfs_counter_add(sbi->ll_stats, op, count);
895 else if (sbi->ll_stats_track_type == STATS_TRACK_PPID &&
896 sbi->ll_stats_track_id == current->parent->pid)
897 lprocfs_counter_add(sbi->ll_stats, op, count);
898 else if (sbi->ll_stats_track_type == STATS_TRACK_GID &&
899 sbi->ll_stats_track_id == current_gid())
900 lprocfs_counter_add(sbi->ll_stats, op, count);
902 EXPORT_SYMBOL(ll_stats_ops_tally);
904 static const char *ra_stat_string[] = {
905 [RA_STAT_HIT] = "hits",
906 [RA_STAT_MISS] = "misses",
907 [RA_STAT_DISTANT_READPAGE] = "readpage not consecutive",
908 [RA_STAT_MISS_IN_WINDOW] = "miss inside window",
909 [RA_STAT_FAILED_GRAB_PAGE] = "failed grab_cache_page",
910 [RA_STAT_FAILED_MATCH] = "failed lock match",
911 [RA_STAT_DISCARDED] = "read but discarded",
912 [RA_STAT_ZERO_LEN] = "zero length file",
913 [RA_STAT_ZERO_WINDOW] = "zero size window",
914 [RA_STAT_EOF] = "read-ahead to EOF",
915 [RA_STAT_MAX_IN_FLIGHT] = "hit max r-a issue",
916 [RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page",
920 int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
921 struct super_block *sb, char *osc, char *mdc)
923 struct lprocfs_vars lvars[2];
924 struct lustre_sb_info *lsi = s2lsi(sb);
925 struct ll_sb_info *sbi = ll_s2sbi(sb);
926 struct obd_device *obd;
927 char name[MAX_STRING_SIZE + 1], *ptr;
928 int err, id, len, rc;
931 memset(lvars, 0, sizeof(lvars));
933 name[MAX_STRING_SIZE] = '\0';
934 lvars[0].name = name;
936 LASSERT(sbi != NULL);
937 LASSERT(mdc != NULL);
938 LASSERT(osc != NULL);
941 len = strlen(lsi->lsi_lmd->lmd_profile);
942 ptr = strrchr(lsi->lsi_lmd->lmd_profile, '-');
943 if (ptr && (strcmp(ptr, "-client") == 0))
947 snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len,
948 lsi->lsi_lmd->lmd_profile, sb);
950 sbi->ll_proc_root = lprocfs_register(name, parent, NULL, NULL);
951 if (IS_ERR(sbi->ll_proc_root)) {
952 err = PTR_ERR(sbi->ll_proc_root);
953 sbi->ll_proc_root = NULL;
957 rc = lprocfs_seq_create(sbi->ll_proc_root, "dump_page_cache", 0444,
958 &vvp_dump_pgcache_file_ops, sbi);
960 CWARN("Error adding the dump_page_cache file\n");
962 rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats", 0644,
963 &ll_rw_extents_stats_fops, sbi);
965 CWARN("Error adding the extent_stats file\n");
967 rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats_per_process",
968 0644, &ll_rw_extents_stats_pp_fops, sbi);
970 CWARN("Error adding the extents_stats_per_process file\n");
972 rc = lprocfs_seq_create(sbi->ll_proc_root, "offset_stats", 0644,
973 &ll_rw_offset_stats_fops, sbi);
975 CWARN("Error adding the offset_stats file\n");
977 /* File operations stats */
978 sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
979 LPROCFS_STATS_FLAG_NONE);
980 if (sbi->ll_stats == NULL)
981 GOTO(out, err = -ENOMEM);
982 /* do counter init */
983 for (id = 0; id < LPROC_LL_FILE_OPCODES; id++) {
984 __u32 type = llite_opcode_table[id].type;
986 if (type & LPROCFS_TYPE_REGS)
988 else if (type & LPROCFS_TYPE_BYTES)
990 else if (type & LPROCFS_TYPE_PAGES)
992 lprocfs_counter_init(sbi->ll_stats,
993 llite_opcode_table[id].opcode,
994 (type & LPROCFS_CNTR_AVGMINMAX),
995 llite_opcode_table[id].opname, ptr);
997 err = lprocfs_register_stats(sbi->ll_proc_root, "stats", sbi->ll_stats);
1001 sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
1002 LPROCFS_STATS_FLAG_NONE);
1003 if (sbi->ll_ra_stats == NULL)
1004 GOTO(out, err = -ENOMEM);
1006 for (id = 0; id < ARRAY_SIZE(ra_stat_string); id++)
1007 lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
1008 ra_stat_string[id], "pages");
1009 err = lprocfs_register_stats(sbi->ll_proc_root, "read_ahead_stats",
1015 err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
1020 obd = class_name2obd(mdc);
1022 LASSERT(obd != NULL);
1023 LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
1024 LASSERT(obd->obd_type->typ_name != NULL);
1026 snprintf(name, MAX_STRING_SIZE, "%s/common_name",
1027 obd->obd_type->typ_name);
1028 lvars[0].read_fptr = lprocfs_rd_name;
1029 err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
1033 snprintf(name, MAX_STRING_SIZE, "%s/uuid", obd->obd_type->typ_name);
1034 lvars[0].read_fptr = lprocfs_rd_uuid;
1035 err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
1040 obd = class_name2obd(osc);
1042 LASSERT(obd != NULL);
1043 LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
1044 LASSERT(obd->obd_type->typ_name != NULL);
1046 snprintf(name, MAX_STRING_SIZE, "%s/common_name",
1047 obd->obd_type->typ_name);
1048 lvars[0].read_fptr = lprocfs_rd_name;
1049 err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
1053 snprintf(name, MAX_STRING_SIZE, "%s/uuid", obd->obd_type->typ_name);
1054 lvars[0].read_fptr = lprocfs_rd_uuid;
1055 err = lprocfs_add_vars(sbi->ll_proc_root, lvars, obd);
1058 lprocfs_remove(&sbi->ll_proc_root);
1059 lprocfs_free_stats(&sbi->ll_ra_stats);
1060 lprocfs_free_stats(&sbi->ll_stats);
1065 void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi)
1067 if (sbi->ll_proc_root) {
1068 lprocfs_remove(&sbi->ll_proc_root);
1069 lprocfs_free_stats(&sbi->ll_ra_stats);
1070 lprocfs_free_stats(&sbi->ll_stats);
1073 #undef MAX_STRING_SIZE
1075 #define pct(a,b) (b ? a * 100 / b : 0)
1077 static void ll_display_extents_info(struct ll_rw_extents_info *io_extents,
1078 struct seq_file *seq, int which)
1080 unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
1081 unsigned long start, end, r, w;
1082 char *unitp = "KMGTPEZY";
1084 struct per_process_info *pp_info = &io_extents->pp_extents[which];
1090 for(i = 0; i < LL_HIST_MAX; i++) {
1091 read_tot += pp_info->pp_r_hist.oh_buckets[i];
1092 write_tot += pp_info->pp_w_hist.oh_buckets[i];
1095 for(i = 0; i < LL_HIST_MAX; i++) {
1096 r = pp_info->pp_r_hist.oh_buckets[i];
1097 w = pp_info->pp_w_hist.oh_buckets[i];
1100 end = 1 << (i + LL_HIST_START - units);
1101 seq_printf(seq, "%4lu%c - %4lu%c%c: %14lu %4lu %4lu | "
1102 "%14lu %4lu %4lu\n", start, *unitp, end, *unitp,
1103 (i == LL_HIST_MAX - 1) ? '+' : ' ',
1104 r, pct(r, read_tot), pct(read_cum, read_tot),
1105 w, pct(w, write_tot), pct(write_cum, write_tot));
1107 if (start == 1<<10) {
1112 if (read_cum == read_tot && write_cum == write_tot)
1117 static int ll_rw_extents_stats_pp_seq_show(struct seq_file *seq, void *v)
1120 struct ll_sb_info *sbi = seq->private;
1121 struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
1124 do_gettimeofday(&now);
1126 if (!sbi->ll_rw_stats_on) {
1127 seq_printf(seq, "disabled\n"
1128 "write anything in this file to activate, "
1129 "then 0 or \"[D/d]isabled\" to deactivate\n");
1132 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
1133 now.tv_sec, now.tv_usec);
1134 seq_printf(seq, "%15s %19s | %20s\n", " ", "read", "write");
1135 seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
1136 "extents", "calls", "%", "cum%",
1137 "calls", "%", "cum%");
1138 spin_lock(&sbi->ll_pp_extent_lock);
1139 for (k = 0; k < LL_PROCESS_HIST_MAX; k++) {
1140 if (io_extents->pp_extents[k].pid != 0) {
1141 seq_printf(seq, "\nPID: %d\n",
1142 io_extents->pp_extents[k].pid);
1143 ll_display_extents_info(io_extents, seq, k);
1146 spin_unlock(&sbi->ll_pp_extent_lock);
1150 static ssize_t ll_rw_extents_stats_pp_seq_write(struct file *file,
1151 const char *buf, size_t len,
1154 struct seq_file *seq = file->private_data;
1155 struct ll_sb_info *sbi = seq->private;
1156 struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
1158 int value = 1, rc = 0;
1160 rc = lprocfs_write_helper(buf, len, &value);
1161 if (rc < 0 && (strcmp(buf, "disabled") == 0 ||
1162 strcmp(buf, "Disabled") == 0))
1166 sbi->ll_rw_stats_on = 0;
1168 sbi->ll_rw_stats_on = 1;
1170 spin_lock(&sbi->ll_pp_extent_lock);
1171 for (i = 0; i < LL_PROCESS_HIST_MAX; i++) {
1172 io_extents->pp_extents[i].pid = 0;
1173 lprocfs_oh_clear(&io_extents->pp_extents[i].pp_r_hist);
1174 lprocfs_oh_clear(&io_extents->pp_extents[i].pp_w_hist);
1176 spin_unlock(&sbi->ll_pp_extent_lock);
1180 LPROC_SEQ_FOPS(ll_rw_extents_stats_pp);
1182 static int ll_rw_extents_stats_seq_show(struct seq_file *seq, void *v)
1185 struct ll_sb_info *sbi = seq->private;
1186 struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
1188 do_gettimeofday(&now);
1190 if (!sbi->ll_rw_stats_on) {
1191 seq_printf(seq, "disabled\n"
1192 "write anything in this file to activate, "
1193 "then 0 or \"[D/d]isabled\" to deactivate\n");
1196 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
1197 now.tv_sec, now.tv_usec);
1199 seq_printf(seq, "%15s %19s | %20s\n", " ", "read", "write");
1200 seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
1201 "extents", "calls", "%", "cum%",
1202 "calls", "%", "cum%");
1203 spin_lock(&sbi->ll_lock);
1204 ll_display_extents_info(io_extents, seq, LL_PROCESS_HIST_MAX);
1205 spin_unlock(&sbi->ll_lock);
1210 static ssize_t ll_rw_extents_stats_seq_write(struct file *file, const char *buf,
1211 size_t len, loff_t *off)
1213 struct seq_file *seq = file->private_data;
1214 struct ll_sb_info *sbi = seq->private;
1215 struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
1217 int value = 1, rc = 0;
1219 rc = lprocfs_write_helper(buf, len, &value);
1220 if (rc < 0 && (strcmp(buf, "disabled") == 0 ||
1221 strcmp(buf, "Disabled") == 0))
1225 sbi->ll_rw_stats_on = 0;
1227 sbi->ll_rw_stats_on = 1;
1228 spin_lock(&sbi->ll_pp_extent_lock);
1229 for (i = 0; i <= LL_PROCESS_HIST_MAX; i++) {
1230 io_extents->pp_extents[i].pid = 0;
1231 lprocfs_oh_clear(&io_extents->pp_extents[i].pp_r_hist);
1232 lprocfs_oh_clear(&io_extents->pp_extents[i].pp_w_hist);
1234 spin_unlock(&sbi->ll_pp_extent_lock);
1239 LPROC_SEQ_FOPS(ll_rw_extents_stats);
1241 void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
1242 struct ll_file_data *file, loff_t pos,
1243 size_t count, int rw)
1246 struct ll_rw_process_info *process;
1247 struct ll_rw_process_info *offset;
1248 int *off_count = &sbi->ll_rw_offset_entry_count;
1249 int *process_count = &sbi->ll_offset_process_count;
1250 struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
1252 if(!sbi->ll_rw_stats_on)
1254 process = sbi->ll_rw_process_info;
1255 offset = sbi->ll_rw_offset_info;
1257 spin_lock(&sbi->ll_pp_extent_lock);
1258 /* Extent statistics */
1259 for(i = 0; i < LL_PROCESS_HIST_MAX; i++) {
1260 if(io_extents->pp_extents[i].pid == pid) {
1268 sbi->ll_extent_process_count =
1269 (sbi->ll_extent_process_count + 1) % LL_PROCESS_HIST_MAX;
1270 cur = sbi->ll_extent_process_count;
1271 io_extents->pp_extents[cur].pid = pid;
1272 lprocfs_oh_clear(&io_extents->pp_extents[cur].pp_r_hist);
1273 lprocfs_oh_clear(&io_extents->pp_extents[cur].pp_w_hist);
1276 for(i = 0; (count >= (1 << LL_HIST_START << i)) &&
1277 (i < (LL_HIST_MAX - 1)); i++);
1279 io_extents->pp_extents[cur].pp_r_hist.oh_buckets[i]++;
1280 io_extents->pp_extents[LL_PROCESS_HIST_MAX].pp_r_hist.oh_buckets[i]++;
1282 io_extents->pp_extents[cur].pp_w_hist.oh_buckets[i]++;
1283 io_extents->pp_extents[LL_PROCESS_HIST_MAX].pp_w_hist.oh_buckets[i]++;
1285 spin_unlock(&sbi->ll_pp_extent_lock);
1287 spin_lock(&sbi->ll_process_lock);
1288 /* Offset statistics */
1289 for (i = 0; i < LL_PROCESS_HIST_MAX; i++) {
1290 if (process[i].rw_pid == pid) {
1291 if (process[i].rw_last_file != file) {
1292 process[i].rw_range_start = pos;
1293 process[i].rw_last_file_pos = pos + count;
1294 process[i].rw_smallest_extent = count;
1295 process[i].rw_largest_extent = count;
1296 process[i].rw_offset = 0;
1297 process[i].rw_last_file = file;
1298 spin_unlock(&sbi->ll_process_lock);
1301 if (process[i].rw_last_file_pos != pos) {
1303 (*off_count + 1) % LL_OFFSET_HIST_MAX;
1304 offset[*off_count].rw_op = process[i].rw_op;
1305 offset[*off_count].rw_pid = pid;
1306 offset[*off_count].rw_range_start =
1307 process[i].rw_range_start;
1308 offset[*off_count].rw_range_end =
1309 process[i].rw_last_file_pos;
1310 offset[*off_count].rw_smallest_extent =
1311 process[i].rw_smallest_extent;
1312 offset[*off_count].rw_largest_extent =
1313 process[i].rw_largest_extent;
1314 offset[*off_count].rw_offset =
1315 process[i].rw_offset;
1316 process[i].rw_op = rw;
1317 process[i].rw_range_start = pos;
1318 process[i].rw_smallest_extent = count;
1319 process[i].rw_largest_extent = count;
1320 process[i].rw_offset = pos -
1321 process[i].rw_last_file_pos;
1323 if(process[i].rw_smallest_extent > count)
1324 process[i].rw_smallest_extent = count;
1325 if(process[i].rw_largest_extent < count)
1326 process[i].rw_largest_extent = count;
1327 process[i].rw_last_file_pos = pos + count;
1328 spin_unlock(&sbi->ll_process_lock);
1332 *process_count = (*process_count + 1) % LL_PROCESS_HIST_MAX;
1333 process[*process_count].rw_pid = pid;
1334 process[*process_count].rw_op = rw;
1335 process[*process_count].rw_range_start = pos;
1336 process[*process_count].rw_last_file_pos = pos + count;
1337 process[*process_count].rw_smallest_extent = count;
1338 process[*process_count].rw_largest_extent = count;
1339 process[*process_count].rw_offset = 0;
1340 process[*process_count].rw_last_file = file;
1341 spin_unlock(&sbi->ll_process_lock);
1344 static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v)
1347 struct ll_sb_info *sbi = seq->private;
1348 struct ll_rw_process_info *offset = sbi->ll_rw_offset_info;
1349 struct ll_rw_process_info *process = sbi->ll_rw_process_info;
1352 do_gettimeofday(&now);
1354 if (!sbi->ll_rw_stats_on) {
1355 seq_printf(seq, "disabled\n"
1356 "write anything in this file to activate, "
1357 "then 0 or \"[D/d]isabled\" to deactivate\n");
1360 spin_lock(&sbi->ll_process_lock);
1362 seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
1363 now.tv_sec, now.tv_usec);
1364 seq_printf(seq, "%3s %10s %14s %14s %17s %17s %14s\n",
1365 "R/W", "PID", "RANGE START", "RANGE END",
1366 "SMALLEST EXTENT", "LARGEST EXTENT", "OFFSET");
1368 /* We stored the discontiguous offsets here; print them first */
1369 for (i = 0; i < LL_OFFSET_HIST_MAX; i++) {
1370 if (offset[i].rw_pid != 0)
1372 "%3c %10d %14Lu %14Lu %17lu %17lu %14Lu",
1373 offset[i].rw_op == READ ? 'R' : 'W',
1375 offset[i].rw_range_start,
1376 offset[i].rw_range_end,
1377 (unsigned long)offset[i].rw_smallest_extent,
1378 (unsigned long)offset[i].rw_largest_extent,
1379 offset[i].rw_offset);
1382 /* Then print the current offsets for each process */
1383 for (i = 0; i < LL_PROCESS_HIST_MAX; i++) {
1384 if (process[i].rw_pid != 0)
1386 "%3c %10d %14Lu %14Lu %17lu %17lu %14Lu",
1387 process[i].rw_op == READ ? 'R' : 'W',
1389 process[i].rw_range_start,
1390 process[i].rw_last_file_pos,
1391 (unsigned long)process[i].rw_smallest_extent,
1392 (unsigned long)process[i].rw_largest_extent,
1393 process[i].rw_offset);
1395 spin_unlock(&sbi->ll_process_lock);
1400 static ssize_t ll_rw_offset_stats_seq_write(struct file *file, const char *buf,
1401 size_t len, loff_t *off)
1403 struct seq_file *seq = file->private_data;
1404 struct ll_sb_info *sbi = seq->private;
1405 struct ll_rw_process_info *process_info = sbi->ll_rw_process_info;
1406 struct ll_rw_process_info *offset_info = sbi->ll_rw_offset_info;
1407 int value = 1, rc = 0;
1409 rc = lprocfs_write_helper(buf, len, &value);
1411 if (rc < 0 && (strcmp(buf, "disabled") == 0 ||
1412 strcmp(buf, "Disabled") == 0))
1416 sbi->ll_rw_stats_on = 0;
1418 sbi->ll_rw_stats_on = 1;
1420 spin_lock(&sbi->ll_process_lock);
1421 sbi->ll_offset_process_count = 0;
1422 sbi->ll_rw_offset_entry_count = 0;
1423 memset(process_info, 0, sizeof(struct ll_rw_process_info) *
1424 LL_PROCESS_HIST_MAX);
1425 memset(offset_info, 0, sizeof(struct ll_rw_process_info) *
1426 LL_OFFSET_HIST_MAX);
1427 spin_unlock(&sbi->ll_process_lock);
1432 LPROC_SEQ_FOPS(ll_rw_offset_stats);
1434 void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
1436 lvars->module_vars = NULL;
1437 lvars->obd_vars = lprocfs_llite_obd_vars;
1439 #endif /* LPROCFS */