pnfs.h (bd0d10498826ed150da5e4c45baf8b9c7088fb71) | pnfs.h (6296556f0b31eaff29f2a3aee2c17b7eae895b98) |
---|---|
1/* 2 * pNFS client data structures. 3 * 4 * Copyright (c) 2002 5 * The Regents of the University of Michigan 6 * All Rights Reserved 7 * 8 * Dean Hildebrand <dhildebz@umich.edu> --- 48 unchanged lines hidden (view full) --- 57 58#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" 59 60enum { 61 NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ 62 NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ 63 NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ 64 NFS_LAYOUT_ROC, /* some lseg had roc bit set */ | 1/* 2 * pNFS client data structures. 3 * 4 * Copyright (c) 2002 5 * The Regents of the University of Michigan 6 * All Rights Reserved 7 * 8 * Dean Hildebrand <dhildebz@umich.edu> --- 48 unchanged lines hidden (view full) --- 57 58#define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" 59 60enum { 61 NFS_LAYOUT_RO_FAILED = 0, /* get ro layout failed stop trying */ 62 NFS_LAYOUT_RW_FAILED, /* get rw layout failed stop trying */ 63 NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ 64 NFS_LAYOUT_ROC, /* some lseg had roc bit set */ |
65 NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */ 66 NFS_LAYOUT_INVALID, /* layout is being destroyed */ 67 NFS_LAYOUT_RETURNED, /* layout has already been returned */ | |
68}; 69 70enum layoutdriver_policy_flags { 71 /* Should the pNFS client commit and return the layout upon a setattr */ 72 PNFS_LAYOUTRET_ON_SETATTR = 1 << 0, 73 PNFS_LAYOUTRET_ON_ERROR = 1 << 1, 74}; 75 --- 59 unchanged lines hidden (view full) --- 135 atomic_t plh_refcount; 136 struct list_head plh_layouts; /* other client layouts */ 137 struct list_head plh_bulk_recall; /* clnt list of bulk recalls */ 138 struct list_head plh_segs; /* layout segments list */ 139 nfs4_stateid plh_stateid; 140 atomic_t plh_outstanding; /* number of RPCs out */ 141 unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ 142 u32 plh_barrier; /* ignore lower seqids */ | 65}; 66 67enum layoutdriver_policy_flags { 68 /* Should the pNFS client commit and return the layout upon a setattr */ 69 PNFS_LAYOUTRET_ON_SETATTR = 1 << 0, 70 PNFS_LAYOUTRET_ON_ERROR = 1 << 1, 71}; 72 --- 59 unchanged lines hidden (view full) --- 132 atomic_t plh_refcount; 133 struct list_head plh_layouts; /* other client layouts */ 134 struct list_head plh_bulk_recall; /* clnt list of bulk recalls */ 135 struct list_head plh_segs; /* layout segments list */ 136 nfs4_stateid plh_stateid; 137 atomic_t plh_outstanding; /* number of RPCs out */ 138 unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ 139 u32 plh_barrier; /* ignore lower seqids */ |
140 unsigned long plh_retry_timestamp; |
|
143 unsigned long plh_flags; 144 loff_t plh_lwb; /* last write byte for layoutcommit */ 145 struct rpc_cred *plh_lc_cred; /* layoutcommit cred */ 146 struct inode *plh_inode; 147}; 148 149struct pnfs_device { 150 struct nfs4_deviceid dev_id; --- 16 unchanged lines hidden (view full) --- 167extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *); 168 169/* nfs4proc.c */ 170extern int nfs4_proc_getdevicelist(struct nfs_server *server, 171 const struct nfs_fh *fh, 172 struct pnfs_devicelist *devlist); 173extern int nfs4_proc_getdeviceinfo(struct nfs_server *server, 174 struct pnfs_device *dev); | 141 unsigned long plh_flags; 142 loff_t plh_lwb; /* last write byte for layoutcommit */ 143 struct rpc_cred *plh_lc_cred; /* layoutcommit cred */ 144 struct inode *plh_inode; 145}; 146 147struct pnfs_device { 148 struct nfs4_deviceid dev_id; --- 16 unchanged lines hidden (view full) --- 165extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *); 166 167/* nfs4proc.c */ 168extern int nfs4_proc_getdevicelist(struct nfs_server *server, 169 const struct nfs_fh *fh, 170 struct pnfs_devicelist *devlist); 171extern int nfs4_proc_getdeviceinfo(struct nfs_server *server, 172 struct pnfs_device *dev); |
175extern void nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags); | 173extern struct pnfs_layout_segment* nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags); |
176extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); 177 178/* pnfs.c */ | 174extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); 175 176/* pnfs.c */ |
179void get_layout_hdr(struct pnfs_layout_hdr *lo); 180void put_lseg(struct pnfs_layout_segment *lseg); | 177void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo); 178void pnfs_put_lseg(struct pnfs_layout_segment *lseg); |
181 182void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *, 183 const struct nfs_pgio_completion_ops *); 184void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *, 185 int, const struct nfs_pgio_completion_ops *); 186 187void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); 188void unset_pnfs_layoutdriver(struct nfs_server *); 189void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *); 190int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc); | 179 180void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *, 181 const struct nfs_pgio_completion_ops *); 182void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *, 183 int, const struct nfs_pgio_completion_ops *); 184 185void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); 186void unset_pnfs_layoutdriver(struct nfs_server *); 187void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *); 188int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc); |
191void pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *, struct nfs_page *); | 189void pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, 190 struct nfs_page *req, u64 wb_size); |
192int pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc); 193bool pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, struct nfs_page *req); 194void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg); | 191int pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc); 192bool pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, struct nfs_page *req); 193void pnfs_set_lo_fail(struct pnfs_layout_segment *lseg); |
195int pnfs_layout_process(struct nfs4_layoutget *lgp); | 194struct pnfs_layout_segment *pnfs_layout_process(struct nfs4_layoutget *lgp); |
196void pnfs_free_lseg_list(struct list_head *tmp_list); 197void pnfs_destroy_layout(struct nfs_inode *); 198void pnfs_destroy_all_layouts(struct nfs_client *); | 195void pnfs_free_lseg_list(struct list_head *tmp_list); 196void pnfs_destroy_layout(struct nfs_inode *); 197void pnfs_destroy_all_layouts(struct nfs_client *); |
199void put_layout_hdr(struct pnfs_layout_hdr *lo); | 198void pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo); |
200void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, 201 const nfs4_stateid *new, 202 bool update_barrier); 203int pnfs_choose_layoutget_stateid(nfs4_stateid *dst, 204 struct pnfs_layout_hdr *lo, 205 struct nfs4_state *open_state); | 199void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, 200 const nfs4_stateid *new, 201 bool update_barrier); 202int pnfs_choose_layoutget_stateid(nfs4_stateid *dst, 203 struct pnfs_layout_hdr *lo, 204 struct nfs4_state *open_state); |
206int mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, | 205int pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, |
207 struct list_head *tmp_list, 208 struct pnfs_layout_range *recall_range); 209bool pnfs_roc(struct inode *ino); 210void pnfs_roc_release(struct inode *ino); 211void pnfs_roc_set_barrier(struct inode *ino, u32 barrier); | 206 struct list_head *tmp_list, 207 struct pnfs_layout_range *recall_range); 208bool pnfs_roc(struct inode *ino); 209void pnfs_roc_release(struct inode *ino); 210void pnfs_roc_set_barrier(struct inode *ino, u32 barrier); |
212bool pnfs_roc_drain(struct inode *ino, u32 *barrier); | 211bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task); |
213void pnfs_set_layoutcommit(struct nfs_write_data *wdata); 214void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data); 215int pnfs_layoutcommit_inode(struct inode *inode, bool sync); 216int _pnfs_return_layout(struct inode *); 217void pnfs_ld_write_done(struct nfs_write_data *); 218void pnfs_ld_read_done(struct nfs_read_data *); 219struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, 220 struct nfs_open_context *ctx, --- 7 unchanged lines hidden (view full) --- 228 const struct nfs_pgio_completion_ops *compl_ops); 229int pnfs_write_done_resend_to_mds(struct inode *inode, struct list_head *head, 230 const struct nfs_pgio_completion_ops *compl_ops); 231struct nfs4_threshold *pnfs_mdsthreshold_alloc(void); 232 233/* nfs4_deviceid_flags */ 234enum { 235 NFS_DEVICEID_INVALID = 0, /* set when MDS clientid recalled */ | 212void pnfs_set_layoutcommit(struct nfs_write_data *wdata); 213void pnfs_cleanup_layoutcommit(struct nfs4_layoutcommit_data *data); 214int pnfs_layoutcommit_inode(struct inode *inode, bool sync); 215int _pnfs_return_layout(struct inode *); 216void pnfs_ld_write_done(struct nfs_write_data *); 217void pnfs_ld_read_done(struct nfs_read_data *); 218struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, 219 struct nfs_open_context *ctx, --- 7 unchanged lines hidden (view full) --- 227 const struct nfs_pgio_completion_ops *compl_ops); 228int pnfs_write_done_resend_to_mds(struct inode *inode, struct list_head *head, 229 const struct nfs_pgio_completion_ops *compl_ops); 230struct nfs4_threshold *pnfs_mdsthreshold_alloc(void); 231 232/* nfs4_deviceid_flags */ 233enum { 234 NFS_DEVICEID_INVALID = 0, /* set when MDS clientid recalled */ |
235 NFS_DEVICEID_UNAVAILABLE, /* device temporarily unavailable */ |
|
236}; 237 238/* pnfs_dev.c */ 239struct nfs4_deviceid_node { 240 struct hlist_node node; 241 struct hlist_node tmpnode; 242 const struct pnfs_layoutdriver_type *ld; 243 const struct nfs_client *nfs_client; 244 unsigned long flags; | 236}; 237 238/* pnfs_dev.c */ 239struct nfs4_deviceid_node { 240 struct hlist_node node; 241 struct hlist_node tmpnode; 242 const struct pnfs_layoutdriver_type *ld; 243 const struct nfs_client *nfs_client; 244 unsigned long flags; |
245 unsigned long timestamp_unavailable; |
|
245 struct nfs4_deviceid deviceid; 246 atomic_t ref; 247}; 248 249struct nfs4_deviceid_node *nfs4_find_get_deviceid(const struct pnfs_layoutdriver_type *, const struct nfs_client *, const struct nfs4_deviceid *); 250void nfs4_delete_deviceid(const struct pnfs_layoutdriver_type *, const struct nfs_client *, const struct nfs4_deviceid *); 251void nfs4_init_deviceid_node(struct nfs4_deviceid_node *, 252 const struct pnfs_layoutdriver_type *, 253 const struct nfs_client *, 254 const struct nfs4_deviceid *); 255struct nfs4_deviceid_node *nfs4_insert_deviceid_node(struct nfs4_deviceid_node *); 256bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *); | 246 struct nfs4_deviceid deviceid; 247 atomic_t ref; 248}; 249 250struct nfs4_deviceid_node *nfs4_find_get_deviceid(const struct pnfs_layoutdriver_type *, const struct nfs_client *, const struct nfs4_deviceid *); 251void nfs4_delete_deviceid(const struct pnfs_layoutdriver_type *, const struct nfs_client *, const struct nfs4_deviceid *); 252void nfs4_init_deviceid_node(struct nfs4_deviceid_node *, 253 const struct pnfs_layoutdriver_type *, 254 const struct nfs_client *, 255 const struct nfs4_deviceid *); 256struct nfs4_deviceid_node *nfs4_insert_deviceid_node(struct nfs4_deviceid_node *); 257bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *); |
258void nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node); 259bool nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node); |
|
257void nfs4_deviceid_purge_client(const struct nfs_client *); 258 | 260void nfs4_deviceid_purge_client(const struct nfs_client *); 261 |
259static inline void 260pnfs_mark_layout_returned(struct pnfs_layout_hdr *lo) 261{ 262 set_bit(NFS_LAYOUT_RETURNED, &lo->plh_flags); 263} 264 265static inline void 266pnfs_clear_layout_returned(struct pnfs_layout_hdr *lo) 267{ 268 clear_bit(NFS_LAYOUT_RETURNED, &lo->plh_flags); 269} 270 271static inline bool 272pnfs_test_layout_returned(struct pnfs_layout_hdr *lo) 273{ 274 return test_bit(NFS_LAYOUT_RETURNED, &lo->plh_flags); 275} 276 277static inline int lo_fail_bit(u32 iomode) 278{ 279 return iomode == IOMODE_RW ? 280 NFS_LAYOUT_RW_FAILED : NFS_LAYOUT_RO_FAILED; 281} 282 | |
283static inline struct pnfs_layout_segment * | 262static inline struct pnfs_layout_segment * |
284get_lseg(struct pnfs_layout_segment *lseg) | 263pnfs_get_lseg(struct pnfs_layout_segment *lseg) |
285{ 286 if (lseg) { 287 atomic_inc(&lseg->pls_refcount); 288 smp_mb__after_atomic_inc(); 289 } 290 return lseg; 291} 292 --- 108 unchanged lines hidden (view full) --- 401{ 402} 403 404static inline void pnfs_destroy_layout(struct nfs_inode *nfsi) 405{ 406} 407 408static inline struct pnfs_layout_segment * | 264{ 265 if (lseg) { 266 atomic_inc(&lseg->pls_refcount); 267 smp_mb__after_atomic_inc(); 268 } 269 return lseg; 270} 271 --- 108 unchanged lines hidden (view full) --- 380{ 381} 382 383static inline void pnfs_destroy_layout(struct nfs_inode *nfsi) 384{ 385} 386 387static inline struct pnfs_layout_segment * |
409get_lseg(struct pnfs_layout_segment *lseg) | 388pnfs_get_lseg(struct pnfs_layout_segment *lseg) |
410{ 411 return NULL; 412} 413 | 389{ 390 return NULL; 391} 392 |
414static inline void put_lseg(struct pnfs_layout_segment *lseg) | 393static inline void pnfs_put_lseg(struct pnfs_layout_segment *lseg) |
415{ 416} 417 418static inline int pnfs_return_layout(struct inode *ino) 419{ 420 return 0; 421} 422 --- 15 unchanged lines hidden (view full) --- 438} 439 440static inline void 441pnfs_roc_set_barrier(struct inode *ino, u32 barrier) 442{ 443} 444 445static inline bool | 394{ 395} 396 397static inline int pnfs_return_layout(struct inode *ino) 398{ 399 return 0; 400} 401 --- 15 unchanged lines hidden (view full) --- 417} 418 419static inline void 420pnfs_roc_set_barrier(struct inode *ino, u32 barrier) 421{ 422} 423 424static inline bool |
446pnfs_roc_drain(struct inode *ino, u32 *barrier) | 425pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task) |
447{ 448 return false; 449} 450 451static inline void set_pnfs_layoutdriver(struct nfs_server *s, 452 const struct nfs_fh *mntfh, u32 id) 453{ 454} --- 76 unchanged lines hidden --- | 426{ 427 return false; 428} 429 430static inline void set_pnfs_layoutdriver(struct nfs_server *s, 431 const struct nfs_fh *mntfh, u32 id) 432{ 433} --- 76 unchanged lines hidden --- |