aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.h
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2010-10-20 00:18:01 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-10-24 18:07:10 -0400
commite5e940170b2136ad4d5483ef293ae284b9cc8d53 (patch)
tree1568bf55addee6a6fdc091026083426b087e68df /fs/nfs/pnfs.h
parent7ab672ce312133ee4a5d85b71447b2b334403681 (diff)
NFS: create and destroy inode's layout cache
At the start of the io paths, try to grab the relevant layout information. This will initiate the inode's layout cache, but stubs ensure the cache stays empty. Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Dean Hildebrand <dhildebz@umich.edu> Signed-off-by: Marc Eshel <eshel@almaden.ibm.com> Signed-off-by: Tao Guo <guotao@nrchpc.ac.cn> Signed-off-by: Ricardo Labiaga <ricardo.labiaga@netapp.com> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Andy Adamson <andros@netapp.com> Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.h')
-rw-r--r--fs/nfs/pnfs.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 61531f338576..4ed1b48c71b1 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -34,6 +34,11 @@
34 34
35#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" 35#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
36 36
37enum {
38 NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */
39 NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */
40};
41
37/* Per-layout driver specific registration structure */ 42/* Per-layout driver specific registration structure */
38struct pnfs_layoutdriver_type { 43struct pnfs_layoutdriver_type {
39 struct list_head pnfs_tblid; 44 struct list_head pnfs_tblid;
@@ -44,14 +49,48 @@ struct pnfs_layoutdriver_type {
44 int (*uninitialize_mountpoint) (struct nfs_server *); 49 int (*uninitialize_mountpoint) (struct nfs_server *);
45}; 50};
46 51
52struct pnfs_layout_hdr {
53 unsigned long refcount;
54 unsigned long state;
55 struct inode *inode;
56};
57
47extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *); 58extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *);
48extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *); 59extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *);
49 60
61struct pnfs_layout_segment *
62pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
63 enum pnfs_iomode access_type);
50void set_pnfs_layoutdriver(struct nfs_server *, u32 id); 64void set_pnfs_layoutdriver(struct nfs_server *, u32 id);
51void unset_pnfs_layoutdriver(struct nfs_server *); 65void unset_pnfs_layoutdriver(struct nfs_server *);
66void pnfs_destroy_layout(struct nfs_inode *);
67
68
69static inline int lo_fail_bit(u32 iomode)
70{
71 return iomode == IOMODE_RW ?
72 NFS_LAYOUT_RW_FAILED : NFS_LAYOUT_RO_FAILED;
73}
74
75/* Return true if a layout driver is being used for this mountpoint */
76static inline int pnfs_enabled_sb(struct nfs_server *nfss)
77{
78 return nfss->pnfs_curr_ld != NULL;
79}
52 80
53#else /* CONFIG_NFS_V4_1 */ 81#else /* CONFIG_NFS_V4_1 */
54 82
83static inline void pnfs_destroy_layout(struct nfs_inode *nfsi)
84{
85}
86
87static inline struct pnfs_layout_segment *
88pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
89 enum pnfs_iomode access_type)
90{
91 return NULL;
92}
93
55static inline void set_pnfs_layoutdriver(struct nfs_server *s, u32 id) 94static inline void set_pnfs_layoutdriver(struct nfs_server *s, u32 id)
56{ 95{
57} 96}