aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 12:18:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 12:18:27 -0500
commit53846a21c1766326bb14ce8ab6e997a0c120675d (patch)
tree37b04485e29844b4e734479181276a2f4d2447e4 /include
parent2e9abdd9bad485970b37cd53a82f92702054984c (diff)
parent1ebbe2b20091d306453a5cf480a87e6cd28ae76f (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (103 commits) SUNRPC,RPCSEC_GSS: spkm3--fix config dependencies SUNRPC,RPCSEC_GSS: spkm3: import contexts using NID_cast5_cbc LOCKD: Make nlmsvc_traverse_shares return void LOCKD: nlmsvc_traverse_blocks return is unused SUNRPC,RPCSEC_GSS: fix krb5 sequence numbers. NFSv4: Dont list system.nfs4_acl for filesystems that don't support it. SUNRPC,RPCSEC_GSS: remove unnecessary kmalloc of a checksum SUNRPC: Ensure rpc_call_async() always calls tk_ops->rpc_release() SUNRPC: Fix memory barriers for req->rq_received NFS: Fix a race in nfs_sync_inode() NFS: Clean up nfs_flush_list() NFS: Fix a race with PG_private and nfs_release_page() NFSv4: Ensure the callback daemon flushes signals SUNRPC: Fix a 'Busy inodes' error in rpc_pipefs NFS, NLM: Allow blocking locks to respect signals NFS: Make nfs_fhget() return appropriate error values NFSv4: Fix an oops in nfs4_fill_super lockd: blocks should hold a reference to the nlm_file NFSv4: SETCLIENTID_CONFIRM should handle NFS4ERR_DELAY/NFS4ERR_RESOURCE NFSv4: Send the delegation stateid for SETATTR calls ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/lockd/lockd.h27
-rw-r--r--include/linux/lockd/share.h2
-rw-r--r--include/linux/lockd/xdr.h1
-rw-r--r--include/linux/nfs_fs.h102
-rw-r--r--include/linux/nfs_fs_i.h8
-rw-r--r--include/linux/nfs_fs_sb.h6
-rw-r--r--include/linux/nfs_xdr.h5
-rw-r--r--include/linux/sunrpc/clnt.h20
-rw-r--r--include/linux/sunrpc/gss_krb5.h2
-rw-r--r--include/linux/sunrpc/metrics.h77
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/sched.h9
-rw-r--r--include/linux/sunrpc/xprt.h13
14 files changed, 153 insertions, 128 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 21e8cf795c38..5adf32b90f36 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -678,7 +678,6 @@ extern spinlock_t files_lock;
678#define FL_POSIX 1 678#define FL_POSIX 1
679#define FL_FLOCK 2 679#define FL_FLOCK 2
680#define FL_ACCESS 8 /* not trying to lock, just looking */ 680#define FL_ACCESS 8 /* not trying to lock, just looking */
681#define FL_LOCKD 16 /* lock held by rpc.lockd */
682#define FL_LEASE 32 /* lease held on this file */ 681#define FL_LEASE 32 /* lease held on this file */
683#define FL_SLEEP 128 /* A blocking lock */ 682#define FL_SLEEP 128 /* A blocking lock */
684 683
@@ -742,8 +741,6 @@ struct file_lock {
742#define OFFT_OFFSET_MAX INT_LIMIT(off_t) 741#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
743#endif 742#endif
744 743
745extern struct list_head file_lock_list;
746
747#include <linux/fcntl.h> 744#include <linux/fcntl.h>
748 745
749extern int fcntl_getlk(struct file *, struct flock __user *); 746extern int fcntl_getlk(struct file *, struct flock __user *);
@@ -765,10 +762,9 @@ extern void locks_init_lock(struct file_lock *);
765extern void locks_copy_lock(struct file_lock *, struct file_lock *); 762extern void locks_copy_lock(struct file_lock *, struct file_lock *);
766extern void locks_remove_posix(struct file *, fl_owner_t); 763extern void locks_remove_posix(struct file *, fl_owner_t);
767extern void locks_remove_flock(struct file *); 764extern void locks_remove_flock(struct file *);
768extern struct file_lock *posix_test_lock(struct file *, struct file_lock *); 765extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *);
769extern int posix_lock_file(struct file *, struct file_lock *); 766extern int posix_lock_file(struct file *, struct file_lock *);
770extern int posix_lock_file_wait(struct file *, struct file_lock *); 767extern int posix_lock_file_wait(struct file *, struct file_lock *);
771extern void posix_block_lock(struct file_lock *, struct file_lock *);
772extern int posix_unblock_lock(struct file *, struct file_lock *); 768extern int posix_unblock_lock(struct file *, struct file_lock *);
773extern int posix_locks_deadlock(struct file_lock *, struct file_lock *); 769extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
774extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 770extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
@@ -1097,6 +1093,7 @@ struct super_operations {
1097 void (*umount_begin) (struct super_block *); 1093 void (*umount_begin) (struct super_block *);
1098 1094
1099 int (*show_options)(struct seq_file *, struct vfsmount *); 1095 int (*show_options)(struct seq_file *, struct vfsmount *);
1096 int (*show_stats)(struct seq_file *, struct vfsmount *);
1100 1097
1101 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1098 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1102 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1099 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index ef21ed296039..995f89dc8c04 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -14,6 +14,7 @@
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/kref.h>
17#include <linux/utsname.h> 18#include <linux/utsname.h>
18#include <linux/nfsd/nfsfh.h> 19#include <linux/nfsd/nfsfh.h>
19#include <linux/lockd/bind.h> 20#include <linux/lockd/bind.h>
@@ -58,6 +59,8 @@ struct nlm_host {
58 unsigned long h_expires; /* eligible for GC */ 59 unsigned long h_expires; /* eligible for GC */
59 struct list_head h_lockowners; /* Lockowners for the client */ 60 struct list_head h_lockowners; /* Lockowners for the client */
60 spinlock_t h_lock; 61 spinlock_t h_lock;
62 struct list_head h_granted; /* Locks in GRANTED state */
63 struct list_head h_reclaim; /* Locks in RECLAIM state */
61}; 64};
62 65
63/* 66/*
@@ -83,9 +86,9 @@ struct nlm_rqst {
83 struct nlm_host * a_host; /* host handle */ 86 struct nlm_host * a_host; /* host handle */
84 struct nlm_args a_args; /* arguments */ 87 struct nlm_args a_args; /* arguments */
85 struct nlm_res a_res; /* result */ 88 struct nlm_res a_res; /* result */
86 struct nlm_wait * a_block; 89 struct nlm_block * a_block;
87 unsigned int a_retries; /* Retry count */ 90 unsigned int a_retries; /* Retry count */
88 char a_owner[NLMCLNT_OHSIZE]; 91 u8 a_owner[NLMCLNT_OHSIZE];
89}; 92};
90 93
91/* 94/*
@@ -110,16 +113,16 @@ struct nlm_file {
110 */ 113 */
111#define NLM_NEVER (~(unsigned long) 0) 114#define NLM_NEVER (~(unsigned long) 0)
112struct nlm_block { 115struct nlm_block {
116 struct kref b_count; /* Reference count */
113 struct nlm_block * b_next; /* linked list (all blocks) */ 117 struct nlm_block * b_next; /* linked list (all blocks) */
114 struct nlm_block * b_fnext; /* linked list (per file) */ 118 struct nlm_block * b_fnext; /* linked list (per file) */
115 struct nlm_rqst b_call; /* RPC args & callback info */ 119 struct nlm_rqst * b_call; /* RPC args & callback info */
116 struct svc_serv * b_daemon; /* NLM service */ 120 struct svc_serv * b_daemon; /* NLM service */
117 struct nlm_host * b_host; /* host handle for RPC clnt */ 121 struct nlm_host * b_host; /* host handle for RPC clnt */
118 unsigned long b_when; /* next re-xmit */ 122 unsigned long b_when; /* next re-xmit */
119 unsigned int b_id; /* block id */ 123 unsigned int b_id; /* block id */
120 unsigned char b_queued; /* re-queued */ 124 unsigned char b_queued; /* re-queued */
121 unsigned char b_granted; /* VFS granted lock */ 125 unsigned char b_granted; /* VFS granted lock */
122 unsigned char b_incall; /* doing callback */
123 unsigned char b_done; /* callback complete */ 126 unsigned char b_done; /* callback complete */
124 struct nlm_file * b_file; /* file in question */ 127 struct nlm_file * b_file; /* file in question */
125}; 128};
@@ -145,15 +148,16 @@ extern unsigned long nlmsvc_timeout;
145/* 148/*
146 * Lockd client functions 149 * Lockd client functions
147 */ 150 */
148struct nlm_rqst * nlmclnt_alloc_call(void); 151struct nlm_rqst * nlm_alloc_call(struct nlm_host *host);
149int nlmclnt_prepare_block(struct nlm_rqst *req, struct nlm_host *host, struct file_lock *fl); 152void nlm_release_call(struct nlm_rqst *);
150void nlmclnt_finish_block(struct nlm_rqst *req); 153int nlm_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
151long nlmclnt_block(struct nlm_rqst *req, long timeout); 154int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
155struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
156void nlmclnt_finish_block(struct nlm_wait *block);
157int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
152u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 158u32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *);
153void nlmclnt_recovery(struct nlm_host *, u32); 159void nlmclnt_recovery(struct nlm_host *, u32);
154int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 160int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
155int nlmclnt_setgrantargs(struct nlm_rqst *, struct nlm_lock *);
156void nlmclnt_freegrantargs(struct nlm_rqst *);
157 161
158/* 162/*
159 * Host cache 163 * Host cache
@@ -172,7 +176,6 @@ extern struct nlm_host *nlm_find_client(void);
172/* 176/*
173 * Server-side lock handling 177 * Server-side lock handling
174 */ 178 */
175int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 179u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
177 struct nlm_lock *, int, struct nlm_cookie *); 180 struct nlm_lock *, int, struct nlm_cookie *);
178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 181u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
@@ -180,7 +183,7 @@ u32 nlmsvc_testlock(struct nlm_file *, struct nlm_lock *,
180 struct nlm_lock *); 183 struct nlm_lock *);
181u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *); 184u32 nlmsvc_cancel_blocked(struct nlm_file *, struct nlm_lock *);
182unsigned long nlmsvc_retry_blocked(void); 185unsigned long nlmsvc_retry_blocked(void);
183int nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *, 186void nlmsvc_traverse_blocks(struct nlm_host *, struct nlm_file *,
184 int action); 187 int action);
185void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32); 188void nlmsvc_grant_reply(struct svc_rqst *, struct nlm_cookie *, u32);
186 189
diff --git a/include/linux/lockd/share.h b/include/linux/lockd/share.h
index 5d8aa325f140..c75a424ebe4c 100644
--- a/include/linux/lockd/share.h
+++ b/include/linux/lockd/share.h
@@ -25,6 +25,6 @@ u32 nlmsvc_share_file(struct nlm_host *, struct nlm_file *,
25 struct nlm_args *); 25 struct nlm_args *);
26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *, 26u32 nlmsvc_unshare_file(struct nlm_host *, struct nlm_file *,
27 struct nlm_args *); 27 struct nlm_args *);
28int nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int); 28void nlmsvc_traverse_shares(struct nlm_host *, struct nlm_file *, int);
29 29
30#endif /* LINUX_LOCKD_SHARE_H */ 30#endif /* LINUX_LOCKD_SHARE_H */
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d7a5cc4cfa97..bb0a0f1caa91 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -28,6 +28,7 @@ struct nlm_lock {
28 int len; /* length of "caller" */ 28 int len; /* length of "caller" */
29 struct nfs_fh fh; 29 struct nfs_fh fh;
30 struct xdr_netobj oh; 30 struct xdr_netobj oh;
31 u32 svid;
31 struct file_lock fl; 32 struct file_lock fl;
32}; 33};
33 34
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index b4dc6e2e10c9..cbebd7d1b9e8 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -56,9 +56,7 @@
56 * When flushing a cluster of dirty pages, there can be different 56 * When flushing a cluster of dirty pages, there can be different
57 * strategies: 57 * strategies:
58 */ 58 */
59#define FLUSH_AGING 0 /* only flush old buffers */
60#define FLUSH_SYNC 1 /* file being synced, or contention */ 59#define FLUSH_SYNC 1 /* file being synced, or contention */
61#define FLUSH_WAIT 2 /* wait for completion */
62#define FLUSH_STABLE 4 /* commit to stable storage */ 60#define FLUSH_STABLE 4 /* commit to stable storage */
63#define FLUSH_LOWPRI 8 /* low priority background flush */ 61#define FLUSH_LOWPRI 8 /* low priority background flush */
64#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 62#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
@@ -78,6 +76,7 @@ struct nfs_access_entry {
78struct nfs4_state; 76struct nfs4_state;
79struct nfs_open_context { 77struct nfs_open_context {
80 atomic_t count; 78 atomic_t count;
79 struct vfsmount *vfsmnt;
81 struct dentry *dentry; 80 struct dentry *dentry;
82 struct rpc_cred *cred; 81 struct rpc_cred *cred;
83 struct nfs4_state *state; 82 struct nfs4_state *state;
@@ -118,8 +117,7 @@ struct nfs_inode {
118 unsigned long cache_validity; /* bit mask */ 117 unsigned long cache_validity; /* bit mask */
119 118
120 /* 119 /*
121 * read_cache_jiffies is when we started read-caching this inode, 120 * read_cache_jiffies is when we started read-caching this inode.
122 * and read_cache_mtime is the mtime of the inode at that time.
123 * attrtimeo is for how long the cached information is assumed 121 * attrtimeo is for how long the cached information is assumed
124 * to be valid. A successful attribute revalidation doubles 122 * to be valid. A successful attribute revalidation doubles
125 * attrtimeo (up to acregmax/acdirmax), a failure resets it to 123 * attrtimeo (up to acregmax/acdirmax), a failure resets it to
@@ -128,11 +126,6 @@ struct nfs_inode {
128 * We need to revalidate the cached attrs for this inode if 126 * We need to revalidate the cached attrs for this inode if
129 * 127 *
130 * jiffies - read_cache_jiffies > attrtimeo 128 * jiffies - read_cache_jiffies > attrtimeo
131 *
132 * and invalidate any cached data/flush out any dirty pages if
133 * we find that
134 *
135 * mtime != read_cache_mtime
136 */ 129 */
137 unsigned long read_cache_jiffies; 130 unsigned long read_cache_jiffies;
138 unsigned long attrtimeo; 131 unsigned long attrtimeo;
@@ -311,12 +304,9 @@ extern void nfs_begin_attr_update(struct inode *);
311extern void nfs_end_attr_update(struct inode *); 304extern void nfs_end_attr_update(struct inode *);
312extern void nfs_begin_data_update(struct inode *); 305extern void nfs_begin_data_update(struct inode *);
313extern void nfs_end_data_update(struct inode *); 306extern void nfs_end_data_update(struct inode *);
314extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred);
315extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 307extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
316extern void put_nfs_open_context(struct nfs_open_context *ctx); 308extern void put_nfs_open_context(struct nfs_open_context *ctx);
317extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
318extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 309extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
319extern void nfs_file_clear_open_context(struct file *filp);
320 310
321/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 311/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
322extern u32 root_nfs_parse_addr(char *name); /*__init*/ 312extern u32 root_nfs_parse_addr(char *name); /*__init*/
@@ -415,21 +405,22 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
415extern int nfs_writepages(struct address_space *, struct writeback_control *); 405extern int nfs_writepages(struct address_space *, struct writeback_control *);
416extern int nfs_flush_incompatible(struct file *file, struct page *page); 406extern int nfs_flush_incompatible(struct file *file, struct page *page);
417extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 407extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
418extern void nfs_writeback_done(struct rpc_task *task, void *data); 408extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
419extern void nfs_writedata_release(void *data); 409extern void nfs_writedata_release(void *);
420 410
421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 411#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
422extern void nfs_commit_done(struct rpc_task *, void *data); 412struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount);
423extern void nfs_commit_release(void *data); 413void nfs_commit_free(struct nfs_write_data *p);
424#endif 414#endif
425 415
426/* 416/*
427 * Try to write back everything synchronously (but check the 417 * Try to write back everything synchronously (but check the
428 * return value!) 418 * return value!)
429 */ 419 */
430extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); 420extern int nfs_sync_inode_wait(struct inode *, unsigned long, unsigned int, int);
431#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 421#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
432extern int nfs_commit_inode(struct inode *, int); 422extern int nfs_commit_inode(struct inode *, int);
423extern void nfs_commit_release(void *wdata);
433#else 424#else
434static inline int 425static inline int
435nfs_commit_inode(struct inode *inode, int how) 426nfs_commit_inode(struct inode *inode, int how)
@@ -447,7 +438,7 @@ nfs_have_writebacks(struct inode *inode)
447static inline int 438static inline int
448nfs_wb_all(struct inode *inode) 439nfs_wb_all(struct inode *inode)
449{ 440{
450 int error = nfs_sync_inode(inode, 0, 0, FLUSH_WAIT); 441 int error = nfs_sync_inode_wait(inode, 0, 0, 0);
451 return (error < 0) ? error : 0; 442 return (error < 0) ? error : 0;
452} 443}
453 444
@@ -456,8 +447,8 @@ nfs_wb_all(struct inode *inode)
456 */ 447 */
457static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how) 448static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how)
458{ 449{
459 int error = nfs_sync_inode(inode, page->index, 1, 450 int error = nfs_sync_inode_wait(inode, page->index, 1,
460 how | FLUSH_WAIT | FLUSH_STABLE); 451 how | FLUSH_STABLE);
461 return (error < 0) ? error : 0; 452 return (error < 0) ? error : 0;
462} 453}
463 454
@@ -469,37 +460,8 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page)
469/* 460/*
470 * Allocate and free nfs_write_data structures 461 * Allocate and free nfs_write_data structures
471 */ 462 */
472extern mempool_t *nfs_wdata_mempool; 463extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount);
473 464extern void nfs_writedata_free(struct nfs_write_data *p);
474static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
475{
476 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS);
477
478 if (p) {
479 memset(p, 0, sizeof(*p));
480 INIT_LIST_HEAD(&p->pages);
481 if (pagecount < NFS_PAGEVEC_SIZE)
482 p->pagevec = &p->page_array[0];
483 else {
484 size_t size = ++pagecount * sizeof(struct page *);
485 p->pagevec = kmalloc(size, GFP_NOFS);
486 if (p->pagevec) {
487 memset(p->pagevec, 0, size);
488 } else {
489 mempool_free(p, nfs_wdata_mempool);
490 p = NULL;
491 }
492 }
493 }
494 return p;
495}
496
497static inline void nfs_writedata_free(struct nfs_write_data *p)
498{
499 if (p && (p->pagevec != &p->page_array[0]))
500 kfree(p->pagevec);
501 mempool_free(p, nfs_wdata_mempool);
502}
503 465
504/* 466/*
505 * linux/fs/nfs/read.c 467 * linux/fs/nfs/read.c
@@ -507,44 +469,14 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
507extern int nfs_readpage(struct file *, struct page *); 469extern int nfs_readpage(struct file *, struct page *);
508extern int nfs_readpages(struct file *, struct address_space *, 470extern int nfs_readpages(struct file *, struct address_space *,
509 struct list_head *, unsigned); 471 struct list_head *, unsigned);
510extern void nfs_readpage_result(struct rpc_task *, void *); 472extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
511extern void nfs_readdata_release(void *data); 473extern void nfs_readdata_release(void *data);
512
513 474
514/* 475/*
515 * Allocate and free nfs_read_data structures 476 * Allocate and free nfs_read_data structures
516 */ 477 */
517extern mempool_t *nfs_rdata_mempool; 478extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount);
518 479extern void nfs_readdata_free(struct nfs_read_data *p);
519static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount)
520{
521 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
522
523 if (p) {
524 memset(p, 0, sizeof(*p));
525 INIT_LIST_HEAD(&p->pages);
526 if (pagecount < NFS_PAGEVEC_SIZE)
527 p->pagevec = &p->page_array[0];
528 else {
529 size_t size = ++pagecount * sizeof(struct page *);
530 p->pagevec = kmalloc(size, GFP_NOFS);
531 if (p->pagevec) {
532 memset(p->pagevec, 0, size);
533 } else {
534 mempool_free(p, nfs_rdata_mempool);
535 p = NULL;
536 }
537 }
538 }
539 return p;
540}
541
542static inline void nfs_readdata_free(struct nfs_read_data *p)
543{
544 if (p && (p->pagevec != &p->page_array[0]))
545 kfree(p->pagevec);
546 mempool_free(p, nfs_rdata_mempool);
547}
548 480
549/* 481/*
550 * linux/fs/nfs3proc.c 482 * linux/fs/nfs3proc.c
diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h
index e2c18dabff86..861730275ba0 100644
--- a/include/linux/nfs_fs_i.h
+++ b/include/linux/nfs_fs_i.h
@@ -12,8 +12,8 @@ struct nlm_lockowner;
12 */ 12 */
13struct nfs_lock_info { 13struct nfs_lock_info {
14 u32 state; 14 u32 state;
15 u32 flags;
16 struct nlm_lockowner *owner; 15 struct nlm_lockowner *owner;
16 struct list_head list;
17}; 17};
18 18
19struct nfs4_lock_state; 19struct nfs4_lock_state;
@@ -21,10 +21,4 @@ struct nfs4_lock_info {
21 struct nfs4_lock_state *owner; 21 struct nfs4_lock_state *owner;
22}; 22};
23 23
24/*
25 * Lock flag values
26 */
27#define NFS_LCK_GRANTED 0x0001 /* lock has been granted */
28#define NFS_LCK_RECLAIM 0x0002 /* lock marked for reclaiming */
29
30#endif 24#endif
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3d3a305488cf..65dec21af774 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -4,6 +4,8 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6 6
7struct nfs_iostats;
8
7/* 9/*
8 * NFS client parameters stored in the superblock. 10 * NFS client parameters stored in the superblock.
9 */ 11 */
@@ -12,6 +14,7 @@ struct nfs_server {
12 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */ 14 struct rpc_clnt * client_sys; /* 2nd handle for FSINFO */
13 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 15 struct rpc_clnt * client_acl; /* ACL RPC client handle */
14 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ 16 struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */
17 struct nfs_iostats * io_stats; /* I/O statistics */
15 struct backing_dev_info backing_dev_info; 18 struct backing_dev_info backing_dev_info;
16 int flags; /* various flags */ 19 int flags; /* various flags */
17 unsigned int caps; /* server capabilities */ 20 unsigned int caps; /* server capabilities */
@@ -26,10 +29,13 @@ struct nfs_server {
26 unsigned int acregmax; 29 unsigned int acregmax;
27 unsigned int acdirmin; 30 unsigned int acdirmin;
28 unsigned int acdirmax; 31 unsigned int acdirmax;
32 unsigned long retrans_timeo; /* retransmit timeout */
33 unsigned int retrans_count; /* number of retransmit tries */
29 unsigned int namelen; 34 unsigned int namelen;
30 char * hostname; /* remote hostname */ 35 char * hostname; /* remote hostname */
31 struct nfs_fh fh; 36 struct nfs_fh fh;
32 struct sockaddr_in addr; 37 struct sockaddr_in addr;
38 unsigned long mount_time; /* when this fs was mounted */
33#ifdef CONFIG_NFS_V4 39#ifdef CONFIG_NFS_V4
34 /* Our own IP address, as a null-terminated string. 40 /* Our own IP address, as a null-terminated string.
35 * This is used to generate the clientid, and the callback address. 41 * This is used to generate the clientid, and the callback address.
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6d6f69ec5675..7fafc4c546b7 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -695,7 +695,6 @@ struct nfs_read_data {
695#ifdef CONFIG_NFS_V4 695#ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */ 696 unsigned long timestamp; /* For lease renewal */
697#endif 697#endif
698 void (*complete) (struct nfs_read_data *, int);
699 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 698 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
700}; 699};
701 700
@@ -714,7 +713,6 @@ struct nfs_write_data {
714#ifdef CONFIG_NFS_V4 713#ifdef CONFIG_NFS_V4
715 unsigned long timestamp; /* For lease renewal */ 714 unsigned long timestamp; /* For lease renewal */
716#endif 715#endif
717 void (*complete) (struct nfs_write_data *, int);
718 struct page *page_array[NFS_PAGEVEC_SIZE + 1]; 716 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
719}; 717};
720 718
@@ -769,8 +767,11 @@ struct nfs_rpc_ops {
769 struct nfs_pathconf *); 767 struct nfs_pathconf *);
770 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); 768 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
771 void (*read_setup) (struct nfs_read_data *); 769 void (*read_setup) (struct nfs_read_data *);
770 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
772 void (*write_setup) (struct nfs_write_data *, int how); 771 void (*write_setup) (struct nfs_write_data *, int how);
772 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
773 void (*commit_setup) (struct nfs_write_data *, int how); 773 void (*commit_setup) (struct nfs_write_data *, int how);
774 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
774 int (*file_open) (struct inode *, struct file *); 775 int (*file_open) (struct inode *, struct file *);
775 int (*file_release) (struct inode *, struct file *); 776 int (*file_release) (struct inode *, struct file *);
776 int (*lock)(struct file *, int, struct file_lock *); 777 int (*lock)(struct file *, int, struct file_lock *);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index f147e6b84332..8fe9f35eba31 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -45,7 +45,8 @@ struct rpc_clnt {
45 char * cl_server; /* server machine name */ 45 char * cl_server; /* server machine name */
46 char * cl_protname; /* protocol name */ 46 char * cl_protname; /* protocol name */
47 struct rpc_auth * cl_auth; /* authenticator */ 47 struct rpc_auth * cl_auth; /* authenticator */
48 struct rpc_stat * cl_stats; /* statistics */ 48 struct rpc_stat * cl_stats; /* per-program statistics */
49 struct rpc_iostats * cl_metrics; /* per-client statistics */
49 50
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 51 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_intr : 1,/* interruptible */ 52 cl_intr : 1,/* interruptible */
@@ -59,6 +60,7 @@ struct rpc_clnt {
59 int cl_nodelen; /* nodename length */ 60 int cl_nodelen; /* nodename length */
60 char cl_nodename[UNX_MAXNODENAME]; 61 char cl_nodename[UNX_MAXNODENAME];
61 char cl_pathname[30];/* Path in rpc_pipe_fs */ 62 char cl_pathname[30];/* Path in rpc_pipe_fs */
63 struct vfsmount * cl_vfsmnt;
62 struct dentry * cl_dentry; /* inode */ 64 struct dentry * cl_dentry; /* inode */
63 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 65 struct rpc_clnt * cl_parent; /* Points to parent of clones */
64 struct rpc_rtt cl_rtt_default; 66 struct rpc_rtt cl_rtt_default;
@@ -100,6 +102,8 @@ struct rpc_procinfo {
100 unsigned int p_bufsiz; /* req. buffer size */ 102 unsigned int p_bufsiz; /* req. buffer size */
101 unsigned int p_count; /* call count */ 103 unsigned int p_count; /* call count */
102 unsigned int p_timer; /* Which RTT timer to use */ 104 unsigned int p_timer; /* Which RTT timer to use */
105 u32 p_statidx; /* Which procedure to account */
106 char * p_name; /* name of procedure */
103}; 107};
104 108
105#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) 109#define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt))
@@ -137,20 +141,6 @@ size_t rpc_max_payload(struct rpc_clnt *);
137void rpc_force_rebind(struct rpc_clnt *); 141void rpc_force_rebind(struct rpc_clnt *);
138int rpc_ping(struct rpc_clnt *clnt, int flags); 142int rpc_ping(struct rpc_clnt *clnt, int flags);
139 143
140static __inline__
141int rpc_call(struct rpc_clnt *clnt, u32 proc, void *argp, void *resp, int flags)
142{
143 struct rpc_message msg = {
144 .rpc_proc = &clnt->cl_procinfo[proc],
145 .rpc_argp = argp,
146 .rpc_resp = resp,
147 .rpc_cred = NULL
148 };
149 return rpc_call_sync(clnt, &msg, flags);
150}
151
152extern void rpciod_wake_up(void);
153
154/* 144/*
155 * Helper function for NFSroot support 145 * Helper function for NFSroot support
156 */ 146 */
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index 2c3601d31045..1279280d7196 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -53,6 +53,8 @@ struct krb5_ctx {
53 struct xdr_netobj mech_used; 53 struct xdr_netobj mech_used;
54}; 54};
55 55
56extern spinlock_t krb5_seq_lock;
57
56#define KG_TOK_MIC_MSG 0x0101 58#define KG_TOK_MIC_MSG 0x0101
57#define KG_TOK_WRAP_MSG 0x0201 59#define KG_TOK_WRAP_MSG 0x0201
58 60
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
new file mode 100644
index 000000000000..8f96e9dc369a
--- /dev/null
+++ b/include/linux/sunrpc/metrics.h
@@ -0,0 +1,77 @@
1/*
2 * linux/include/linux/sunrpc/metrics.h
3 *
4 * Declarations for RPC client per-operation metrics
5 *
6 * Copyright (C) 2005 Chuck Lever <cel@netapp.com>
7 *
8 * RPC client per-operation statistics provide latency and retry
9 * information about each type of RPC procedure in a given RPC program.
10 * These statistics are not for detailed problem diagnosis, but simply
11 * to indicate whether the problem is local or remote.
12 *
13 * These counters are not meant to be human-readable, but are meant to be
14 * integrated into system monitoring tools such as "sar" and "iostat". As
15 * such, the counters are sampled by the tools over time, and are never
16 * zeroed after a file system is mounted. Moving averages can be computed
17 * by the tools by taking the difference between two instantaneous samples
18 * and dividing that by the time between the samples.
19 *
20 * The counters are maintained in a single array per RPC client, indexed
21 * by procedure number. There is no need to maintain separate counter
22 * arrays per-CPU because these counters are always modified behind locks.
23 */
24
25#ifndef _LINUX_SUNRPC_METRICS_H
26#define _LINUX_SUNRPC_METRICS_H
27
28#include <linux/seq_file.h>
29
30#define RPC_IOSTATS_VERS "1.0"
31
32struct rpc_iostats {
33 /*
34 * These counters give an idea about how many request
35 * transmissions are required, on average, to complete that
36 * particular procedure. Some procedures may require more
37 * than one transmission because the server is unresponsive,
38 * the client is retransmitting too aggressively, or the
39 * requests are large and the network is congested.
40 */
41 unsigned long om_ops, /* count of operations */
42 om_ntrans, /* count of RPC transmissions */
43 om_timeouts; /* count of major timeouts */
44
45 /*
46 * These count how many bytes are sent and received for a
47 * given RPC procedure type. This indicates how much load a
48 * particular procedure is putting on the network. These
49 * counts include the RPC and ULP headers, and the request
50 * payload.
51 */
52 unsigned long long om_bytes_sent, /* count of bytes out */
53 om_bytes_recv; /* count of bytes in */
54
55 /*
56 * The length of time an RPC request waits in queue before
57 * transmission, the network + server latency of the request,
58 * and the total time the request spent from init to release
59 * are measured.
60 */
61 unsigned long long om_queue, /* jiffies queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */
63 om_execute; /* jiffies for RPC execution */
64} ____cacheline_aligned;
65
66struct rpc_task;
67struct rpc_clnt;
68
69/*
70 * EXPORTed functions for managing rpc_iostats structures
71 */
72struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
73void rpc_count_iostats(struct rpc_task *);
74void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
75void rpc_free_iostats(struct rpc_iostats *);
76
77#endif /* _LINUX_SUNRPC_METRICS_H */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 63929349571f..2c2189cb30aa 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -45,6 +45,8 @@ extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45extern int rpc_rmdir(char *); 45extern int rpc_rmdir(char *);
46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); 46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags);
47extern int rpc_unlink(char *); 47extern int rpc_unlink(char *);
48extern struct vfsmount *rpc_get_mount(void);
49extern void rpc_put_mount(void);
48 50
49#endif 51#endif
50#endif 52#endif
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8b25629accd8..82a91bb22362 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -86,6 +86,12 @@ struct rpc_task {
86 struct work_struct tk_work; /* Async task work queue */ 86 struct work_struct tk_work; /* Async task work queue */
87 struct rpc_wait tk_wait; /* RPC wait */ 87 struct rpc_wait tk_wait; /* RPC wait */
88 } u; 88 } u;
89
90 unsigned short tk_timeouts; /* maj timeouts */
91 size_t tk_bytes_sent; /* total bytes sent */
92 unsigned long tk_start; /* RPC task init timestamp */
93 long tk_rtt; /* round-trip time (jiffies) */
94
89#ifdef RPC_DEBUG 95#ifdef RPC_DEBUG
90 unsigned short tk_pid; /* debugging aid */ 96 unsigned short tk_pid; /* debugging aid */
91#endif 97#endif
@@ -203,6 +209,7 @@ struct rpc_wait_queue {
203 unsigned char priority; /* current priority */ 209 unsigned char priority; /* current priority */
204 unsigned char count; /* # task groups remaining serviced so far */ 210 unsigned char count; /* # task groups remaining serviced so far */
205 unsigned char nr; /* # tasks remaining for cookie */ 211 unsigned char nr; /* # tasks remaining for cookie */
212 unsigned short qlen; /* total # tasks waiting in queue */
206#ifdef RPC_DEBUG 213#ifdef RPC_DEBUG
207 const char * name; 214 const char * name;
208#endif 215#endif
@@ -269,13 +276,13 @@ void * rpc_malloc(struct rpc_task *, size_t);
269void rpc_free(struct rpc_task *); 276void rpc_free(struct rpc_task *);
270int rpciod_up(void); 277int rpciod_up(void);
271void rpciod_down(void); 278void rpciod_down(void);
272void rpciod_wake_up(void);
273int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *)); 279int __rpc_wait_for_completion_task(struct rpc_task *task, int (*)(void *));
274#ifdef RPC_DEBUG 280#ifdef RPC_DEBUG
275void rpc_show_tasks(void); 281void rpc_show_tasks(void);
276#endif 282#endif
277int rpc_init_mempool(void); 283int rpc_init_mempool(void);
278void rpc_destroy_mempool(void); 284void rpc_destroy_mempool(void);
285extern struct workqueue_struct *rpciod_workqueue;
279 286
280static inline void rpc_exit(struct rpc_task *task, int status) 287static inline void rpc_exit(struct rpc_task *task, int status)
281{ 288{
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 6ef99b14ff09..7eebbab7160b 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -114,6 +114,7 @@ struct rpc_xprt_ops {
114 void (*release_request)(struct rpc_task *task); 114 void (*release_request)(struct rpc_task *task);
115 void (*close)(struct rpc_xprt *xprt); 115 void (*close)(struct rpc_xprt *xprt);
116 void (*destroy)(struct rpc_xprt *xprt); 116 void (*destroy)(struct rpc_xprt *xprt);
117 void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq);
117}; 118};
118 119
119struct rpc_xprt { 120struct rpc_xprt {
@@ -187,6 +188,18 @@ struct rpc_xprt {
187 188
188 struct list_head recv; 189 struct list_head recv;
189 190
191 struct {
192 unsigned long bind_count, /* total number of binds */
193 connect_count, /* total number of connects */
194 connect_start, /* connect start timestamp */
195 connect_time, /* jiffies waiting for connect */
196 sends, /* how many complete requests */
197 recvs, /* how many complete requests */
198 bad_xids; /* lookup_rqst didn't find XID */
199
200 unsigned long long req_u, /* average requests on the wire */
201 bklog_u; /* backlog queue utilization */
202 } stat;
190 203
191 void (*old_data_ready)(struct sock *, int); 204 void (*old_data_ready)(struct sock *, int);
192 void (*old_state_change)(struct sock *); 205 void (*old_state_change)(struct sock *);