aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2006-03-20 13:44:14 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:14 -0500
commit91d5b47023b608227d605d1e916b29dd0215bff7 (patch)
tree31dbb285639ea68db3abc0c4129988f02d50f11a /fs/nfs/read.c
parentd9ef5a8c26aab09762afce43df64736720b4860e (diff)
NFS: add I/O performance counters
Invoke the byte and event counter macros where we want to count bytes and events. Clean-up: fix a possible NULL dereference in nfs_lock, and simplify nfs_file_open. Test-plan: fsx and iozone on UP and SMP systems, with and without pre-emption. Watch for memory overwrite bugs, and performance loss (significantly more CPU required per op). Signed-off-by: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 05eb43fadf8e..ae3ddd24cf8f 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -31,6 +31,8 @@
31 31
32#include <asm/system.h> 32#include <asm/system.h>
33 33
34#include "iostat.h"
35
34#define NFSDBG_FACILITY NFSDBG_PAGECACHE 36#define NFSDBG_FACILITY NFSDBG_PAGECACHE
35 37
36static int nfs_pagein_one(struct list_head *, struct inode *); 38static int nfs_pagein_one(struct list_head *, struct inode *);
@@ -133,6 +135,8 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode,
133 } 135 }
134 count -= result; 136 count -= result;
135 rdata->args.pgbase += result; 137 rdata->args.pgbase += result;
138 nfs_add_stats(inode, NFSIOS_SERVERREADBYTES, result);
139
136 /* Note: result == 0 should only happen if we're caching 140 /* Note: result == 0 should only happen if we're caching
137 * a write that extends the file and punches a hole. 141 * a write that extends the file and punches a hole.
138 */ 142 */
@@ -458,8 +462,11 @@ void nfs_readpage_result(struct rpc_task *task, void *calldata)
458 dprintk("NFS: %4d nfs_readpage_result, (status %d)\n", 462 dprintk("NFS: %4d nfs_readpage_result, (status %d)\n",
459 task->tk_pid, status); 463 task->tk_pid, status);
460 464
465 nfs_add_stats(data->inode, NFSIOS_SERVERREADBYTES, resp->count);
466
461 /* Is this a short read? */ 467 /* Is this a short read? */
462 if (task->tk_status >= 0 && resp->count < argp->count && !resp->eof) { 468 if (task->tk_status >= 0 && resp->count < argp->count && !resp->eof) {
469 nfs_inc_stats(data->inode, NFSIOS_SHORTREAD);
463 /* Has the server at least made some progress? */ 470 /* Has the server at least made some progress? */
464 if (resp->count != 0) { 471 if (resp->count != 0) {
465 /* Yes, so retry the read at the end of the data */ 472 /* Yes, so retry the read at the end of the data */
@@ -491,6 +498,9 @@ int nfs_readpage(struct file *file, struct page *page)
491 498
492 dprintk("NFS: nfs_readpage (%p %ld@%lu)\n", 499 dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
493 page, PAGE_CACHE_SIZE, page->index); 500 page, PAGE_CACHE_SIZE, page->index);
501 nfs_inc_stats(inode, NFSIOS_VFSREADPAGE);
502 nfs_add_stats(inode, NFSIOS_READPAGES, 1);
503
494 /* 504 /*
495 * Try to flush any pending writes to the file.. 505 * Try to flush any pending writes to the file..
496 * 506 *
@@ -570,6 +580,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
570 inode->i_sb->s_id, 580 inode->i_sb->s_id,
571 (long long)NFS_FILEID(inode), 581 (long long)NFS_FILEID(inode),
572 nr_pages); 582 nr_pages);
583 nfs_inc_stats(inode, NFSIOS_VFSREADPAGES);
573 584
574 if (filp == NULL) { 585 if (filp == NULL) {
575 desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ); 586 desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
@@ -582,6 +593,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
582 if (!list_empty(&head)) { 593 if (!list_empty(&head)) {
583 int err = nfs_pagein_list(&head, server->rpages); 594 int err = nfs_pagein_list(&head, server->rpages);
584 if (!ret) 595 if (!ret)
596 nfs_add_stats(inode, NFSIOS_READPAGES, err);
585 ret = err; 597 ret = err;
586 } 598 }
587 put_nfs_open_context(desc.ctx); 599 put_nfs_open_context(desc.ctx);