aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_fs.h
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:37 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:37 -0500
commit3feb2d49394b7874348a6e43c076b780c1d222c5 (patch)
tree6d27d4170fd9435574bd804033793f9d0d69a355 /include/linux/nfs_fs.h
parent5db3a7b2cabe8f0957683f798c4f8fa8605f9ebb (diff)
NFS: Uninline nfs_writedata_(alloc|free) and nfs_readdata_(alloc|free)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r--include/linux/nfs_fs.h67
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 */
465extern mempool_t *nfs_wdata_mempool; 465extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount);
466 466extern void nfs_writedata_free(struct nfs_write_data *p);
467static 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
490static 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 *,
503extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *); 474extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
504extern void nfs_readdata_release(void *data); 475extern 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 */
510extern mempool_t *nfs_rdata_mempool; 480extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount);
511 481extern void nfs_readdata_free(struct nfs_read_data *p);
512static 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
535static 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