aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.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/direct.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/direct.c')
-rw-r--r--fs/nfs/direct.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 4e9b3a1b36c5..fc07ce4885da 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -54,6 +54,8 @@
54#include <asm/uaccess.h> 54#include <asm/uaccess.h>
55#include <asm/atomic.h> 55#include <asm/atomic.h>
56 56
57#include "iostat.h"
58
57#define NFSDBG_FACILITY NFSDBG_VFS 59#define NFSDBG_FACILITY NFSDBG_VFS
58#define MAX_DIRECTIO_SIZE (4096UL << PAGE_SHIFT) 60#define MAX_DIRECTIO_SIZE (4096UL << PAGE_SHIFT)
59 61
@@ -67,6 +69,7 @@ struct nfs_direct_req {
67 struct kref kref; /* release manager */ 69 struct kref kref; /* release manager */
68 struct list_head list; /* nfs_read_data structs */ 70 struct list_head list; /* nfs_read_data structs */
69 wait_queue_head_t wait; /* wait for i/o completion */ 71 wait_queue_head_t wait; /* wait for i/o completion */
72 struct inode * inode; /* target file of I/O */
70 struct page ** pages; /* pages in our buffer */ 73 struct page ** pages; /* pages in our buffer */
71 unsigned int npages; /* count of pages */ 74 unsigned int npages; /* count of pages */
72 atomic_t complete, /* i/os we're waiting for */ 75 atomic_t complete, /* i/os we're waiting for */
@@ -357,7 +360,9 @@ static ssize_t nfs_direct_read_seg(struct inode *inode,
357 360
358 dreq->pages = pages; 361 dreq->pages = pages;
359 dreq->npages = nr_pages; 362 dreq->npages = nr_pages;
363 dreq->inode = inode;
360 364
365 nfs_add_stats(inode, NFSIOS_DIRECTREADBYTES, count);
361 rpc_clnt_sigmask(clnt, &oldset); 366 rpc_clnt_sigmask(clnt, &oldset);
362 nfs_direct_read_schedule(dreq, inode, ctx, user_addr, count, 367 nfs_direct_read_schedule(dreq, inode, ctx, user_addr, count,
363 file_offset); 368 file_offset);
@@ -572,6 +577,7 @@ static ssize_t nfs_direct_write(struct inode *inode,
572 return page_count; 577 return page_count;
573 } 578 }
574 579
580 nfs_add_stats(inode, NFSIOS_DIRECTWRITTENBYTES, size);
575 result = nfs_direct_write_seg(inode, ctx, user_addr, size, 581 result = nfs_direct_write_seg(inode, ctx, user_addr, size,
576 file_offset, pages, page_count); 582 file_offset, pages, page_count);
577 nfs_free_user_pages(pages, page_count, 0); 583 nfs_free_user_pages(pages, page_count, 0);
@@ -581,6 +587,7 @@ static ssize_t nfs_direct_write(struct inode *inode,
581 break; 587 break;
582 return result; 588 return result;
583 } 589 }
590 nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, result);
584 tot_bytes += result; 591 tot_bytes += result;
585 file_offset += result; 592 file_offset += result;
586 if (result < size) 593 if (result < size)