diff options
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r-- | include/linux/nfs_fs.h | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 9f84c8a5ea43..55de0770df4a 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -462,37 +462,8 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page) | |||
462 | /* | 462 | /* |
463 | * Allocate and free nfs_write_data structures | 463 | * Allocate and free nfs_write_data structures |
464 | */ | 464 | */ |
465 | extern mempool_t *nfs_wdata_mempool; | 465 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); |
466 | 466 | extern void nfs_writedata_free(struct nfs_write_data *p); | |
467 | static inline struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) | ||
468 | { | ||
469 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); | ||
470 | |||
471 | if (p) { | ||
472 | memset(p, 0, sizeof(*p)); | ||
473 | INIT_LIST_HEAD(&p->pages); | ||
474 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
475 | p->pagevec = &p->page_array[0]; | ||
476 | else { | ||
477 | size_t size = ++pagecount * sizeof(struct page *); | ||
478 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
479 | if (p->pagevec) { | ||
480 | memset(p->pagevec, 0, size); | ||
481 | } else { | ||
482 | mempool_free(p, nfs_wdata_mempool); | ||
483 | p = NULL; | ||
484 | } | ||
485 | } | ||
486 | } | ||
487 | return p; | ||
488 | } | ||
489 | |||
490 | static inline void nfs_writedata_free(struct nfs_write_data *p) | ||
491 | { | ||
492 | if (p && (p->pagevec != &p->page_array[0])) | ||
493 | kfree(p->pagevec); | ||
494 | mempool_free(p, nfs_wdata_mempool); | ||
495 | } | ||
496 | 467 | ||
497 | /* | 468 | /* |
498 | * linux/fs/nfs/read.c | 469 | * linux/fs/nfs/read.c |
@@ -503,41 +474,11 @@ extern int nfs_readpages(struct file *, struct address_space *, | |||
503 | extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); | 474 | extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); |
504 | extern void nfs_readdata_release(void *data); | 475 | extern void nfs_readdata_release(void *data); |
505 | 476 | ||
506 | |||
507 | /* | 477 | /* |
508 | * Allocate and free nfs_read_data structures | 478 | * Allocate and free nfs_read_data structures |
509 | */ | 479 | */ |
510 | extern mempool_t *nfs_rdata_mempool; | 480 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); |
511 | 481 | extern void nfs_readdata_free(struct nfs_read_data *p); | |
512 | static inline struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) | ||
513 | { | ||
514 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); | ||
515 | |||
516 | if (p) { | ||
517 | memset(p, 0, sizeof(*p)); | ||
518 | INIT_LIST_HEAD(&p->pages); | ||
519 | if (pagecount < NFS_PAGEVEC_SIZE) | ||
520 | p->pagevec = &p->page_array[0]; | ||
521 | else { | ||
522 | size_t size = ++pagecount * sizeof(struct page *); | ||
523 | p->pagevec = kmalloc(size, GFP_NOFS); | ||
524 | if (p->pagevec) { | ||
525 | memset(p->pagevec, 0, size); | ||
526 | } else { | ||
527 | mempool_free(p, nfs_rdata_mempool); | ||
528 | p = NULL; | ||
529 | } | ||
530 | } | ||
531 | } | ||
532 | return p; | ||
533 | } | ||
534 | |||
535 | static inline void nfs_readdata_free(struct nfs_read_data *p) | ||
536 | { | ||
537 | if (p && (p->pagevec != &p->page_array[0])) | ||
538 | kfree(p->pagevec); | ||
539 | mempool_free(p, nfs_rdata_mempool); | ||
540 | } | ||
541 | 482 | ||
542 | /* | 483 | /* |
543 | * linux/fs/nfs3proc.c | 484 | * linux/fs/nfs3proc.c |