diff options
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r-- | include/linux/nfs_fs.h | 65 |
1 files changed, 54 insertions, 11 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 2516adeccecf..547d649b274e 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -38,9 +38,6 @@ | |||
38 | # define NFS_DEBUG | 38 | # define NFS_DEBUG |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #define NFS_MAX_FILE_IO_BUFFER_SIZE 32768 | ||
42 | #define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 | ||
43 | |||
44 | /* Default timeout values */ | 41 | /* Default timeout values */ |
45 | #define NFS_MAX_UDP_TIMEOUT (60*HZ) | 42 | #define NFS_MAX_UDP_TIMEOUT (60*HZ) |
46 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) | 43 | #define NFS_MAX_TCP_TIMEOUT (600*HZ) |
@@ -65,6 +62,7 @@ | |||
65 | #define FLUSH_STABLE 4 /* commit to stable storage */ | 62 | #define FLUSH_STABLE 4 /* commit to stable storage */ |
66 | #define FLUSH_LOWPRI 8 /* low priority background flush */ | 63 | #define FLUSH_LOWPRI 8 /* low priority background flush */ |
67 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ | 64 | #define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ |
65 | #define FLUSH_NOCOMMIT 32 /* Don't send the NFSv3/v4 COMMIT */ | ||
68 | 66 | ||
69 | #ifdef __KERNEL__ | 67 | #ifdef __KERNEL__ |
70 | 68 | ||
@@ -394,6 +392,17 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_ | |||
394 | extern struct inode_operations nfs_symlink_inode_operations; | 392 | extern struct inode_operations nfs_symlink_inode_operations; |
395 | 393 | ||
396 | /* | 394 | /* |
395 | * linux/fs/nfs/sysctl.c | ||
396 | */ | ||
397 | #ifdef CONFIG_SYSCTL | ||
398 | extern int nfs_register_sysctl(void); | ||
399 | extern void nfs_unregister_sysctl(void); | ||
400 | #else | ||
401 | #define nfs_register_sysctl() do { } while(0) | ||
402 | #define nfs_unregister_sysctl() do { } while(0) | ||
403 | #endif | ||
404 | |||
405 | /* | ||
397 | * linux/fs/nfs/unlink.c | 406 | * linux/fs/nfs/unlink.c |
398 | */ | 407 | */ |
399 | extern int nfs_async_unlink(struct dentry *); | 408 | extern int nfs_async_unlink(struct dentry *); |
@@ -406,10 +415,12 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc); | |||
406 | extern int nfs_writepages(struct address_space *, struct writeback_control *); | 415 | extern int nfs_writepages(struct address_space *, struct writeback_control *); |
407 | extern int nfs_flush_incompatible(struct file *file, struct page *page); | 416 | extern int nfs_flush_incompatible(struct file *file, struct page *page); |
408 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); | 417 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); |
409 | extern void nfs_writeback_done(struct rpc_task *task); | 418 | extern void nfs_writeback_done(struct rpc_task *task, void *data); |
419 | extern void nfs_writedata_release(void *data); | ||
410 | 420 | ||
411 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 421 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
412 | extern void nfs_commit_done(struct rpc_task *); | 422 | extern void nfs_commit_done(struct rpc_task *, void *data); |
423 | extern void nfs_commit_release(void *data); | ||
413 | #endif | 424 | #endif |
414 | 425 | ||
415 | /* | 426 | /* |
@@ -460,18 +471,33 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page) | |||
460 | */ | 471 | */ |
461 | extern mempool_t *nfs_wdata_mempool; | 472 | extern mempool_t *nfs_wdata_mempool; |
462 | 473 | ||
463 | static inline struct nfs_write_data *nfs_writedata_alloc(void) | 474 | static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) |
464 | { | 475 | { |
465 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); | 476 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); |
477 | |||
466 | if (p) { | 478 | if (p) { |
467 | memset(p, 0, sizeof(*p)); | 479 | memset(p, 0, sizeof(*p)); |
468 | INIT_LIST_HEAD(&p->pages); | 480 | INIT_LIST_HEAD(&p->pages); |
481 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
482 | p->pagevec = &p->page_array[0]; | ||
483 | else { | ||
484 | size_t size = ++pagecount * sizeof(struct page *); | ||
485 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
486 | if (p->pagevec) { | ||
487 | memset(p->pagevec, 0, size); | ||
488 | } else { | ||
489 | mempool_free(p, nfs_wdata_mempool); | ||
490 | p = NULL; | ||
491 | } | ||
492 | } | ||
469 | } | 493 | } |
470 | return p; | 494 | return p; |
471 | } | 495 | } |
472 | 496 | ||
473 | static inline void nfs_writedata_free(struct nfs_write_data *p) | 497 | static inline void nfs_writedata_free(struct nfs_write_data *p) |
474 | { | 498 | { |
499 | if (p && (p->pagevec != &p->page_array[0])) | ||
500 | kfree(p->pagevec); | ||
475 | mempool_free(p, nfs_wdata_mempool); | 501 | mempool_free(p, nfs_wdata_mempool); |
476 | } | 502 | } |
477 | 503 | ||
@@ -481,28 +507,45 @@ static inline void nfs_writedata_free(struct nfs_write_data *p) | |||
481 | extern int nfs_readpage(struct file *, struct page *); | 507 | extern int nfs_readpage(struct file *, struct page *); |
482 | extern int nfs_readpages(struct file *, struct address_space *, | 508 | extern int nfs_readpages(struct file *, struct address_space *, |
483 | struct list_head *, unsigned); | 509 | struct list_head *, unsigned); |
484 | extern void nfs_readpage_result(struct rpc_task *); | 510 | extern void nfs_readpage_result(struct rpc_task *, void *); |
511 | extern void nfs_readdata_release(void *data); | ||
512 | |||
485 | 513 | ||
486 | /* | 514 | /* |
487 | * Allocate and free nfs_read_data structures | 515 | * Allocate and free nfs_read_data structures |
488 | */ | 516 | */ |
489 | extern mempool_t *nfs_rdata_mempool; | 517 | extern mempool_t *nfs_rdata_mempool; |
490 | 518 | ||
491 | static inline struct nfs_read_data *nfs_readdata_alloc(void) | 519 | static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) |
492 | { | 520 | { |
493 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); | 521 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); |
494 | if (p) | 522 | |
523 | if (p) { | ||
495 | memset(p, 0, sizeof(*p)); | 524 | memset(p, 0, sizeof(*p)); |
525 | INIT_LIST_HEAD(&p->pages); | ||
526 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
527 | p->pagevec = &p->page_array[0]; | ||
528 | else { | ||
529 | size_t size = ++pagecount * sizeof(struct page *); | ||
530 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
531 | if (p->pagevec) { | ||
532 | memset(p->pagevec, 0, size); | ||
533 | } else { | ||
534 | mempool_free(p, nfs_rdata_mempool); | ||
535 | p = NULL; | ||
536 | } | ||
537 | } | ||
538 | } | ||
496 | return p; | 539 | return p; |
497 | } | 540 | } |
498 | 541 | ||
499 | static inline void nfs_readdata_free(struct nfs_read_data *p) | 542 | static inline void nfs_readdata_free(struct nfs_read_data *p) |
500 | { | 543 | { |
544 | if (p && (p->pagevec != &p->page_array[0])) | ||
545 | kfree(p->pagevec); | ||
501 | mempool_free(p, nfs_rdata_mempool); | 546 | mempool_free(p, nfs_rdata_mempool); |
502 | } | 547 | } |
503 | 548 | ||
504 | extern void nfs_readdata_release(struct rpc_task *task); | ||
505 | |||
506 | /* | 549 | /* |
507 | * linux/fs/nfs3proc.c | 550 | * linux/fs/nfs3proc.c |
508 | */ | 551 | */ |