aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@netapp.com>2014-05-06 09:12:27 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-28 18:12:55 -0400
commitc0752cdfbbb691cfe98812f7aed8ce1e766823c4 (patch)
tree895790bb4aaca50b0e632c6c13f61cf562a6d34b /fs
parent9c7e1b3d50b56b8d8f6237ed232350b7c6476cd5 (diff)
NFS: Create a common read and write header struct
The only difference is the write verifier field, but we can keep that for a little bit longer. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/internal.h4
-rw-r--r--fs/nfs/pnfs.c4
-rw-r--r--fs/nfs/read.c14
-rw-r--r--fs/nfs/write.c14
4 files changed, 18 insertions, 18 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index af01b80412dd..b0e7a41d14a8 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -395,7 +395,7 @@ extern int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh, bool
395 395
396struct nfs_pgio_completion_ops; 396struct nfs_pgio_completion_ops;
397/* read.c */ 397/* read.c */
398extern struct nfs_read_header *nfs_readhdr_alloc(void); 398extern struct nfs_rw_header *nfs_readhdr_alloc(void);
399extern void nfs_readhdr_free(struct nfs_pgio_header *hdr); 399extern void nfs_readhdr_free(struct nfs_pgio_header *hdr);
400extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, 400extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
401 struct inode *inode, bool force_mds, 401 struct inode *inode, bool force_mds,
@@ -424,7 +424,7 @@ int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
424extern void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, 424extern void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
425 struct inode *inode, int ioflags, bool force_mds, 425 struct inode *inode, int ioflags, bool force_mds,
426 const struct nfs_pgio_completion_ops *compl_ops); 426 const struct nfs_pgio_completion_ops *compl_ops);
427extern struct nfs_write_header *nfs_writehdr_alloc(void); 427extern struct nfs_rw_header *nfs_writehdr_alloc(void);
428extern void nfs_writehdr_free(struct nfs_pgio_header *hdr); 428extern void nfs_writehdr_free(struct nfs_pgio_header *hdr);
429extern int nfs_generic_flush(struct nfs_pageio_descriptor *desc, 429extern int nfs_generic_flush(struct nfs_pageio_descriptor *desc,
430 struct nfs_pgio_header *hdr); 430 struct nfs_pgio_header *hdr);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e9cea3ab7cf9..43cfe11aa1a4 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1592,7 +1592,7 @@ EXPORT_SYMBOL_GPL(pnfs_writehdr_free);
1592int 1592int
1593pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) 1593pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
1594{ 1594{
1595 struct nfs_write_header *whdr; 1595 struct nfs_rw_header *whdr;
1596 struct nfs_pgio_header *hdr; 1596 struct nfs_pgio_header *hdr;
1597 int ret; 1597 int ret;
1598 1598
@@ -1750,7 +1750,7 @@ EXPORT_SYMBOL_GPL(pnfs_readhdr_free);
1750int 1750int
1751pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) 1751pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
1752{ 1752{
1753 struct nfs_read_header *rhdr; 1753 struct nfs_rw_header *rhdr;
1754 struct nfs_pgio_header *hdr; 1754 struct nfs_pgio_header *hdr;
1755 int ret; 1755 int ret;
1756 1756
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 9e426cc179ed..d29ca3673694 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -34,9 +34,9 @@ static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;
34 34
35static struct kmem_cache *nfs_rdata_cachep; 35static struct kmem_cache *nfs_rdata_cachep;
36 36
37struct nfs_read_header *nfs_readhdr_alloc(void) 37struct nfs_rw_header *nfs_readhdr_alloc(void)
38{ 38{
39 struct nfs_read_header *rhdr; 39 struct nfs_rw_header *rhdr;
40 40
41 rhdr = kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL); 41 rhdr = kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL);
42 if (rhdr) { 42 if (rhdr) {
@@ -56,7 +56,7 @@ static struct nfs_pgio_data *nfs_readdata_alloc(struct nfs_pgio_header *hdr,
56{ 56{
57 struct nfs_pgio_data *data, *prealloc; 57 struct nfs_pgio_data *data, *prealloc;
58 58
59 prealloc = &container_of(hdr, struct nfs_read_header, header)->rpc_data; 59 prealloc = &container_of(hdr, struct nfs_rw_header, header)->rpc_data;
60 if (prealloc->header == NULL) 60 if (prealloc->header == NULL)
61 data = prealloc; 61 data = prealloc;
62 else 62 else
@@ -78,7 +78,7 @@ out:
78 78
79void nfs_readhdr_free(struct nfs_pgio_header *hdr) 79void nfs_readhdr_free(struct nfs_pgio_header *hdr)
80{ 80{
81 struct nfs_read_header *rhdr = container_of(hdr, struct nfs_read_header, header); 81 struct nfs_rw_header *rhdr = container_of(hdr, struct nfs_rw_header, header);
82 82
83 kmem_cache_free(nfs_rdata_cachep, rhdr); 83 kmem_cache_free(nfs_rdata_cachep, rhdr);
84} 84}
@@ -87,7 +87,7 @@ EXPORT_SYMBOL_GPL(nfs_readhdr_free);
87void nfs_readdata_release(struct nfs_pgio_data *rdata) 87void nfs_readdata_release(struct nfs_pgio_data *rdata)
88{ 88{
89 struct nfs_pgio_header *hdr = rdata->header; 89 struct nfs_pgio_header *hdr = rdata->header;
90 struct nfs_read_header *read_header = container_of(hdr, struct nfs_read_header, header); 90 struct nfs_rw_header *read_header = container_of(hdr, struct nfs_rw_header, header);
91 91
92 put_nfs_open_context(rdata->args.context); 92 put_nfs_open_context(rdata->args.context);
93 if (rdata->pages.pagevec != rdata->pages.page_array) 93 if (rdata->pages.pagevec != rdata->pages.page_array)
@@ -417,7 +417,7 @@ EXPORT_SYMBOL_GPL(nfs_generic_pagein);
417 417
418static int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) 418static int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
419{ 419{
420 struct nfs_read_header *rhdr; 420 struct nfs_rw_header *rhdr;
421 struct nfs_pgio_header *hdr; 421 struct nfs_pgio_header *hdr;
422 int ret; 422 int ret;
423 423
@@ -680,7 +680,7 @@ out:
680int __init nfs_init_readpagecache(void) 680int __init nfs_init_readpagecache(void)
681{ 681{
682 nfs_rdata_cachep = kmem_cache_create("nfs_read_data", 682 nfs_rdata_cachep = kmem_cache_create("nfs_read_data",
683 sizeof(struct nfs_read_header), 683 sizeof(struct nfs_rw_header),
684 0, SLAB_HWCACHE_ALIGN, 684 0, SLAB_HWCACHE_ALIGN,
685 NULL); 685 NULL);
686 if (nfs_rdata_cachep == NULL) 686 if (nfs_rdata_cachep == NULL)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 3a2fc5c4c79a..37c4c988519c 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -70,9 +70,9 @@ void nfs_commit_free(struct nfs_commit_data *p)
70} 70}
71EXPORT_SYMBOL_GPL(nfs_commit_free); 71EXPORT_SYMBOL_GPL(nfs_commit_free);
72 72
73struct nfs_write_header *nfs_writehdr_alloc(void) 73struct nfs_rw_header *nfs_writehdr_alloc(void)
74{ 74{
75 struct nfs_write_header *p = mempool_alloc(nfs_wdata_mempool, GFP_NOIO); 75 struct nfs_rw_header *p = mempool_alloc(nfs_wdata_mempool, GFP_NOIO);
76 76
77 if (p) { 77 if (p) {
78 struct nfs_pgio_header *hdr = &p->header; 78 struct nfs_pgio_header *hdr = &p->header;
@@ -93,7 +93,7 @@ static struct nfs_pgio_data *nfs_writedata_alloc(struct nfs_pgio_header *hdr,
93{ 93{
94 struct nfs_pgio_data *data, *prealloc; 94 struct nfs_pgio_data *data, *prealloc;
95 95
96 prealloc = &container_of(hdr, struct nfs_write_header, header)->rpc_data; 96 prealloc = &container_of(hdr, struct nfs_rw_header, header)->rpc_data;
97 if (prealloc->header == NULL) 97 if (prealloc->header == NULL)
98 data = prealloc; 98 data = prealloc;
99 else 99 else
@@ -115,7 +115,7 @@ out:
115 115
116void nfs_writehdr_free(struct nfs_pgio_header *hdr) 116void nfs_writehdr_free(struct nfs_pgio_header *hdr)
117{ 117{
118 struct nfs_write_header *whdr = container_of(hdr, struct nfs_write_header, header); 118 struct nfs_rw_header *whdr = container_of(hdr, struct nfs_rw_header, header);
119 mempool_free(whdr, nfs_wdata_mempool); 119 mempool_free(whdr, nfs_wdata_mempool);
120} 120}
121EXPORT_SYMBOL_GPL(nfs_writehdr_free); 121EXPORT_SYMBOL_GPL(nfs_writehdr_free);
@@ -123,7 +123,7 @@ EXPORT_SYMBOL_GPL(nfs_writehdr_free);
123void nfs_writedata_release(struct nfs_pgio_data *wdata) 123void nfs_writedata_release(struct nfs_pgio_data *wdata)
124{ 124{
125 struct nfs_pgio_header *hdr = wdata->header; 125 struct nfs_pgio_header *hdr = wdata->header;
126 struct nfs_write_header *write_header = container_of(hdr, struct nfs_write_header, header); 126 struct nfs_rw_header *write_header = container_of(hdr, struct nfs_rw_header, header);
127 127
128 put_nfs_open_context(wdata->args.context); 128 put_nfs_open_context(wdata->args.context);
129 if (wdata->pages.pagevec != wdata->pages.page_array) 129 if (wdata->pages.pagevec != wdata->pages.page_array)
@@ -1253,7 +1253,7 @@ EXPORT_SYMBOL_GPL(nfs_generic_flush);
1253 1253
1254static int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) 1254static int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
1255{ 1255{
1256 struct nfs_write_header *whdr; 1256 struct nfs_rw_header *whdr;
1257 struct nfs_pgio_header *hdr; 1257 struct nfs_pgio_header *hdr;
1258 int ret; 1258 int ret;
1259 1259
@@ -1910,7 +1910,7 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
1910int __init nfs_init_writepagecache(void) 1910int __init nfs_init_writepagecache(void)
1911{ 1911{
1912 nfs_wdata_cachep = kmem_cache_create("nfs_write_data", 1912 nfs_wdata_cachep = kmem_cache_create("nfs_write_data",
1913 sizeof(struct nfs_write_header), 1913 sizeof(struct nfs_rw_header),
1914 0, SLAB_HWCACHE_ALIGN, 1914 0, SLAB_HWCACHE_ALIGN,
1915 NULL); 1915 NULL);
1916 if (nfs_wdata_cachep == NULL) 1916 if (nfs_wdata_cachep == NULL)