diff options
Diffstat (limited to 'fs/nfs/pnfs.h')
-rw-r--r-- | fs/nfs/pnfs.h | 76 |
1 files changed, 61 insertions, 15 deletions
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index e12367d50489..e2612ea0cbed 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -30,11 +30,17 @@ | |||
30 | #ifndef FS_NFS_PNFS_H | 30 | #ifndef FS_NFS_PNFS_H |
31 | #define FS_NFS_PNFS_H | 31 | #define FS_NFS_PNFS_H |
32 | 32 | ||
33 | enum { | ||
34 | NFS_LSEG_VALID = 0, /* cleared when lseg is recalled/returned */ | ||
35 | NFS_LSEG_ROC, /* roc bit received from server */ | ||
36 | }; | ||
37 | |||
33 | struct pnfs_layout_segment { | 38 | struct pnfs_layout_segment { |
34 | struct list_head fi_list; | 39 | struct list_head pls_list; |
35 | struct pnfs_layout_range range; | 40 | struct pnfs_layout_range pls_range; |
36 | struct kref kref; | 41 | atomic_t pls_refcount; |
37 | struct pnfs_layout_hdr *layout; | 42 | unsigned long pls_flags; |
43 | struct pnfs_layout_hdr *pls_layout; | ||
38 | }; | 44 | }; |
39 | 45 | ||
40 | #ifdef CONFIG_NFS_V4_1 | 46 | #ifdef CONFIG_NFS_V4_1 |
@@ -44,7 +50,9 @@ struct pnfs_layout_segment { | |||
44 | enum { | 50 | enum { |
45 | NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ | 51 | NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ |
46 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ | 52 | NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ |
47 | NFS_LAYOUT_STATEID_SET, /* have a valid layout stateid */ | 53 | NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ |
54 | NFS_LAYOUT_ROC, /* some lseg had roc bit set */ | ||
55 | NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */ | ||
48 | }; | 56 | }; |
49 | 57 | ||
50 | /* Per-layout driver specific registration structure */ | 58 | /* Per-layout driver specific registration structure */ |
@@ -60,13 +68,16 @@ struct pnfs_layoutdriver_type { | |||
60 | }; | 68 | }; |
61 | 69 | ||
62 | struct pnfs_layout_hdr { | 70 | struct pnfs_layout_hdr { |
63 | unsigned long refcount; | 71 | atomic_t plh_refcount; |
64 | struct list_head layouts; /* other client layouts */ | 72 | struct list_head plh_layouts; /* other client layouts */ |
65 | struct list_head segs; /* layout segments list */ | 73 | struct list_head plh_bulk_recall; /* clnt list of bulk recalls */ |
66 | seqlock_t seqlock; /* Protects the stateid */ | 74 | struct list_head plh_segs; /* layout segments list */ |
67 | nfs4_stateid stateid; | 75 | nfs4_stateid plh_stateid; |
68 | unsigned long state; | 76 | atomic_t plh_outstanding; /* number of RPCs out */ |
69 | struct inode *inode; | 77 | unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ |
78 | u32 plh_barrier; /* ignore lower seqids */ | ||
79 | unsigned long plh_flags; | ||
80 | struct inode *plh_inode; | ||
70 | }; | 81 | }; |
71 | 82 | ||
72 | struct pnfs_device { | 83 | struct pnfs_device { |
@@ -134,17 +145,30 @@ extern int nfs4_proc_getdeviceinfo(struct nfs_server *server, | |||
134 | extern int nfs4_proc_layoutget(struct nfs4_layoutget *lgp); | 145 | extern int nfs4_proc_layoutget(struct nfs4_layoutget *lgp); |
135 | 146 | ||
136 | /* pnfs.c */ | 147 | /* pnfs.c */ |
148 | void get_layout_hdr(struct pnfs_layout_hdr *lo); | ||
137 | struct pnfs_layout_segment * | 149 | struct pnfs_layout_segment * |
138 | pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, | 150 | pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, |
139 | enum pnfs_iomode access_type); | 151 | enum pnfs_iomode access_type); |
140 | void set_pnfs_layoutdriver(struct nfs_server *, u32 id); | 152 | void set_pnfs_layoutdriver(struct nfs_server *, u32 id); |
141 | void unset_pnfs_layoutdriver(struct nfs_server *); | 153 | void unset_pnfs_layoutdriver(struct nfs_server *); |
142 | int pnfs_layout_process(struct nfs4_layoutget *lgp); | 154 | int pnfs_layout_process(struct nfs4_layoutget *lgp); |
155 | void pnfs_free_lseg_list(struct list_head *tmp_list); | ||
143 | void pnfs_destroy_layout(struct nfs_inode *); | 156 | void pnfs_destroy_layout(struct nfs_inode *); |
144 | void pnfs_destroy_all_layouts(struct nfs_client *); | 157 | void pnfs_destroy_all_layouts(struct nfs_client *); |
145 | void put_layout_hdr(struct inode *inode); | 158 | void put_layout_hdr(struct pnfs_layout_hdr *lo); |
146 | void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_hdr *lo, | 159 | void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, |
147 | struct nfs4_state *open_state); | 160 | const nfs4_stateid *new, |
161 | bool update_barrier); | ||
162 | int pnfs_choose_layoutget_stateid(nfs4_stateid *dst, | ||
163 | struct pnfs_layout_hdr *lo, | ||
164 | struct nfs4_state *open_state); | ||
165 | int mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, | ||
166 | struct list_head *tmp_list, | ||
167 | u32 iomode); | ||
168 | bool pnfs_roc(struct inode *ino); | ||
169 | void pnfs_roc_release(struct inode *ino); | ||
170 | void pnfs_roc_set_barrier(struct inode *ino, u32 barrier); | ||
171 | bool pnfs_roc_drain(struct inode *ino, u32 *barrier); | ||
148 | 172 | ||
149 | 173 | ||
150 | static inline int lo_fail_bit(u32 iomode) | 174 | static inline int lo_fail_bit(u32 iomode) |
@@ -176,6 +200,28 @@ pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx, | |||
176 | return NULL; | 200 | return NULL; |
177 | } | 201 | } |
178 | 202 | ||
203 | static inline bool | ||
204 | pnfs_roc(struct inode *ino) | ||
205 | { | ||
206 | return false; | ||
207 | } | ||
208 | |||
209 | static inline void | ||
210 | pnfs_roc_release(struct inode *ino) | ||
211 | { | ||
212 | } | ||
213 | |||
214 | static inline void | ||
215 | pnfs_roc_set_barrier(struct inode *ino, u32 barrier) | ||
216 | { | ||
217 | } | ||
218 | |||
219 | static inline bool | ||
220 | pnfs_roc_drain(struct inode *ino, u32 *barrier) | ||
221 | { | ||
222 | return false; | ||
223 | } | ||
224 | |||
179 | static inline void set_pnfs_layoutdriver(struct nfs_server *s, u32 id) | 225 | static inline void set_pnfs_layoutdriver(struct nfs_server *s, u32 id) |
180 | { | 226 | { |
181 | } | 227 | } |