diff options
Diffstat (limited to 'fs/nfs/pnfs.h')
-rw-r--r-- | fs/nfs/pnfs.h | 127 |
1 files changed, 99 insertions, 28 deletions
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 442ebf68eeec..29fd23c0efdc 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -63,6 +63,7 @@ enum { | |||
63 | NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ | 63 | NFS_LAYOUT_BULK_RECALL, /* bulk recall affecting layout */ |
64 | NFS_LAYOUT_ROC, /* some lseg had roc bit set */ | 64 | NFS_LAYOUT_ROC, /* some lseg had roc bit set */ |
65 | NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */ | 65 | NFS_LAYOUT_DESTROYED, /* no new use of layout allowed */ |
66 | NFS_LAYOUT_INVALID, /* layout is being destroyed */ | ||
66 | }; | 67 | }; |
67 | 68 | ||
68 | enum layoutdriver_policy_flags { | 69 | enum layoutdriver_policy_flags { |
@@ -94,11 +95,20 @@ struct pnfs_layoutdriver_type { | |||
94 | const struct nfs_pageio_ops *pg_read_ops; | 95 | const struct nfs_pageio_ops *pg_read_ops; |
95 | const struct nfs_pageio_ops *pg_write_ops; | 96 | const struct nfs_pageio_ops *pg_write_ops; |
96 | 97 | ||
98 | struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode); | ||
97 | void (*mark_request_commit) (struct nfs_page *req, | 99 | void (*mark_request_commit) (struct nfs_page *req, |
98 | struct pnfs_layout_segment *lseg); | 100 | struct pnfs_layout_segment *lseg, |
99 | void (*clear_request_commit) (struct nfs_page *req); | 101 | struct nfs_commit_info *cinfo); |
100 | int (*scan_commit_lists) (struct inode *inode, int max, spinlock_t *lock); | 102 | void (*clear_request_commit) (struct nfs_page *req, |
101 | int (*commit_pagelist)(struct inode *inode, struct list_head *mds_pages, int how); | 103 | struct nfs_commit_info *cinfo); |
104 | int (*scan_commit_lists) (struct nfs_commit_info *cinfo, | ||
105 | int max); | ||
106 | void (*recover_commit_reqs) (struct list_head *list, | ||
107 | struct nfs_commit_info *cinfo); | ||
108 | int (*commit_pagelist)(struct inode *inode, | ||
109 | struct list_head *mds_pages, | ||
110 | int how, | ||
111 | struct nfs_commit_info *cinfo); | ||
102 | 112 | ||
103 | /* | 113 | /* |
104 | * Return PNFS_ATTEMPTED to indicate the layout code has attempted | 114 | * Return PNFS_ATTEMPTED to indicate the layout code has attempted |
@@ -168,8 +178,10 @@ extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); | |||
168 | void get_layout_hdr(struct pnfs_layout_hdr *lo); | 178 | void get_layout_hdr(struct pnfs_layout_hdr *lo); |
169 | void put_lseg(struct pnfs_layout_segment *lseg); | 179 | void put_lseg(struct pnfs_layout_segment *lseg); |
170 | 180 | ||
171 | bool pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *); | 181 | bool pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *, |
172 | bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *, int); | 182 | const struct nfs_pgio_completion_ops *); |
183 | bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *, | ||
184 | int, const struct nfs_pgio_completion_ops *); | ||
173 | 185 | ||
174 | void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); | 186 | void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); |
175 | void unset_pnfs_layoutdriver(struct nfs_server *); | 187 | void unset_pnfs_layoutdriver(struct nfs_server *); |
@@ -211,6 +223,11 @@ struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, | |||
211 | gfp_t gfp_flags); | 223 | gfp_t gfp_flags); |
212 | 224 | ||
213 | void nfs4_deviceid_mark_client_invalid(struct nfs_client *clp); | 225 | void nfs4_deviceid_mark_client_invalid(struct nfs_client *clp); |
226 | int pnfs_read_done_resend_to_mds(struct inode *inode, struct list_head *head, | ||
227 | const struct nfs_pgio_completion_ops *compl_ops); | ||
228 | int pnfs_write_done_resend_to_mds(struct inode *inode, struct list_head *head, | ||
229 | const struct nfs_pgio_completion_ops *compl_ops); | ||
230 | struct nfs4_threshold *pnfs_mdsthreshold_alloc(void); | ||
214 | 231 | ||
215 | /* nfs4_deviceid_flags */ | 232 | /* nfs4_deviceid_flags */ |
216 | enum { | 233 | enum { |
@@ -261,49 +278,66 @@ static inline int pnfs_enabled_sb(struct nfs_server *nfss) | |||
261 | } | 278 | } |
262 | 279 | ||
263 | static inline int | 280 | static inline int |
264 | pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how) | 281 | pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how, |
282 | struct nfs_commit_info *cinfo) | ||
265 | { | 283 | { |
266 | if (!test_and_clear_bit(NFS_INO_PNFS_COMMIT, &NFS_I(inode)->flags)) | 284 | if (cinfo->ds == NULL || cinfo->ds->ncommitting == 0) |
267 | return PNFS_NOT_ATTEMPTED; | 285 | return PNFS_NOT_ATTEMPTED; |
268 | return NFS_SERVER(inode)->pnfs_curr_ld->commit_pagelist(inode, mds_pages, how); | 286 | return NFS_SERVER(inode)->pnfs_curr_ld->commit_pagelist(inode, mds_pages, how, cinfo); |
287 | } | ||
288 | |||
289 | static inline struct pnfs_ds_commit_info * | ||
290 | pnfs_get_ds_info(struct inode *inode) | ||
291 | { | ||
292 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; | ||
293 | |||
294 | if (ld == NULL || ld->get_ds_info == NULL) | ||
295 | return NULL; | ||
296 | return ld->get_ds_info(inode); | ||
269 | } | 297 | } |
270 | 298 | ||
271 | static inline bool | 299 | static inline bool |
272 | pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg) | 300 | pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, |
301 | struct nfs_commit_info *cinfo) | ||
273 | { | 302 | { |
274 | struct inode *inode = req->wb_context->dentry->d_inode; | 303 | struct inode *inode = req->wb_context->dentry->d_inode; |
275 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; | 304 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; |
276 | 305 | ||
277 | if (lseg == NULL || ld->mark_request_commit == NULL) | 306 | if (lseg == NULL || ld->mark_request_commit == NULL) |
278 | return false; | 307 | return false; |
279 | ld->mark_request_commit(req, lseg); | 308 | ld->mark_request_commit(req, lseg, cinfo); |
280 | return true; | 309 | return true; |
281 | } | 310 | } |
282 | 311 | ||
283 | static inline bool | 312 | static inline bool |
284 | pnfs_clear_request_commit(struct nfs_page *req) | 313 | pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo) |
285 | { | 314 | { |
286 | struct inode *inode = req->wb_context->dentry->d_inode; | 315 | struct inode *inode = req->wb_context->dentry->d_inode; |
287 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; | 316 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; |
288 | 317 | ||
289 | if (ld == NULL || ld->clear_request_commit == NULL) | 318 | if (ld == NULL || ld->clear_request_commit == NULL) |
290 | return false; | 319 | return false; |
291 | ld->clear_request_commit(req); | 320 | ld->clear_request_commit(req, cinfo); |
292 | return true; | 321 | return true; |
293 | } | 322 | } |
294 | 323 | ||
295 | static inline int | 324 | static inline int |
296 | pnfs_scan_commit_lists(struct inode *inode, int max, spinlock_t *lock) | 325 | pnfs_scan_commit_lists(struct inode *inode, struct nfs_commit_info *cinfo, |
326 | int max) | ||
297 | { | 327 | { |
298 | struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; | 328 | if (cinfo->ds == NULL || cinfo->ds->nwritten == 0) |
299 | int ret; | ||
300 | |||
301 | if (ld == NULL || ld->scan_commit_lists == NULL) | ||
302 | return 0; | 329 | return 0; |
303 | ret = ld->scan_commit_lists(inode, max, lock); | 330 | else |
304 | if (ret != 0) | 331 | return NFS_SERVER(inode)->pnfs_curr_ld->scan_commit_lists(cinfo, max); |
305 | set_bit(NFS_INO_PNFS_COMMIT, &NFS_I(inode)->flags); | 332 | } |
306 | return ret; | 333 | |
334 | static inline void | ||
335 | pnfs_recover_commit_reqs(struct inode *inode, struct list_head *list, | ||
336 | struct nfs_commit_info *cinfo) | ||
337 | { | ||
338 | if (cinfo->ds == NULL || cinfo->ds->nwritten == 0) | ||
339 | return; | ||
340 | NFS_SERVER(inode)->pnfs_curr_ld->recover_commit_reqs(list, cinfo); | ||
307 | } | 341 | } |
308 | 342 | ||
309 | /* Should the pNFS client commit and return the layout upon a setattr */ | 343 | /* Should the pNFS client commit and return the layout upon a setattr */ |
@@ -327,6 +361,14 @@ static inline int pnfs_return_layout(struct inode *ino) | |||
327 | return 0; | 361 | return 0; |
328 | } | 362 | } |
329 | 363 | ||
364 | static inline bool | ||
365 | pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src, | ||
366 | struct nfs_server *nfss) | ||
367 | { | ||
368 | return (dst && src && src->bm != 0 && | ||
369 | nfss->pnfs_curr_ld->id == src->l_type); | ||
370 | } | ||
371 | |||
330 | #ifdef NFS_DEBUG | 372 | #ifdef NFS_DEBUG |
331 | void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id); | 373 | void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id); |
332 | #else | 374 | #else |
@@ -396,45 +438,74 @@ static inline void unset_pnfs_layoutdriver(struct nfs_server *s) | |||
396 | { | 438 | { |
397 | } | 439 | } |
398 | 440 | ||
399 | static inline bool pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct inode *inode) | 441 | static inline bool pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct inode *inode, |
442 | const struct nfs_pgio_completion_ops *compl_ops) | ||
400 | { | 443 | { |
401 | return false; | 444 | return false; |
402 | } | 445 | } |
403 | 446 | ||
404 | static inline bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode, int ioflags) | 447 | static inline bool pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode, int ioflags, |
448 | const struct nfs_pgio_completion_ops *compl_ops) | ||
405 | { | 449 | { |
406 | return false; | 450 | return false; |
407 | } | 451 | } |
408 | 452 | ||
409 | static inline int | 453 | static inline int |
410 | pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how) | 454 | pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how, |
455 | struct nfs_commit_info *cinfo) | ||
411 | { | 456 | { |
412 | return PNFS_NOT_ATTEMPTED; | 457 | return PNFS_NOT_ATTEMPTED; |
413 | } | 458 | } |
414 | 459 | ||
460 | static inline struct pnfs_ds_commit_info * | ||
461 | pnfs_get_ds_info(struct inode *inode) | ||
462 | { | ||
463 | return NULL; | ||
464 | } | ||
465 | |||
415 | static inline bool | 466 | static inline bool |
416 | pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg) | 467 | pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, |
468 | struct nfs_commit_info *cinfo) | ||
417 | { | 469 | { |
418 | return false; | 470 | return false; |
419 | } | 471 | } |
420 | 472 | ||
421 | static inline bool | 473 | static inline bool |
422 | pnfs_clear_request_commit(struct nfs_page *req) | 474 | pnfs_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo) |
423 | { | 475 | { |
424 | return false; | 476 | return false; |
425 | } | 477 | } |
426 | 478 | ||
427 | static inline int | 479 | static inline int |
428 | pnfs_scan_commit_lists(struct inode *inode, int max, spinlock_t *lock) | 480 | pnfs_scan_commit_lists(struct inode *inode, struct nfs_commit_info *cinfo, |
481 | int max) | ||
429 | { | 482 | { |
430 | return 0; | 483 | return 0; |
431 | } | 484 | } |
432 | 485 | ||
486 | static inline void | ||
487 | pnfs_recover_commit_reqs(struct inode *inode, struct list_head *list, | ||
488 | struct nfs_commit_info *cinfo) | ||
489 | { | ||
490 | } | ||
491 | |||
433 | static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync) | 492 | static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync) |
434 | { | 493 | { |
435 | return 0; | 494 | return 0; |
436 | } | 495 | } |
437 | 496 | ||
497 | static inline bool | ||
498 | pnfs_use_threshold(struct nfs4_threshold **dst, struct nfs4_threshold *src, | ||
499 | struct nfs_server *nfss) | ||
500 | { | ||
501 | return false; | ||
502 | } | ||
503 | |||
504 | static inline struct nfs4_threshold *pnfs_mdsthreshold_alloc(void) | ||
505 | { | ||
506 | return NULL; | ||
507 | } | ||
508 | |||
438 | #endif /* CONFIG_NFS_V4_1 */ | 509 | #endif /* CONFIG_NFS_V4_1 */ |
439 | 510 | ||
440 | #endif /* FS_NFS_PNFS_H */ | 511 | #endif /* FS_NFS_PNFS_H */ |