aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 13:46:05 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 13:47:35 -0400
commitf4921aff5b174349bc36551f142a5dbac782ea3f (patch)
treebdff8ca1531977ad1d04ac8d70e10f8dfbb26c38 /include
parent419217cb1d0266f62cbea6cdc6b1d1324350bc34 (diff)
parent05c88babab957dfd63bd351b25042d80bd854dd0 (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (131 commits) NFSv4: Fix a typo in nfs_inode_reclaim_delegation NFS: Add a boot parameter to disable 64 bit inode numbers NFS: nfs_refresh_inode should clear cache_validity flags on success NFS: Fix a connectathon regression in NFSv3 and NFSv4 NFS: Use nfs_refresh_inode() in ops that aren't expected to change the inode SUNRPC: Don't call xprt_release in call refresh SUNRPC: Don't call xprt_release() if call_allocate fails SUNRPC: Fix buggy UDP transmission [23/37] Clean up duplicate includes in [2.6 patch] net/sunrpc/rpcb_clnt.c: make struct rpcb_program static SUNRPC: Use correct type in buffer length calculations SUNRPC: Fix default hostname created in rpc_create() nfs: add server port to rpc_pipe info file NFS: Get rid of some obsolete macros NFS: Simplify filehandle revalidation NFS: Ensure that nfs_link() returns a hashed dentry NFS: Be strict about dentry revalidation when doing exclusive create NFS: Don't zap the readdir caches upon error NFS: Remove the redundant nfs_reval_fsid() NFSv3: Always use directory post-op attributes in nfs3_proc_lookup ... Fix up trivial conflict due to sock_owned_by_user() cleanup manually in net/sunrpc/xprtsock.c
Diffstat (limited to 'include')
-rw-r--r--include/linux/jiffies.h4
-rw-r--r--include/linux/nfs_fs.h78
-rw-r--r--include/linux/nfs_page.h1
-rw-r--r--include/linux/nfs_xdr.h6
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/debug.h5
-rw-r--r--include/linux/sunrpc/msg_prot.h13
-rw-r--r--include/linux/sunrpc/rpc_rdma.h116
-rw-r--r--include/linux/sunrpc/xdr.h5
-rw-r--r--include/linux/sunrpc/xprt.h42
-rw-r--r--include/linux/sunrpc/xprtrdma.h85
-rw-r--r--include/linux/sunrpc/xprtsock.h51
-rw-r--r--include/linux/writeback.h2
13 files changed, 332 insertions, 78 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index d7a5e034c3a2..e757a74b9d17 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -109,6 +109,10 @@ static inline u64 get_jiffies_64(void)
109 ((long)(a) - (long)(b) >= 0)) 109 ((long)(a) - (long)(b) >= 0))
110#define time_before_eq(a,b) time_after_eq(b,a) 110#define time_before_eq(a,b) time_after_eq(b,a)
111 111
112#define time_in_range(a,b,c) \
113 (time_after_eq(a,b) && \
114 time_before_eq(a,c))
115
112/* Same as above, but does so with platform independent 64bit types. 116/* Same as above, but does so with platform independent 64bit types.
113 * These must be used when utilizing jiffies_64 (i.e. return value of 117 * These must be used when utilizing jiffies_64 (i.e. return value of
114 * get_jiffies_64() */ 118 * get_jiffies_64() */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7250eeadd7b5..c5164c257f71 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -47,10 +47,8 @@
47#include <linux/nfs3.h> 47#include <linux/nfs3.h>
48#include <linux/nfs4.h> 48#include <linux/nfs4.h>
49#include <linux/nfs_xdr.h> 49#include <linux/nfs_xdr.h>
50
51#include <linux/nfs_fs_sb.h> 50#include <linux/nfs_fs_sb.h>
52 51
53#include <linux/rwsem.h>
54#include <linux/mempool.h> 52#include <linux/mempool.h>
55 53
56/* 54/*
@@ -77,6 +75,9 @@ struct nfs_open_context {
77 struct nfs4_state *state; 75 struct nfs4_state *state;
78 fl_owner_t lockowner; 76 fl_owner_t lockowner;
79 int mode; 77 int mode;
78
79 unsigned long flags;
80#define NFS_CONTEXT_ERROR_WRITE (0)
80 int error; 81 int error;
81 82
82 struct list_head list; 83 struct list_head list;
@@ -133,11 +134,6 @@ struct nfs_inode {
133 * server. 134 * server.
134 */ 135 */
135 unsigned long cache_change_attribute; 136 unsigned long cache_change_attribute;
136 /*
137 * Counter indicating the number of outstanding requests that
138 * will cause a file data update.
139 */
140 atomic_t data_updates;
141 137
142 struct rb_root access_cache; 138 struct rb_root access_cache;
143 struct list_head access_cache_entry_lru; 139 struct list_head access_cache_entry_lru;
@@ -205,27 +201,18 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
205#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 201#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client)
206#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) 202#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops)
207#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 203#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf)
208#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies)
209#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr)
210#define NFS_ATTRTIMEO(inode) (NFS_I(inode)->attrtimeo)
211#define NFS_MINATTRTIMEO(inode) \ 204#define NFS_MINATTRTIMEO(inode) \
212 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ 205 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \
213 : NFS_SERVER(inode)->acregmin) 206 : NFS_SERVER(inode)->acregmin)
214#define NFS_MAXATTRTIMEO(inode) \ 207#define NFS_MAXATTRTIMEO(inode) \
215 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ 208 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \
216 : NFS_SERVER(inode)->acregmax) 209 : NFS_SERVER(inode)->acregmax)
217#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp)
218 210
219#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 211#define NFS_FLAGS(inode) (NFS_I(inode)->flags)
220#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) 212#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode)))
221 213
222#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 214#define NFS_FILEID(inode) (NFS_I(inode)->fileid)
223 215
224static inline int nfs_caches_unstable(struct inode *inode)
225{
226 return atomic_read(&NFS_I(inode)->data_updates) != 0;
227}
228
229static inline void nfs_mark_for_revalidate(struct inode *inode) 216static inline void nfs_mark_for_revalidate(struct inode *inode)
230{ 217{
231 struct nfs_inode *nfsi = NFS_I(inode); 218 struct nfs_inode *nfsi = NFS_I(inode);
@@ -237,12 +224,6 @@ static inline void nfs_mark_for_revalidate(struct inode *inode)
237 spin_unlock(&inode->i_lock); 224 spin_unlock(&inode->i_lock);
238} 225}
239 226
240static inline void NFS_CACHEINV(struct inode *inode)
241{
242 if (!nfs_caches_unstable(inode))
243 nfs_mark_for_revalidate(inode);
244}
245
246static inline int nfs_server_capable(struct inode *inode, int cap) 227static inline int nfs_server_capable(struct inode *inode, int cap)
247{ 228{
248 return NFS_SERVER(inode)->caps & cap; 229 return NFS_SERVER(inode)->caps & cap;
@@ -253,28 +234,33 @@ static inline int NFS_USE_READDIRPLUS(struct inode *inode)
253 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); 234 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
254} 235}
255 236
237static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
238{
239 dentry->d_time = verf;
240}
241
256/** 242/**
257 * nfs_save_change_attribute - Returns the inode attribute change cookie 243 * nfs_save_change_attribute - Returns the inode attribute change cookie
258 * @inode - pointer to inode 244 * @dir - pointer to parent directory inode
259 * The "change attribute" is updated every time we finish an operation 245 * The "change attribute" is updated every time we finish an operation
260 * that will result in a metadata change on the server. 246 * that will result in a metadata change on the server.
261 */ 247 */
262static inline long nfs_save_change_attribute(struct inode *inode) 248static inline unsigned long nfs_save_change_attribute(struct inode *dir)
263{ 249{
264 return NFS_I(inode)->cache_change_attribute; 250 return NFS_I(dir)->cache_change_attribute;
265} 251}
266 252
267/** 253/**
268 * nfs_verify_change_attribute - Detects NFS inode cache updates 254 * nfs_verify_change_attribute - Detects NFS remote directory changes
269 * @inode - pointer to inode 255 * @dir - pointer to parent directory inode
270 * @chattr - previously saved change attribute 256 * @chattr - previously saved change attribute
271 * Return "false" if metadata has been updated (or is in the process of 257 * Return "false" if the verifiers doesn't match the change attribute.
272 * being updated) since the change attribute was saved. 258 * This would usually indicate that the directory contents have changed on
259 * the server, and that any dentries need revalidating.
273 */ 260 */
274static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr) 261static inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr)
275{ 262{
276 return !nfs_caches_unstable(inode) 263 return chattr == NFS_I(dir)->cache_change_attribute;
277 && time_after_eq(chattr, NFS_I(inode)->cache_change_attribute);
278} 264}
279 265
280/* 266/*
@@ -283,15 +269,14 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long
283extern int nfs_sync_mapping(struct address_space *mapping); 269extern int nfs_sync_mapping(struct address_space *mapping);
284extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); 270extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
285extern void nfs_zap_caches(struct inode *); 271extern void nfs_zap_caches(struct inode *);
272extern void nfs_invalidate_atime(struct inode *);
286extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 273extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
287 struct nfs_fattr *); 274 struct nfs_fattr *);
288extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 275extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
289extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 276extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
277extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
290extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 278extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
291extern int nfs_permission(struct inode *, int, struct nameidata *); 279extern int nfs_permission(struct inode *, int, struct nameidata *);
292extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *);
293extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
294extern void nfs_access_zap_cache(struct inode *inode);
295extern int nfs_open(struct inode *, struct file *); 280extern int nfs_open(struct inode *, struct file *);
296extern int nfs_release(struct inode *, struct file *); 281extern int nfs_release(struct inode *, struct file *);
297extern int nfs_attribute_timeout(struct inode *inode); 282extern int nfs_attribute_timeout(struct inode *inode);
@@ -301,13 +286,10 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map
301extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); 286extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping);
302extern int nfs_setattr(struct dentry *, struct iattr *); 287extern int nfs_setattr(struct dentry *, struct iattr *);
303extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 288extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
304extern void nfs_begin_attr_update(struct inode *);
305extern void nfs_end_attr_update(struct inode *);
306extern void nfs_begin_data_update(struct inode *);
307extern void nfs_end_data_update(struct inode *);
308extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 289extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
309extern void put_nfs_open_context(struct nfs_open_context *ctx); 290extern void put_nfs_open_context(struct nfs_open_context *ctx);
310extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 291extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
292extern u64 nfs_compat_user_ino64(u64 fileid);
311 293
312/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 294/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
313extern __be32 root_nfs_parse_addr(char *name); /*__init*/ 295extern __be32 root_nfs_parse_addr(char *name); /*__init*/
@@ -328,14 +310,15 @@ extern const struct inode_operations nfs3_file_inode_operations;
328extern const struct file_operations nfs_file_operations; 310extern const struct file_operations nfs_file_operations;
329extern const struct address_space_operations nfs_file_aops; 311extern const struct address_space_operations nfs_file_aops;
330 312
331static inline struct rpc_cred *nfs_file_cred(struct file *file) 313static inline struct nfs_open_context *nfs_file_open_context(struct file *filp)
332{ 314{
333 if (file != NULL) { 315 return filp->private_data;
334 struct nfs_open_context *ctx; 316}
335 317
336 ctx = (struct nfs_open_context*)file->private_data; 318static inline struct rpc_cred *nfs_file_cred(struct file *file)
337 return ctx->cred; 319{
338 } 320 if (file != NULL)
321 return nfs_file_open_context(file)->cred;
339 return NULL; 322 return NULL;
340} 323}
341 324
@@ -378,6 +361,8 @@ extern const struct file_operations nfs_dir_operations;
378extern struct dentry_operations nfs_dentry_operations; 361extern struct dentry_operations nfs_dentry_operations;
379 362
380extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 363extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
364extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
365extern void nfs_access_zap_cache(struct inode *inode);
381 366
382/* 367/*
383 * linux/fs/nfs/symlink.c 368 * linux/fs/nfs/symlink.c
@@ -420,15 +405,14 @@ extern int nfs_flush_incompatible(struct file *file, struct page *page);
420extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 405extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
421extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); 406extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
422extern void nfs_writedata_release(void *); 407extern void nfs_writedata_release(void *);
423extern int nfs_set_page_dirty(struct page *);
424 408
425/* 409/*
426 * Try to write back everything synchronously (but check the 410 * Try to write back everything synchronously (but check the
427 * return value!) 411 * return value!)
428 */ 412 */
429extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int); 413extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int);
430extern int nfs_sync_mapping_range(struct address_space *, loff_t, loff_t, int);
431extern int nfs_wb_all(struct inode *inode); 414extern int nfs_wb_all(struct inode *inode);
415extern int nfs_wb_nocommit(struct inode *inode);
432extern int nfs_wb_page(struct inode *inode, struct page* page); 416extern int nfs_wb_page(struct inode *inode, struct page* page);
433extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how); 417extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
434extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 418extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 78e60798d10e..30dbcc185e69 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -30,7 +30,6 @@
30#define PG_BUSY 0 30#define PG_BUSY 0
31#define PG_NEED_COMMIT 1 31#define PG_NEED_COMMIT 1
32#define PG_NEED_RESCHED 2 32#define PG_NEED_RESCHED 2
33#define PG_NEED_FLUSH 3
34 33
35struct nfs_inode; 34struct nfs_inode;
36struct nfs_page { 35struct nfs_page {
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index cf74a4db84a5..daab252f2e5c 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -62,7 +62,8 @@ struct nfs_fattr {
62#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ 62#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
63#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ 63#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
64#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */ 64#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
65#define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* NFSv4 referral */ 65#define NFS_ATTR_WCC_V4 0x0010 /* pre-op change attribute */
66#define NFS_ATTR_FATTR_V4_REFERRAL 0x0020 /* NFSv4 referral */
66 67
67/* 68/*
68 * Info on the file system 69 * Info on the file system
@@ -538,10 +539,13 @@ typedef u64 clientid4;
538 539
539struct nfs4_accessargs { 540struct nfs4_accessargs {
540 const struct nfs_fh * fh; 541 const struct nfs_fh * fh;
542 const u32 * bitmask;
541 u32 access; 543 u32 access;
542}; 544};
543 545
544struct nfs4_accessres { 546struct nfs4_accessres {
547 const struct nfs_server * server;
548 struct nfs_fattr * fattr;
545 u32 supported; 549 u32 supported;
546 u32 access; 550 u32 access;
547}; 551};
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index c0d9d14983b3..d9d5c5ad826c 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -117,7 +117,7 @@ struct rpc_create_args {
117 117
118struct rpc_clnt *rpc_create(struct rpc_create_args *args); 118struct rpc_clnt *rpc_create(struct rpc_create_args *args);
119struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 119struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
120 struct rpc_program *, int); 120 struct rpc_program *, u32);
121struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 121struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
122void rpc_shutdown_client(struct rpc_clnt *); 122void rpc_shutdown_client(struct rpc_clnt *);
123void rpc_release_client(struct rpc_clnt *); 123void rpc_release_client(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 3912cf16361e..3347c72b848a 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -88,6 +88,11 @@ enum {
88 CTL_SLOTTABLE_TCP, 88 CTL_SLOTTABLE_TCP,
89 CTL_MIN_RESVPORT, 89 CTL_MIN_RESVPORT,
90 CTL_MAX_RESVPORT, 90 CTL_MAX_RESVPORT,
91 CTL_SLOTTABLE_RDMA,
92 CTL_RDMA_MAXINLINEREAD,
93 CTL_RDMA_MAXINLINEWRITE,
94 CTL_RDMA_WRITEPADDING,
95 CTL_RDMA_MEMREG,
91}; 96};
92 97
93#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 98#endif /* _LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 784d4c3ef651..c4beb5775111 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -138,6 +138,19 @@ typedef __be32 rpc_fraghdr;
138#define RPC_MAX_HEADER_WITH_AUTH \ 138#define RPC_MAX_HEADER_WITH_AUTH \
139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4)) 139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4))
140 140
141/*
142 * RFC1833/RFC3530 rpcbind (v3+) well-known netid's.
143 */
144#define RPCBIND_NETID_UDP "udp"
145#define RPCBIND_NETID_TCP "tcp"
146#define RPCBIND_NETID_UDP6 "udp6"
147#define RPCBIND_NETID_TCP6 "tcp6"
148
149/*
150 * Note that RFC 1833 does not put any size restrictions on the
151 * netid string, but all currently defined netid's fit in 4 bytes.
152 */
153#define RPCBIND_MAXNETIDLEN (4u)
141 154
142#endif /* __KERNEL__ */ 155#endif /* __KERNEL__ */
143#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 156#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
new file mode 100644
index 000000000000..0013a0d8dc6b
--- /dev/null
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -0,0 +1,116 @@
1/*
2 * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the BSD-type
8 * license below:
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 *
22 * Neither the name of the Network Appliance, Inc. nor the names of
23 * its contributors may be used to endorse or promote products
24 * derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef _LINUX_SUNRPC_RPC_RDMA_H
41#define _LINUX_SUNRPC_RPC_RDMA_H
42
43struct rpcrdma_segment {
44 uint32_t rs_handle; /* Registered memory handle */
45 uint32_t rs_length; /* Length of the chunk in bytes */
46 uint64_t rs_offset; /* Chunk virtual address or offset */
47};
48
49/*
50 * read chunk(s), encoded as a linked list.
51 */
52struct rpcrdma_read_chunk {
53 uint32_t rc_discrim; /* 1 indicates presence */
54 uint32_t rc_position; /* Position in XDR stream */
55 struct rpcrdma_segment rc_target;
56};
57
58/*
59 * write chunk, and reply chunk.
60 */
61struct rpcrdma_write_chunk {
62 struct rpcrdma_segment wc_target;
63};
64
65/*
66 * write chunk(s), encoded as a counted array.
67 */
68struct rpcrdma_write_array {
69 uint32_t wc_discrim; /* 1 indicates presence */
70 uint32_t wc_nchunks; /* Array count */
71 struct rpcrdma_write_chunk wc_array[0];
72};
73
74struct rpcrdma_msg {
75 uint32_t rm_xid; /* Mirrors the RPC header xid */
76 uint32_t rm_vers; /* Version of this protocol */
77 uint32_t rm_credit; /* Buffers requested/granted */
78 uint32_t rm_type; /* Type of message (enum rpcrdma_proc) */
79 union {
80
81 struct { /* no chunks */
82 uint32_t rm_empty[3]; /* 3 empty chunk lists */
83 } rm_nochunks;
84
85 struct { /* no chunks and padded */
86 uint32_t rm_align; /* Padding alignment */
87 uint32_t rm_thresh; /* Padding threshold */
88 uint32_t rm_pempty[3]; /* 3 empty chunk lists */
89 } rm_padded;
90
91 uint32_t rm_chunks[0]; /* read, write and reply chunks */
92
93 } rm_body;
94};
95
96#define RPCRDMA_HDRLEN_MIN 28
97
98enum rpcrdma_errcode {
99 ERR_VERS = 1,
100 ERR_CHUNK = 2
101};
102
103struct rpcrdma_err_vers {
104 uint32_t rdma_vers_low; /* Version range supported by peer */
105 uint32_t rdma_vers_high;
106};
107
108enum rpcrdma_proc {
109 RDMA_MSG = 0, /* An RPC call or reply msg */
110 RDMA_NOMSG = 1, /* An RPC call or reply msg - separate body */
111 RDMA_MSGP = 2, /* An RPC call or reply msg with padding */
112 RDMA_DONE = 3, /* Client signals reply completion */
113 RDMA_ERROR = 4 /* An RPC RDMA encoding error */
114};
115
116#endif /* _LINUX_SUNRPC_RPC_RDMA_H */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index c6b53d181bfa..0751c9464d0f 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -70,7 +70,10 @@ struct xdr_buf {
70 70
71 struct page ** pages; /* Array of contiguous pages */ 71 struct page ** pages; /* Array of contiguous pages */
72 unsigned int page_base, /* Start of page data */ 72 unsigned int page_base, /* Start of page data */
73 page_len; /* Length of page data */ 73 page_len, /* Length of page data */
74 flags; /* Flags for data disposition */
75#define XDRBUF_READ 0x01 /* target of file read */
76#define XDRBUF_WRITE 0x02 /* source of file write */
74 77
75 unsigned int buflen, /* Total length of storage buffer */ 78 unsigned int buflen, /* Total length of storage buffer */
76 len; /* Length of XDR encoded message */ 79 len; /* Length of XDR encoded message */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index d11cedd14f0f..30b17b3bc1a9 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -19,25 +19,11 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22extern unsigned int xprt_udp_slot_table_entries;
23extern unsigned int xprt_tcp_slot_table_entries;
24
25#define RPC_MIN_SLOT_TABLE (2U) 22#define RPC_MIN_SLOT_TABLE (2U)
26#define RPC_DEF_SLOT_TABLE (16U) 23#define RPC_DEF_SLOT_TABLE (16U)
27#define RPC_MAX_SLOT_TABLE (128U) 24#define RPC_MAX_SLOT_TABLE (128U)
28 25
29/* 26/*
30 * Parameters for choosing a free port
31 */
32extern unsigned int xprt_min_resvport;
33extern unsigned int xprt_max_resvport;
34
35#define RPC_MIN_RESVPORT (1U)
36#define RPC_MAX_RESVPORT (65535U)
37#define RPC_DEF_MIN_RESVPORT (665U)
38#define RPC_DEF_MAX_RESVPORT (1023U)
39
40/*
41 * This describes a timeout strategy 27 * This describes a timeout strategy
42 */ 28 */
43struct rpc_timeout { 29struct rpc_timeout {
@@ -53,6 +39,10 @@ enum rpc_display_format_t {
53 RPC_DISPLAY_PORT, 39 RPC_DISPLAY_PORT,
54 RPC_DISPLAY_PROTO, 40 RPC_DISPLAY_PROTO,
55 RPC_DISPLAY_ALL, 41 RPC_DISPLAY_ALL,
42 RPC_DISPLAY_HEX_ADDR,
43 RPC_DISPLAY_HEX_PORT,
44 RPC_DISPLAY_UNIVERSAL_ADDR,
45 RPC_DISPLAY_NETID,
56 RPC_DISPLAY_MAX, 46 RPC_DISPLAY_MAX,
57}; 47};
58 48
@@ -196,14 +186,22 @@ struct rpc_xprt {
196 char * address_strings[RPC_DISPLAY_MAX]; 186 char * address_strings[RPC_DISPLAY_MAX];
197}; 187};
198 188
199struct rpc_xprtsock_create { 189struct xprt_create {
200 int proto; /* IPPROTO_UDP or IPPROTO_TCP */ 190 int ident; /* XPRT_TRANSPORT identifier */
201 struct sockaddr * srcaddr; /* optional local address */ 191 struct sockaddr * srcaddr; /* optional local address */
202 struct sockaddr * dstaddr; /* remote peer address */ 192 struct sockaddr * dstaddr; /* remote peer address */
203 size_t addrlen; 193 size_t addrlen;
204 struct rpc_timeout * timeout; /* optional timeout parameters */ 194 struct rpc_timeout * timeout; /* optional timeout parameters */
205}; 195};
206 196
197struct xprt_class {
198 struct list_head list;
199 int ident; /* XPRT_TRANSPORT identifier */
200 struct rpc_xprt * (*setup)(struct xprt_create *);
201 struct module *owner;
202 char name[32];
203};
204
207/* 205/*
208 * Transport operations used by ULPs 206 * Transport operations used by ULPs
209 */ 207 */
@@ -212,7 +210,7 @@ void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long
212/* 210/*
213 * Generic internal transport functions 211 * Generic internal transport functions
214 */ 212 */
215struct rpc_xprt * xprt_create_transport(struct rpc_xprtsock_create *args); 213struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
216void xprt_connect(struct rpc_task *task); 214void xprt_connect(struct rpc_task *task);
217void xprt_reserve(struct rpc_task *task); 215void xprt_reserve(struct rpc_task *task);
218int xprt_reserve_xprt(struct rpc_task *task); 216int xprt_reserve_xprt(struct rpc_task *task);
@@ -235,6 +233,8 @@ static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *
235/* 233/*
236 * Transport switch helper functions 234 * Transport switch helper functions
237 */ 235 */
236int xprt_register_transport(struct xprt_class *type);
237int xprt_unregister_transport(struct xprt_class *type);
238void xprt_set_retrans_timeout_def(struct rpc_task *task); 238void xprt_set_retrans_timeout_def(struct rpc_task *task);
239void xprt_set_retrans_timeout_rtt(struct rpc_task *task); 239void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
240void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 240void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
@@ -248,14 +248,6 @@ void xprt_release_rqst_cong(struct rpc_task *task);
248void xprt_disconnect(struct rpc_xprt *xprt); 248void xprt_disconnect(struct rpc_xprt *xprt);
249 249
250/* 250/*
251 * Socket transport setup operations
252 */
253struct rpc_xprt * xs_setup_udp(struct rpc_xprtsock_create *args);
254struct rpc_xprt * xs_setup_tcp(struct rpc_xprtsock_create *args);
255int init_socket_xprt(void);
256void cleanup_socket_xprt(void);
257
258/*
259 * Reserved bit positions in xprt->state 251 * Reserved bit positions in xprt->state
260 */ 252 */
261#define XPRT_LOCKED (0) 253#define XPRT_LOCKED (0)
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
new file mode 100644
index 000000000000..4de56b1d372b
--- /dev/null
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the BSD-type
8 * license below:
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 *
22 * Neither the name of the Network Appliance, Inc. nor the names of
23 * its contributors may be used to endorse or promote products
24 * derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef _LINUX_SUNRPC_XPRTRDMA_H
41#define _LINUX_SUNRPC_XPRTRDMA_H
42
43/*
44 * RPC transport identifier for RDMA
45 */
46#define XPRT_TRANSPORT_RDMA 256
47
48/*
49 * rpcbind (v3+) RDMA netid.
50 */
51#define RPCBIND_NETID_RDMA "rdma"
52
53/*
54 * Constants. Max RPC/NFS header is big enough to account for
55 * additional marshaling buffers passed down by Linux client.
56 *
57 * RDMA header is currently fixed max size, and is big enough for a
58 * fully-chunked NFS message (read chunks are the largest). Note only
59 * a single chunk type per message is supported currently.
60 */
61#define RPCRDMA_MIN_SLOT_TABLE (2U)
62#define RPCRDMA_DEF_SLOT_TABLE (32U)
63#define RPCRDMA_MAX_SLOT_TABLE (256U)
64
65#define RPCRDMA_DEF_INLINE (1024) /* default inline max */
66
67#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */
68
69#define RDMA_RESOLVE_TIMEOUT (5*HZ) /* TBD 5 seconds */
70#define RDMA_CONNECT_RETRY_MAX (2) /* retries if no listener backlog */
71
72/* memory registration strategies */
73#define RPCRDMA_PERSISTENT_REGISTRATION (1)
74
75enum rpcrdma_memreg {
76 RPCRDMA_BOUNCEBUFFERS = 0,
77 RPCRDMA_REGISTER,
78 RPCRDMA_MEMWINDOWS,
79 RPCRDMA_MEMWINDOWS_ASYNC,
80 RPCRDMA_MTHCAFMR,
81 RPCRDMA_ALLPHYSICAL,
82 RPCRDMA_LAST
83};
84
85#endif /* _LINUX_SUNRPC_XPRTRDMA_H */
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
new file mode 100644
index 000000000000..2c6c2c2783d8
--- /dev/null
+++ b/include/linux/sunrpc/xprtsock.h
@@ -0,0 +1,51 @@
1/*
2 * linux/include/linux/sunrpc/xprtsock.h
3 *
4 * Declarations for the RPC transport socket provider.
5 */
6
7#ifndef _LINUX_SUNRPC_XPRTSOCK_H
8#define _LINUX_SUNRPC_XPRTSOCK_H
9
10#ifdef __KERNEL__
11
12/*
13 * Socket transport setup operations
14 */
15struct rpc_xprt *xs_setup_udp(struct xprt_create *args);
16struct rpc_xprt *xs_setup_tcp(struct xprt_create *args);
17
18int init_socket_xprt(void);
19void cleanup_socket_xprt(void);
20
21/*
22 * RPC transport identifiers for UDP, TCP
23 *
24 * To preserve compatibility with the historical use of raw IP protocol
25 * id's for transport selection, these are specified with the previous
26 * values. No such restriction exists for new transports, except that
27 * they may not collide with these values (17 and 6, respectively).
28 */
29#define XPRT_TRANSPORT_UDP IPPROTO_UDP
30#define XPRT_TRANSPORT_TCP IPPROTO_TCP
31
32/*
33 * RPC slot table sizes for UDP, TCP transports
34 */
35extern unsigned int xprt_udp_slot_table_entries;
36extern unsigned int xprt_tcp_slot_table_entries;
37
38/*
39 * Parameters for choosing a free port
40 */
41extern unsigned int xprt_min_resvport;
42extern unsigned int xprt_max_resvport;
43
44#define RPC_MIN_RESVPORT (1U)
45#define RPC_MAX_RESVPORT (65535U)
46#define RPC_DEF_MIN_RESVPORT (665U)
47#define RPC_DEF_MAX_RESVPORT (1023U)
48
49#endif /* __KERNEL__ */
50
51#endif /* _LINUX_SUNRPC_XPRTSOCK_H */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index c7c3337c3a88..d1321a81c9c4 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -62,8 +62,6 @@ struct writeback_control {
62 unsigned for_reclaim:1; /* Invoked from the page allocator */ 62 unsigned for_reclaim:1; /* Invoked from the page allocator */
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65
66 void *fs_private; /* For use by ->writepages() */
67}; 65};
68 66
69/* 67/*