[RFC 10/12] nfs: Split up generic_pg_pgios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pnfs will need a way to use a different function to initiate IO and to
free the pgio_header.  The common function now expects a function
pointer for each.

Signed-off-by: Anna Schumaker <Anna.Schumaker@xxxxxxxxxx>
---
 fs/nfs/internal.h |  4 ++++
 fs/nfs/pagelist.c | 24 +++++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 5b64177..3a5abf0 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -242,6 +242,10 @@ struct nfs_pgio_header *nfs_pgio_header_alloc(const struct nfs_rw_ops *);
 void nfs_pgio_header_free(struct nfs_pgio_header *);
 int nfs_generic_pgio(struct nfs_pageio_descriptor *, struct nfs_pgio_header *);
 void nfs_generic_pgio_reset(struct nfs_pgio_header *);
+int nfs_generic_pgios_common(struct nfs_pageio_descriptor *,
+			     void (*)(struct nfs_pgio_header *),
+			     int (*)(struct nfs_pageio_descriptor *,
+				     struct nfs_pgio_header *));
 int nfs_initiate_pgio(struct rpc_clnt *, struct nfs_pgio_header *,
 		      const struct rpc_call_ops *, int, int);
 
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index d1670a2..fc01c5b 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -722,8 +722,18 @@ void nfs_generic_pgio_reset(struct nfs_pgio_header *hdr)
 }
 EXPORT_SYMBOL_GPL(nfs_generic_pgio_reset);
 
+static int nfs_do_pgio(struct nfs_pageio_descriptor *desc,
+		       struct nfs_pgio_header *hdr)
+{
+	return nfs_initiate_pgio(NFS_CLIENT(hdr->inode),
+				 hdr, desc->pg_rpc_callops,
+				 desc->pg_ioflags, 0);
+}
 
-static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc)
+int nfs_generic_pgios_common(struct nfs_pageio_descriptor *desc,
+			     void (*free_header)(struct nfs_pgio_header *),
+			     int (*do_pgio)(struct nfs_pageio_descriptor *,
+					    struct nfs_pgio_header *))
 {
 	struct nfs_pgio_header *hdr;
 	int ret;
@@ -733,14 +743,18 @@ static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc)
 		desc->pg_completion_ops->error_cleanup(&desc->pg_list);
 		return -ENOMEM;
 	}
-	nfs_pgheader_init(desc, hdr, nfs_pgio_header_free);
+	nfs_pgheader_init(desc, hdr, free_header);
 	ret = nfs_generic_pgio(desc, hdr);
 	if (ret == 0)
-		ret = nfs_initiate_pgio(NFS_CLIENT(hdr->inode),
-					hdr, desc->pg_rpc_callops,
-					desc->pg_ioflags, 0);
+		ret = do_pgio(desc, hdr);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(nfs_generic_pgios_common);
+
+static int nfs_generic_pg_pgios(struct nfs_pageio_descriptor *desc)
+{
+	return nfs_generic_pgios_common(desc, nfs_pgio_header_free, nfs_do_pgio);
+}
 
 static bool nfs_match_open_context(const struct nfs_open_context *ctx1,
 		const struct nfs_open_context *ctx2)
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux