Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
fs/xfs/linux-2.6/xfs_stats.c | 53 +++++++++++++-------------
fs/xfs/quota/xfs_qm_stats.c | 86 +++++++++++++++++++++----------------------
2 files changed, 69 insertions(+), 70 deletions(-)
--- a/fs/xfs/linux-2.6/xfs_stats.c
+++ b/fs/xfs/linux-2.6/xfs_stats.c
@@ -21,15 +21,11 @@
DEFINE_PER_CPU(struct xfsstats, xfsstats);
STATIC int
-xfs_read_xfsstats(
- char *buffer,
- char **start,
- off_t offset,
- int count,
- int *eof,
- void *data)
+xfs_stat_proc_show(
+ struct seq_file *m,
+ void *v)
{
- int c, i, j, len, val;
+ int c, i, j, val;
__uint64_t xs_xstrat_bytes = 0;
__uint64_t xs_write_bytes = 0;
__uint64_t xs_read_bytes = 0;
@@ -56,18 +52,18 @@ xfs_read_xfsstats(
};
/* Loop over all stats groups */
- for (i=j=len = 0; i < ARRAY_SIZE(xstats); i++) {
- len += sprintf(buffer + len, xstats[i].desc);
+ for (i=j = 0; i < ARRAY_SIZE(xstats); i++) {
+ seq_puts(m, xstats[i].desc);
/* inner loop does each group */
while (j < xstats[i].endpoint) {
val = 0;
/* sum over all cpus */
for_each_possible_cpu(c)
val += *(((__u32*)&per_cpu(xfsstats, c) + j));
- len += sprintf(buffer + len, " %u", val);
+ seq_printf(m, " %u", val);
j++;
}
- buffer[len++] = '\n';
+ seq_putc(m, '\n');
}
/* extra precision counters */
for_each_possible_cpu(i) {
@@ -76,34 +72,39 @@ xfs_read_xfsstats(
xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes;
}
- len += sprintf(buffer + len, "xpc %Lu %Lu %Lu\n",
+ seq_printf(m, "xpc %Lu %Lu %Lu\n",
xs_xstrat_bytes, xs_write_bytes, xs_read_bytes);
- len += sprintf(buffer + len, "debug %u\n",
+ seq_printf(m, "debug %u\n",
#if defined(DEBUG)
1);
#else
0);
#endif
+ return 0;
+}
- if (offset >= len) {
- *start = buffer;
- *eof = 1;
- return 0;
- }
- *start = buffer + offset;
- if ((len -= offset) > count)
- return count;
- *eof = 1;
-
- return len;
+STATIC int
+xfs_stat_proc_open(
+ struct inode *inode,
+ struct file *file)
+{
+ return single_open(file, xfs_stat_proc_show, NULL);
}
+static const struct file_operations xfs_stat_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = xfs_stat_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
void
xfs_init_procfs(void)
{
if (!proc_mkdir("fs/xfs", NULL))
return;
- create_proc_read_entry("fs/xfs/stat", 0, NULL, xfs_read_xfsstats, NULL);
+ proc_create("fs/xfs/stat", 0, NULL, &xfs_stat_proc_fops);
}
void
--- a/fs/xfs/quota/xfs_qm_stats.c
+++ b/fs/xfs/quota/xfs_qm_stats.c
@@ -50,49 +50,42 @@
struct xqmstats xqmstats;
STATIC int
-xfs_qm_read_xfsquota(
- char *buffer,
- char **start,
- off_t offset,
- int count,
- int *eof,
- void *data)
+xfs_xqm_proc_show(
+ struct seq_file *m,
+ void *v)
{
- int len;
-
/* maximum; incore; ratio free to inuse; freelist */
- len = sprintf(buffer, "%d\t%d\t%d\t%u\n",
+ seq_printf(m, "%d\t%d\t%d\t%u\n",
ndquot,
xfs_Gqm? atomic_read(&xfs_Gqm->qm_totaldquots) : 0,
xfs_Gqm? xfs_Gqm->qm_dqfree_ratio : 0,
xfs_Gqm? xfs_Gqm->qm_dqfreelist.qh_nelems : 0);
-
- if (offset >= len) {
- *start = buffer;
- *eof = 1;
- return 0;
- }
- *start = buffer + offset;
- if ((len -= offset) > count)
- return count;
- *eof = 1;
-
- return len;
+ return 0;
}
STATIC int
-xfs_qm_read_stats(
- char *buffer,
- char **start,
- off_t offset,
- int count,
- int *eof,
- void *data)
+xfs_xqm_proc_open(
+ struct inode *inode,
+ struct file *file)
{
- int len;
+ return single_open(file, xfs_xqm_proc_show, NULL);
+}
+
+static const struct file_operations xfs_xqm_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = xfs_xqm_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+STATIC int
+xfs_xqmstat_proc_show(
+ struct seq_file *m,
+ void *v)
+{
/* quota performance statistics */
- len = sprintf(buffer, "qm %u %u %u %u %u %u %u %u\n",
+ seq_printf(m, "qm %u %u %u %u %u %u %u %u\n",
xqmstats.xs_qm_dqreclaims,
xqmstats.xs_qm_dqreclaim_misses,
xqmstats.xs_qm_dquot_dups,
@@ -101,25 +94,30 @@ xfs_qm_read_stats(
xqmstats.xs_qm_dqwants,
xqmstats.xs_qm_dqshake_reclaims,
xqmstats.xs_qm_dqinact_reclaims);
+ return 0;
+}
- if (offset >= len) {
- *start = buffer;
- *eof = 1;
- return 0;
- }
- *start = buffer + offset;
- if ((len -= offset) > count)
- return count;
- *eof = 1;
-
- return len;
+STATIC int
+xfs_xqmstat_proc_open(
+ struct inode *inode,
+ struct file *file)
+{
+ return single_open(file, xfs_xqmstat_proc_show, NULL);
}
+static const struct file_operations xfs_xqmstat_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = xfs_xqmstat_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
void
xfs_qm_init_procfs(void)
{
- create_proc_read_entry("fs/xfs/xqmstat", 0, NULL, xfs_qm_read_stats, NULL);
- create_proc_read_entry("fs/xfs/xqm", 0, NULL, xfs_qm_read_xfsquota, NULL);
+ proc_create("fs/xfs/xqmstat", 0, NULL, &xfs_xqmstat_proc_fops);
+ proc_create("fs/xfs/xqm", 0, NULL, &xfs_xqm_proc_fops);
}
void
--
1.5.3.7
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Parag Warudkar | Re: soft lockup - CPU#1 stuck for 15s! [swapper:0] |
| Bryan Woods | Stardom SATA HSM violation |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Steven Rostedt | [PATCH 2/2] ftrace: support for PowerPC |
git: | |
| Abdelrazak Younes | Git-windows and git-svn? |
| Linus Torvalds | Re: On Tabs and Spaces |
| Shawn O. Pearce | Java Git (aka jgit) library switching license to BSD/EPL |
| Manu | Re: fatal: unable to create '.git/index': File exists |
| Brandon Lee | DELL PERC 5iR slow performance |
| Chris Jones | GRE over IPsec |
| Frank Bax | wine question |
| Jona Joachim | X11 very slow with SMP kernel |
| Jon Anhold | rawrite |
| Mark Tarrabain | Some thoughts on device drivers |
| Rik Faith | ATI VGA WONDER driver for x386 |
| Seng-Poh Lee, Speedy | Slight rlogind problem, 'Unable to determine your tty name' |
| SMDK2410 LCD Framebuffer driver | 3 hours ago | Linux kernel |
| Resetting the bios password for Toshiba Laptop | 4 hours ago | Hardware |
| Problem booting a barebone kernel in VMWare | 7 hours ago | Linux kernel |
| IP layer send packet | 11 hours ago | Linux kernel |
| PID to ELF image full path | 13 hours ago | Linux kernel |
| types of kernel | 1 day ago | Linux kernel |
| magical mounts | 2 days ago | Linux kernel |
| Problem in scim in Fedora 9 | 2 days ago | Linux general |
| The new Western Digital power saving drives | 2 days ago | Hardware |
| Battery Maximizer Software | 3 days ago | Linux kernel |
