/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright (C) 2002 Cluster File Systems, Inc.
+ * GPL HEADER START
*
- * This file is part of Lustre, http://www.lustre.org.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
*
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see [sun.com URL with a
+ * copy of GPLv2].
*
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
*/
#define DEBUG_SUBSYSTEM S_LLITE
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ,
+ OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
rc = snprintf(page, count, "%u\n", osfs.os_bsize);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ,
+ OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
__u64 result = osfs.os_blocks;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ,
+ OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
__u64 result = osfs.os_bfree;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ,
+ OBD_STATFS_NODELAY);
if (!rc) {
__u32 blk_size = osfs.os_bsize >> 10;
__u64 result = osfs.os_bavail;
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ,
+ OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
rc = snprintf(page, count, LPU64"\n", osfs.os_files);
int rc;
LASSERT(sb != NULL);
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - HZ,
+ OBD_STATFS_NODELAY);
if (!rc) {
*eof = 1;
rc = snprintf(page, count, LPU64"\n", osfs.os_ffree);
}
+static int ll_rd_client_type(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)data);
+ int rc;
+
+ LASSERT(sbi != NULL);
+
+ *eof = 1;
+ if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
+ rc = snprintf(page, count, "remote client\n");
+ else
+ rc = snprintf(page, count, "local client\n");
+
+ return rc;
+}
+
static int ll_rd_fstype(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
pages_number = sbi->ll_ra_info.ra_max_pages;
spin_unlock(&sbi->ll_lock);
- mult = 1 << (20 - CFS_PAGE_SHIFT);
+ mult = 1 << (20 - PAGE_CACHE_SHIFT);
return lprocfs_read_frac_helper(page, count, pages_number, mult);
}
sbi->ll_async_page_max = pages_number ;
spin_unlock(&sbi->ll_lock);
- if (!sbi->ll_osc_exp)
+ if (!sbi->ll_dt_exp)
/* Not set up yet, don't call llap_shrink_cache */
return count;
struct ll_sb_info *sbi = ll_s2sbi(sb);
int val, rc;
- if (!sbi->ll_osc_exp)
+ if (!sbi->ll_dt_exp)
/* Not set up yet */
return -EAGAIN;
else
sbi->ll_flags &= ~LL_SBI_CHECKSUM;
- rc = obd_set_info_async(sbi->ll_osc_exp, strlen("checksum"), "checksum",
- sizeof(val), &val, NULL);
+ rc = obd_set_info_async(sbi->ll_dt_exp, sizeof(KEY_CHECKSUM),
+ KEY_CHECKSUM, sizeof(val), &val, NULL);
if (rc)
CWARN("Failed to set OSC checksum flags: %d\n", rc);
}
static int ll_rd_track_id(char *page, int count, void *data,
- enum vfs_track_type type)
+ enum stats_track_type type)
{
struct super_block *sb = data;
- if (ll_s2sbi(sb)->ll_vfs_track_type == type) {
+ if (ll_s2sbi(sb)->ll_stats_track_type == type) {
return snprintf(page, count, "%d\n",
- ll_s2sbi(sb)->ll_vfs_track_id);
+ ll_s2sbi(sb)->ll_stats_track_id);
- } else if (ll_s2sbi(sb)->ll_vfs_track_type == VFS_TRACK_ALL) {
+ } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
return snprintf(page, count, "0 (all)\n");
} else {
return snprintf(page, count, "untracked\n");
}
static int ll_wr_track_id(const char *buffer, unsigned long count, void *data,
- enum vfs_track_type type)
+ enum stats_track_type type)
{
struct super_block *sb = data;
int rc, pid;
rc = lprocfs_write_helper(buffer, count, &pid);
if (rc)
return rc;
- ll_s2sbi(sb)->ll_vfs_track_id = pid;
+ ll_s2sbi(sb)->ll_stats_track_id = pid;
if (pid == 0)
- ll_s2sbi(sb)->ll_vfs_track_type = VFS_TRACK_ALL;
+ ll_s2sbi(sb)->ll_stats_track_type = STATS_TRACK_ALL;
else
- ll_s2sbi(sb)->ll_vfs_track_type = type;
- lprocfs_clear_stats(ll_s2sbi(sb)->ll_vfs_ops_stats);
+ ll_s2sbi(sb)->ll_stats_track_type = type;
+ lprocfs_clear_stats(ll_s2sbi(sb)->ll_stats);
return count;
}
static int ll_rd_track_pid(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- return (ll_rd_track_id(page, count, data, VFS_TRACK_PID));
+ return (ll_rd_track_id(page, count, data, STATS_TRACK_PID));
}
static int ll_wr_track_pid(struct file *file, const char *buffer,
unsigned long count, void *data)
{
- return (ll_wr_track_id(buffer, count, data, VFS_TRACK_PID));
+ return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PID));
}
static int ll_rd_track_ppid(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- return (ll_rd_track_id(page, count, data, VFS_TRACK_PPID));
+ return (ll_rd_track_id(page, count, data, STATS_TRACK_PPID));
}
static int ll_wr_track_ppid(struct file *file, const char *buffer,
unsigned long count, void *data)
{
- return (ll_wr_track_id(buffer, count, data, VFS_TRACK_PPID));
+ return (ll_wr_track_id(buffer, count, data, STATS_TRACK_PPID));
}
static int ll_rd_track_gid(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- return (ll_rd_track_id(page, count, data, VFS_TRACK_GID));
+ return (ll_rd_track_id(page, count, data, STATS_TRACK_GID));
}
static int ll_wr_track_gid(struct file *file, const char *buffer,
unsigned long count, void *data)
{
- return (ll_wr_track_id(buffer, count, data, VFS_TRACK_GID));
+ return (ll_wr_track_id(buffer, count, data, STATS_TRACK_GID));
+}
+
+static int ll_rd_statahead_max(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct super_block *sb = data;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+ return snprintf(page, count, "%u\n", sbi->ll_sa_max);
+}
+
+static int ll_wr_statahead_max(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct super_block *sb = data;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val >= 0 && val <= LL_SA_RPC_MAX)
+ sbi->ll_sa_max = val;
+ else
+ CERROR("Bad statahead_max value %d. Valid values are in the "
+ "range [0, %d]\n", val, LL_SA_RPC_MAX);
+
+ return count;
+}
+
+static int ll_rd_statahead_stats(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct super_block *sb = data;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+ return snprintf(page, count,
+ "statahead wrong: %u\n"
+ "statahead total: %u\n"
+ "ls blocked: %llu\n"
+ "ls cached: %llu\n"
+ "hit count: %llu\n"
+ "miss count: %llu\n",
+ sbi->ll_sa_wrong,
+ sbi->ll_sa_total,
+ sbi->ll_sa_blocked,
+ sbi->ll_sa_cached,
+ sbi->ll_sa_hit,
+ sbi->ll_sa_miss);
+}
+
+static int ll_rd_contention_time(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct super_block *sb = data;
+
+ *eof = 1;
+ return snprintf(page, count, "%u\n", ll_s2sbi(sb)->ll_contention_time);
+
+}
+
+static int ll_wr_contention_time(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct super_block *sb = data;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+ return lprocfs_write_helper(buffer, count,&sbi->ll_contention_time) ?:
+ count;
+}
+
+static int ll_rd_lockless_truncate(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct super_block *sb = data;
+
+ *eof = 1;
+ return snprintf(page, count, "%u\n",
+ ll_s2sbi(sb)->ll_lockless_truncate_enable);
}
-static struct lprocfs_vars lprocfs_obd_vars[] = {
+static int ll_wr_lockless_truncate(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct super_block *sb = data;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+ return lprocfs_write_helper(buffer, count,
+ &sbi->ll_lockless_truncate_enable)
+ ?: count;
+}
+
+static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
{ "uuid", ll_rd_sb_uuid, 0, 0 },
//{ "mntpt_path", ll_rd_path, 0, 0 },
{ "fstype", ll_rd_fstype, 0, 0 },
{ "kbytesavail", ll_rd_kbytesavail, 0, 0 },
{ "filestotal", ll_rd_filestotal, 0, 0 },
{ "filesfree", ll_rd_filesfree, 0, 0 },
+ { "client_type", ll_rd_client_type, 0, 0 },
//{ "filegroups", lprocfs_rd_filegroups, 0, 0 },
{ "max_read_ahead_mb", ll_rd_max_readahead_mb,
ll_wr_max_readahead_mb, 0 },
{ "max_read_ahead_whole_mb", ll_rd_max_read_ahead_whole_mb,
ll_wr_max_read_ahead_whole_mb, 0 },
- { "max_cached_mb", ll_rd_max_cached_mb, ll_wr_max_cached_mb, 0 },
- { "checksum_pages", ll_rd_checksum, ll_wr_checksum, 0 },
- { "max_rw_chunk", ll_rd_max_rw_chunk, ll_wr_max_rw_chunk, 0 },
- { "vfs_track_pid", ll_rd_track_pid, ll_wr_track_pid, 0 },
- { "vfs_track_ppid", ll_rd_track_ppid, ll_wr_track_ppid, 0 },
- { "vfs_track_gid", ll_rd_track_gid, ll_wr_track_gid, 0 },
+ { "max_cached_mb", ll_rd_max_cached_mb, ll_wr_max_cached_mb, 0 },
+ { "checksum_pages", ll_rd_checksum, ll_wr_checksum, 0 },
+ { "max_rw_chunk", ll_rd_max_rw_chunk, ll_wr_max_rw_chunk, 0 },
+ { "stats_track_pid", ll_rd_track_pid, ll_wr_track_pid, 0 },
+ { "stats_track_ppid", ll_rd_track_ppid, ll_wr_track_ppid, 0 },
+ { "stats_track_gid", ll_rd_track_gid, ll_wr_track_gid, 0 },
+ { "statahead_max", ll_rd_statahead_max, ll_wr_statahead_max, 0 },
+ { "statahead_stats", ll_rd_statahead_stats, 0, 0 },
+ { "contention_seconds", ll_rd_contention_time, ll_wr_contention_time, 0},
+ { "lockless_truncate", ll_rd_lockless_truncate,
+ ll_wr_lockless_truncate, 0},
{ 0 }
};
{ LPROC_LL_FSYNC, LPROCFS_TYPE_REGS, "fsync" },
/* inode operation */
{ LPROC_LL_SETATTR, LPROCFS_TYPE_REGS, "setattr" },
- { LPROC_LL_TRUNC, LPROCFS_TYPE_REGS, "punch" },
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+ { LPROC_LL_TRUNC, LPROCFS_TYPE_REGS, "truncate" },
+ { LPROC_LL_LOCKLESS_TRUNC, LPROCFS_TYPE_REGS, "lockless_truncate"},
+ { LPROC_LL_FLOCK, LPROCFS_TYPE_REGS, "flock" },
{ LPROC_LL_GETATTR, LPROCFS_TYPE_REGS, "getattr" },
-#else
- { LPROC_LL_REVALIDATE, LPROCFS_TYPE_REGS, "getattr" },
-#endif
/* special inode operation */
{ LPROC_LL_STAFS, LPROCFS_TYPE_REGS, "statfs" },
{ LPROC_LL_ALLOC_INODE, LPROCFS_TYPE_REGS, "alloc_inode" },
{ LPROC_LL_SETXATTR, LPROCFS_TYPE_REGS, "setxattr" },
{ LPROC_LL_GETXATTR, LPROCFS_TYPE_REGS, "getxattr" },
+ { LPROC_LL_LISTXATTR, LPROCFS_TYPE_REGS, "listxattr" },
+ { LPROC_LL_REMOVEXATTR, LPROCFS_TYPE_REGS, "removexattr" },
+ { LPROC_LL_INODE_PERM, LPROCFS_TYPE_REGS, "inode_permission" },
{ LPROC_LL_DIRECT_READ, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_PAGES,
"direct_read" },
{ LPROC_LL_DIRECT_WRITE, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_PAGES,
"direct_write" },
+ { LPROC_LL_LOCKLESS_READ, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES,
+ "lockless_read_bytes" },
+ { LPROC_LL_LOCKLESS_WRITE, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES,
+ "lockless_write_bytes" },
};
-void ll_vfs_ops_tally(struct ll_sb_info *sbi, int op)
+void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count)
{
- if (sbi->ll_vfs_ops_stats && sbi->ll_vfs_track_type == VFS_TRACK_ALL)
- lprocfs_counter_incr(sbi->ll_vfs_ops_stats, op);
- else if (sbi->ll_vfs_track_type == VFS_TRACK_PID &&
- sbi->ll_vfs_track_id == current->pid)
- lprocfs_counter_incr(sbi->ll_vfs_ops_stats, op);
- else if (sbi->ll_vfs_track_type == VFS_TRACK_PPID &&
- sbi->ll_vfs_track_id == current->p_pptr->pid)
- lprocfs_counter_incr(sbi->ll_vfs_ops_stats, op);
- else if (sbi->ll_vfs_track_type == VFS_TRACK_GID &&
- sbi->ll_vfs_track_id == current->gid)
- lprocfs_counter_incr(sbi->ll_vfs_ops_stats, op);
+ if (!sbi->ll_stats)
+ return;
+ if (sbi->ll_stats_track_type == STATS_TRACK_ALL)
+ lprocfs_counter_add(sbi->ll_stats, op, count);
+ else if (sbi->ll_stats_track_type == STATS_TRACK_PID &&
+ sbi->ll_stats_track_id == current->pid)
+ lprocfs_counter_add(sbi->ll_stats, op, count);
+ else if (sbi->ll_stats_track_type == STATS_TRACK_PPID &&
+ sbi->ll_stats_track_id == current->p_pptr->pid)
+ lprocfs_counter_add(sbi->ll_stats, op, count);
+ else if (sbi->ll_stats_track_type == STATS_TRACK_GID &&
+ sbi->ll_stats_track_id == current->gid)
+ lprocfs_counter_add(sbi->ll_stats, op, count);
}
+EXPORT_SYMBOL(ll_stats_ops_tally);
int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
struct super_block *sb, char *osc, char *mdc)
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_device *obd;
char name[MAX_STRING_SIZE + 1], *ptr;
- int err, id, len;
- struct lprocfs_stats *vfs_ops_stats = NULL;
- struct proc_dir_entry *entry;
+ int err, id, len, rc;
ENTRY;
memset(lvars, 0, sizeof(lvars));
RETURN(err);
}
- entry = create_proc_entry("dump_page_cache", 0444, sbi->ll_proc_root);
- if (entry == NULL)
- GOTO(out, err = -ENOMEM);
- entry->proc_fops = &llite_dump_pgcache_fops;
- entry->data = sbi;
- entry = create_proc_entry("read_ahead_stats", 0644, sbi->ll_proc_root);
- if (entry == NULL)
- GOTO(out, err = -ENOMEM);
- entry->proc_fops = &ll_ra_stats_fops;
- entry->data = sbi;
-
- entry = create_proc_entry("extents_stats", 0644, sbi->ll_proc_root);
- if (entry == NULL)
- GOTO(out, err = -ENOMEM);
- entry->proc_fops = &ll_rw_extents_stats_fops;
- entry->data = sbi;
-
- entry = create_proc_entry("extents_stats_per_process", 0644,
- sbi->ll_proc_root);
- if (entry == NULL)
- GOTO(out, err = -ENOMEM);
- entry->proc_fops = &ll_rw_extents_stats_pp_fops;
- entry->data = sbi;
-
- entry = create_proc_entry("offset_stats", 0644, sbi->ll_proc_root);
- if (entry == NULL)
- GOTO(out, err = -ENOMEM);
- entry->proc_fops = &ll_rw_offset_stats_fops;
- entry->data = sbi;
+ rc = lprocfs_seq_create(sbi->ll_proc_root, "dump_page_cache", 0444,
+ &llite_dump_pgcache_fops, sbi);
+ if (rc)
+ CWARN("Error adding the dump_page_cache file\n");
+
+ rc = lprocfs_seq_create(sbi->ll_proc_root, "read_ahead_stats", 0644,
+ &ll_ra_stats_fops, sbi);
+ if (rc)
+ CWARN("Error adding the read_ahead_stats file\n");
+
+ rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats", 0644,
+ &ll_rw_extents_stats_fops, sbi);
+ if (rc)
+ CWARN("Error adding the extent_stats file\n");
+
+ rc = lprocfs_seq_create(sbi->ll_proc_root, "extents_stats_per_process",
+ 0644, &ll_rw_extents_stats_pp_fops, sbi);
+ if (rc)
+ CWARN("Error adding the extents_stats_per_process file\n");
+
+ rc = lprocfs_seq_create(sbi->ll_proc_root, "offset_stats", 0644,
+ &ll_rw_offset_stats_fops, sbi);
+ if (rc)
+ CWARN("Error adding the offset_stats file\n");
/* File operations stats */
- sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES);
+ sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
+ LPROCFS_STATS_FLAG_PERCPU);
if (sbi->ll_stats == NULL)
GOTO(out, err = -ENOMEM);
/* do counter init */
void *ptr = NULL;
if (type & LPROCFS_TYPE_REGS)
ptr = "regs";
- else {
- if (type & LPROCFS_TYPE_BYTES)
- ptr = "bytes";
- else {
- if (type & LPROCFS_TYPE_PAGES)
- ptr = "pages";
- }
- }
- lprocfs_counter_init(sbi->ll_stats,
+ else if (type & LPROCFS_TYPE_BYTES)
+ ptr = "bytes";
+ else if (type & LPROCFS_TYPE_PAGES)
+ ptr = "pages";
+ lprocfs_counter_init(sbi->ll_stats,
llite_opcode_table[id].opcode,
(type & LPROCFS_CNTR_AVGMINMAX),
llite_opcode_table[id].opname, ptr);
if (err)
GOTO(out, err);
- /* VFS operations stats */
- vfs_ops_stats = sbi->ll_vfs_ops_stats =
- lprocfs_alloc_stats(VFS_OPS_LAST);
- if (vfs_ops_stats == NULL)
- GOTO(out, err = -ENOMEM);
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_READ, 0, "read", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_WRITE, 0, "write", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_IOCTL, 0, "ioctl", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_OPEN, 0, "open", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_RELEASE, 0, "release",
- "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_MMAP, 0, "mmap", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_SEEK, 0, "seek", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_FSYNC, 0, "fsync", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_FLOCK, 0, "flock", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_SETATTR, 0, "setattr",
- "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_GETATTR, 0, "getattr",
- "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_SETXATTR, 0, "setxattr",
- "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_GETXATTR, 0, "getxattr",
- "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_LISTXATTR, 0, "listxattr",
- "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_REMOVEXATTR, 0,
- "removexattr", "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_TRUNCATE, 0, "truncate",
- "reqs");
- lprocfs_counter_init(vfs_ops_stats, VFS_OPS_INODE_PERMISSION, 0,
- "inode permission", "reqs");
-
- err = lprocfs_register_stats(sbi->ll_proc_root, "vfs_ops_stats",
- vfs_ops_stats);
- if (err)
- GOTO(out, err);
-
- /* Static configuration info */
- err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_obd_vars, sb);
+ err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb);
if (err)
GOTO(out, err);
if (err) {
lprocfs_remove(&sbi->ll_proc_root);
lprocfs_free_stats(&sbi->ll_stats);
- lprocfs_free_stats(&sbi->ll_vfs_ops_stats);
}
RETURN(err);
}
if (sbi->ll_proc_root) {
lprocfs_remove(&sbi->ll_proc_root);
lprocfs_free_stats(&sbi->ll_stats);
- lprocfs_free_stats(&sbi->ll_vfs_ops_stats);
}
}
#undef MAX_STRING_SIZE
/* 2.4 doesn't seem to have SEQ_START_TOKEN, so we implement
* it in our own state */
if (dummy_llap->llap_magic == 0) {
- seq_printf(seq, "gener | llap cookie origin wq du | page "
+ seq_printf(seq, "gener | llap cookie origin wq du wb | page "
"inode index count [ page flags ]\n");
return 0;
}
LASSERTF(llap->llap_origin < LLAP__ORIGIN_MAX, "%u\n",
llap->llap_origin);
- seq_printf(seq, "%5lu | %p %p %s %s %s | %p %p %lu %u [",
+ seq_printf(seq," %5lu | %p %p %s %s %s %s | %p %lu/%u(%p) "
+ "%lu %u [",
sbi->ll_pglist_gen,
llap, llap->llap_cookie,
llap_origins[llap->llap_origin],
llap->llap_write_queued ? "wq" : "- ",
llap->llap_defer_uptodate ? "du" : "- ",
- page, page->mapping->host, page->index,
+ PageWriteback(page) ? "wb" : "-",
+ page, page->mapping->host->i_ino,
+ page->mapping->host->i_generation,
+ page->mapping->host, page->index,
page_count(page));
seq_page_flag(seq, page, locked, has_flags);
seq_page_flag(seq, page, error, has_flags);
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12))
seq_page_flag(seq, page, highmem, has_flags);
#endif
+ seq_page_flag(seq, page, writeback, has_flags);
if (!has_flags)
seq_puts(seq, "-]\n");
- else
+ else
seq_puts(seq, "]\n");
}
LPROCFS_ENTRY_AND_CHECK(dp);
- OBD_ALLOC_GFP(dummy_llap, sizeof(*dummy_llap), GFP_KERNEL);
+ OBD_ALLOC_PTR_WAIT(dummy_llap);
if (dummy_llap == NULL)
GOTO(out, rc);
-
dummy_llap->llap_page = NULL;
dummy_llap->llap_cookie = sbi;
dummy_llap->llap_magic = 0;
do_gettimeofday(&now);
+ if (!sbi->ll_rw_stats_on) {
+ seq_printf(seq, "Disabled\n"
+ "Write anything in this file to activate\n");
+ return 0;
+ }
seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
now.tv_sec, now.tv_usec);
seq_printf(seq, "%15s %19s | %20s\n", " ", "read", "write");
seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
"extents", "calls", "%", "cum%",
"calls", "%", "cum%");
-
- spin_lock(&sbi->ll_lock);
+ spin_lock(&sbi->ll_pp_extent_lock);
for(k = 0; k < LL_PROCESS_HIST_MAX; k++) {
if(io_extents->pp_extents[k].pid != 0) {
seq_printf(seq, "\nPID: %d\n",
ll_display_extents_info(io_extents, seq, k);
}
}
- spin_unlock(&sbi->ll_lock);
-
+ spin_unlock(&sbi->ll_pp_extent_lock);
return 0;
}
struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
int i;
- spin_lock(&sbi->ll_lock);
+ sbi->ll_rw_stats_on = 1;
+ spin_lock(&sbi->ll_pp_extent_lock);
for(i = 0; i < LL_PROCESS_HIST_MAX; i++) {
io_extents->pp_extents[i].pid = 0;
lprocfs_oh_clear(&io_extents->pp_extents[i].pp_r_hist);
lprocfs_oh_clear(&io_extents->pp_extents[i].pp_w_hist);
}
- spin_unlock(&sbi->ll_lock);
+ spin_unlock(&sbi->ll_pp_extent_lock);
return len;
}
do_gettimeofday(&now);
+ if (!sbi->ll_rw_stats_on) {
+ seq_printf(seq, "Disabled\n"
+ "Write anything in this file to activate\n");
+ return 0;
+ }
seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
now.tv_sec, now.tv_usec);
seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
"extents", "calls", "%", "cum%",
"calls", "%", "cum%");
-
spin_lock(&sbi->ll_lock);
ll_display_extents_info(io_extents, seq, LL_PROCESS_HIST_MAX);
spin_unlock(&sbi->ll_lock);
struct seq_file *seq = file->private_data;
struct ll_sb_info *sbi = seq->private;
struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
+ int i;
- lprocfs_oh_clear(&io_extents->pp_extents[LL_PROCESS_HIST_MAX].pp_r_hist);
- lprocfs_oh_clear(&io_extents->pp_extents[LL_PROCESS_HIST_MAX].pp_w_hist);
+ sbi->ll_rw_stats_on = 1;
+ spin_lock(&sbi->ll_pp_extent_lock);
+ for(i = 0; i <= LL_PROCESS_HIST_MAX; i++)
+ {
+ io_extents->pp_extents[i].pid = 0;
+ lprocfs_oh_clear(&io_extents->pp_extents[i].pp_r_hist);
+ lprocfs_oh_clear(&io_extents->pp_extents[i].pp_w_hist);
+ }
+ spin_unlock(&sbi->ll_pp_extent_lock);
return len;
}
int *process_count = &sbi->ll_offset_process_count;
struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info;
+ if(!sbi->ll_rw_stats_on)
+ return;
process = sbi->ll_rw_process_info;
offset = sbi->ll_rw_offset_info;
- spin_lock(&sbi->ll_lock);
+ spin_lock(&sbi->ll_pp_extent_lock);
/* Extent statistics */
for(i = 0; i < LL_PROCESS_HIST_MAX; i++) {
if(io_extents->pp_extents[i].pid == pid) {
io_extents->pp_extents[cur].pp_w_hist.oh_buckets[i]++;
io_extents->pp_extents[LL_PROCESS_HIST_MAX].pp_w_hist.oh_buckets[i]++;
}
+ spin_unlock(&sbi->ll_pp_extent_lock);
+ spin_lock(&sbi->ll_process_lock);
/* Offset statistics */
for (i = 0; i < LL_PROCESS_HIST_MAX; i++) {
if (process[i].rw_pid == pid) {
process[i].rw_largest_extent = count;
process[i].rw_offset = 0;
process[i].rw_last_file = file;
- spin_unlock(&sbi->ll_lock);
+ spin_unlock(&sbi->ll_process_lock);
return;
}
if (process[i].rw_last_file_pos != file->f_pos) {
if(process[i].rw_largest_extent < count)
process[i].rw_largest_extent = count;
process[i].rw_last_file_pos = file->f_pos + count;
- spin_unlock(&sbi->ll_lock);
+ spin_unlock(&sbi->ll_process_lock);
return;
}
}
process[*process_count].rw_largest_extent = count;
process[*process_count].rw_offset = 0;
process[*process_count].rw_last_file = file;
- spin_unlock(&sbi->ll_lock);
+ spin_unlock(&sbi->ll_process_lock);
}
char lpszt[] = LPSZ;
do_gettimeofday(&now);
- spin_lock(&sbi->ll_lock);
+ if (!sbi->ll_rw_stats_on) {
+ seq_printf(seq, "Disabled\n"
+ "Write anything in this file to activate\n");
+ return 0;
+ }
+ spin_lock(&sbi->ll_process_lock);
seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
now.tv_sec, now.tv_usec);
seq_printf(seq, "%3s %10s %14s %14s %17s %17s %14s\n",
"R/W", "PID", "RANGE START", "RANGE END",
"SMALLEST EXTENT", "LARGEST EXTENT", "OFFSET");
- sprintf(format, "%s%s%s%s%s\n",
+ sprintf(format, "%s%s%s%s%s\n",
"%3c %10d %14Lu %14Lu %17", lpszt+1, " %17", lpszt+1, " %14Ld");
/* We stored the discontiguous offsets here; print them first */
for(i = 0; i < LL_OFFSET_HIST_MAX; i++) {
process[i].rw_largest_extent,
process[i].rw_offset);
}
- spin_unlock(&sbi->ll_lock);
+ spin_unlock(&sbi->ll_process_lock);
return 0;
}
struct ll_rw_process_info *process_info = sbi->ll_rw_process_info;
struct ll_rw_process_info *offset_info = sbi->ll_rw_offset_info;
- spin_lock(&sbi->ll_lock);
+ sbi->ll_rw_stats_on = 1;
+
+ spin_lock(&sbi->ll_process_lock);
sbi->ll_offset_process_count = 0;
sbi->ll_rw_offset_entry_count = 0;
memset(process_info, 0, sizeof(struct ll_rw_process_info) *
LL_PROCESS_HIST_MAX);
memset(offset_info, 0, sizeof(struct ll_rw_process_info) *
LL_OFFSET_HIST_MAX);
- spin_unlock(&sbi->ll_lock);
+ spin_unlock(&sbi->ll_process_lock);
return len;
}
LPROC_SEQ_FOPS(ll_rw_offset_stats);
-LPROCFS_INIT_VARS(llite, NULL, lprocfs_obd_vars)
+void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
+{
+ lvars->module_vars = NULL;
+ lvars->obd_vars = lprocfs_llite_obd_vars;
+}
#endif /* LPROCFS */