diff options
author | Anna Schumaker <Anna.Schumaker@netapp.com> | 2014-05-06 15:12:39 +0200 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-29 17:11:41 +0200 |
commit | cf485fcd68bc2dd91258e844ba4649404fff3235 (patch) | |
tree | bd96e9d04ca73644770ae95d06c05d1a49fb3c08 /fs/nfs/pagelist.c | |
parent | NFS: Create a common multiple_pgios() function (diff) | |
download | linux-cf485fcd68bc2dd91258e844ba4649404fff3235.tar.xz linux-cf485fcd68bc2dd91258e844ba4649404fff3235.zip |
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: } EXPORT_SYMBOL_GPL(nfs_initiate_pgio); -int nfs_do_multiple_pgios(struct list_head *head, +static int nfs_do_multiple_pgios(struct list_head *head, const struct rpc_call_ops *call_ops, int how) { @@ -688,6 +688,30 @@ static int nfs_pgio_one(struct nfs_pageio_descriptor *desc, return 0; } +int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc) +{ + struct nfs_rw_header *rw_hdr; + struct nfs_pgio_header *hdr; + int ret; + + rw_hdr = nfs_rw_header_alloc(desc->pg_rw_ops); + if (!rw_hdr) { + desc->pg_completion_ops->error_cleanup(&desc->pg_list); + return -ENOMEM; + } + hdr = &rw_hdr->header; + nfs_pgheader_init(desc, hdr, nfs_rw_header_free); + atomic_inc(&hdr->refcnt); + ret = nfs_generic_pgio(desc, hdr); + if (ret == 0) + ret = nfs_do_multiple_pgios(&hdr->rpc_list, + desc->pg_rpc_callops, + desc->pg_ioflags); + if (atomic_dec_and_test(&hdr->refcnt)) + hdr->completion_ops->completion(hdr); + return ret; +} + int nfs_generic_pgio(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) { |