diff options
author | Anna Schumaker <Anna.Schumaker@netapp.com> | 2014-05-06 09:12:39 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-29 11:11:41 -0400 |
commit | cf485fcd68bc2dd91258e844ba4649404fff3235 (patch) | |
tree | bd96e9d04ca73644770ae95d06c05d1a49fb3c08 /fs/nfs/pagelist.c | |
parent | c3766276f26090f4459329839cdcc8506dfbced5 (diff) |
NFS: Create a common generic_pg_pgios()
What we have here is two functions that look identical. Let's share
some more code!
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r-- | fs/nfs/pagelist.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 2471e0278811..83d4ab46a2e9 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -493,7 +493,7 @@ out: | |||
493 | } | 493 | } |
494 | EXPORT_SYMBOL_GPL(nfs_initiate_pgio); | 494 | EXPORT_SYMBOL_GPL(nfs_initiate_pgio); |
495 | 495 | ||
496 | int nfs_do_multiple_pgios(struct list_head *head, | 496 | static int nfs_do_multiple_pgios(struct list_head *head, |
497 | const struct rpc_call_ops *call_ops, | 497 | const struct rpc_call_ops *call_ops, |
498 | int how) | 498 | int how) |
499 | { | 499 | { |
@@ -688,6 +688,30 @@ static int nfs_pgio_one(struct nfs_pageio_descriptor *desc, | |||
688 | return 0; | 688 | return 0; |
689 | } | 689 | } |
690 | 690 | ||
691 | int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc) | ||
692 | { | ||
693 | struct nfs_rw_header *rw_hdr; | ||
694 | struct nfs_pgio_header *hdr; | ||
695 | int ret; | ||
696 | |||
697 | rw_hdr = nfs_rw_header_alloc(desc->pg_rw_ops); | ||
698 | if (!rw_hdr) { | ||
699 | desc->pg_completion_ops->error_cleanup(&desc->pg_list); | ||
700 | return -ENOMEM; | ||
701 | } | ||
702 | hdr = &rw_hdr->header; | ||
703 | nfs_pgheader_init(desc, hdr, nfs_rw_header_free); | ||
704 | atomic_inc(&hdr->refcnt); | ||
705 | ret = nfs_generic_pgio(desc, hdr); | ||
706 | if (ret == 0) | ||
707 | ret = nfs_do_multiple_pgios(&hdr->rpc_list, | ||
708 | desc->pg_rpc_callops, | ||
709 | desc->pg_ioflags); | ||
710 | if (atomic_dec_and_test(&hdr->refcnt)) | ||
711 | hdr->completion_ops->completion(hdr); | ||
712 | return ret; | ||
713 | } | ||
714 | |||
691 | int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, | 715 | int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, |
692 | struct nfs_pgio_header *hdr) | 716 | struct nfs_pgio_header *hdr) |
693 | { | 717 | { |