diff options
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r-- | include/linux/nfs_fs.h | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 4dff705d2ff2..d38010ba6477 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) |
@@ -462,18 +459,33 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page) | |||
462 | */ | 459 | */ |
463 | extern mempool_t *nfs_wdata_mempool; | 460 | extern mempool_t *nfs_wdata_mempool; |
464 | 461 | ||
465 | static inline struct nfs_write_data *nfs_writedata_alloc(void) | 462 | static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) |
466 | { | 463 | { |
467 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); | 464 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); |
465 | |||
468 | if (p) { | 466 | if (p) { |
469 | memset(p, 0, sizeof(*p)); | 467 | memset(p, 0, sizeof(*p)); |
470 | INIT_LIST_HEAD(&p->pages); | 468 | INIT_LIST_HEAD(&p->pages); |
469 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
470 | p->pagevec = &p->page_array[0]; | ||
471 | else { | ||
472 | size_t size = ++pagecount * sizeof(struct page *); | ||
473 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
474 | if (p->pagevec) { | ||
475 | memset(p->pagevec, 0, size); | ||
476 | } else { | ||
477 | mempool_free(p, nfs_wdata_mempool); | ||
478 | p = NULL; | ||
479 | } | ||
480 | } | ||
471 | } | 481 | } |
472 | return p; | 482 | return p; |
473 | } | 483 | } |
474 | 484 | ||
475 | static inline void nfs_writedata_free(struct nfs_write_data *p) | 485 | static inline void nfs_writedata_free(struct nfs_write_data *p) |
476 | { | 486 | { |
487 | if (p && (p->pagevec != &p->page_array[0])) | ||
488 | kfree(p->pagevec); | ||
477 | mempool_free(p, nfs_wdata_mempool); | 489 | mempool_free(p, nfs_wdata_mempool); |
478 | } | 490 | } |
479 | 491 | ||
@@ -492,16 +504,33 @@ extern void nfs_readdata_release(void *data); | |||
492 | */ | 504 | */ |
493 | extern mempool_t *nfs_rdata_mempool; | 505 | extern mempool_t *nfs_rdata_mempool; |
494 | 506 | ||
495 | static inline struct nfs_read_data *nfs_readdata_alloc(void) | 507 | static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) |
496 | { | 508 | { |
497 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); | 509 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); |
498 | if (p) | 510 | |
511 | if (p) { | ||
499 | memset(p, 0, sizeof(*p)); | 512 | memset(p, 0, sizeof(*p)); |
513 | INIT_LIST_HEAD(&p->pages); | ||
514 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
515 | p->pagevec = &p->page_array[0]; | ||
516 | else { | ||
517 | size_t size = ++pagecount * sizeof(struct page *); | ||
518 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
519 | if (p->pagevec) { | ||
520 | memset(p->pagevec, 0, size); | ||
521 | } else { | ||
522 | mempool_free(p, nfs_rdata_mempool); | ||
523 | p = NULL; | ||
524 | } | ||
525 | } | ||
526 | } | ||
500 | return p; | 527 | return p; |
501 | } | 528 | } |
502 | 529 | ||
503 | static inline void nfs_readdata_free(struct nfs_read_data *p) | 530 | static inline void nfs_readdata_free(struct nfs_read_data *p) |
504 | { | 531 | { |
532 | if (p && (p->pagevec != &p->page_array[0])) | ||
533 | kfree(p->pagevec); | ||
505 | mempool_free(p, nfs_rdata_mempool); | 534 | mempool_free(p, nfs_rdata_mempool); |
506 | } | 535 | } |
507 | 536 | ||