aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@netapp.com>2014-05-06 09:12:33 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-28 18:40:43 -0400
commit6f92fa4581f1c26562f80dc686b3c9ea76556911 (patch)
tree5b6fcffb14d1738f235b01ffa2cf53b9e858faa9 /fs/nfs
parent0eecb2145c1ce18e36617008424a93836ad0a3bd (diff)
NFS: Create a common rpc_call_ops struct
The read and write paths set up this struct in exactly the same way, so create a single shared struct. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/internal.h4
-rw-r--r--fs/nfs/pagelist.c11
-rw-r--r--fs/nfs/read.c11
-rw-r--r--fs/nfs/write.c11
4 files changed, 13 insertions, 24 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 7c0ae364bdad..e34220f10165 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -237,13 +237,11 @@ extern void nfs_pgheader_init(struct nfs_pageio_descriptor *desc,
237void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos); 237void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos);
238int nfs_iocounter_wait(struct nfs_io_counter *c); 238int nfs_iocounter_wait(struct nfs_io_counter *c);
239 239
240extern const struct rpc_call_ops nfs_pgio_common_ops;
240struct nfs_rw_header *nfs_rw_header_alloc(const struct nfs_rw_ops *); 241struct nfs_rw_header *nfs_rw_header_alloc(const struct nfs_rw_ops *);
241void nfs_rw_header_free(struct nfs_pgio_header *); 242void nfs_rw_header_free(struct nfs_pgio_header *);
242struct nfs_pgio_data *nfs_pgio_data_alloc(struct nfs_pgio_header *, unsigned int); 243struct nfs_pgio_data *nfs_pgio_data_alloc(struct nfs_pgio_header *, unsigned int);
243void nfs_pgio_data_release(struct nfs_pgio_data *); 244void nfs_pgio_data_release(struct nfs_pgio_data *);
244void nfs_pgio_prepare(struct rpc_task *, void *);
245void nfs_pgio_release(void *);
246void nfs_pgio_result(struct rpc_task *, void *);
247 245
248static inline void nfs_iocounter_init(struct nfs_io_counter *c) 246static inline void nfs_iocounter_init(struct nfs_io_counter *c)
249{ 247{
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index f74df87058b6..aabff78dc6e5 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -393,7 +393,7 @@ EXPORT_SYMBOL_GPL(nfs_pgio_data_release);
393 * @task: The current task 393 * @task: The current task
394 * @calldata: pageio data to prepare 394 * @calldata: pageio data to prepare
395 */ 395 */
396void nfs_pgio_prepare(struct rpc_task *task, void *calldata) 396static void nfs_pgio_prepare(struct rpc_task *task, void *calldata)
397{ 397{
398 struct nfs_pgio_data *data = calldata; 398 struct nfs_pgio_data *data = calldata;
399 int err; 399 int err;
@@ -406,7 +406,7 @@ void nfs_pgio_prepare(struct rpc_task *task, void *calldata)
406 * nfs_pgio_release - Release pageio data 406 * nfs_pgio_release - Release pageio data
407 * @calldata: The pageio data to release 407 * @calldata: The pageio data to release
408 */ 408 */
409void nfs_pgio_release(void *calldata) 409static void nfs_pgio_release(void *calldata)
410{ 410{
411 struct nfs_pgio_data *data = calldata; 411 struct nfs_pgio_data *data = calldata;
412 if (data->header->rw_ops->rw_release) 412 if (data->header->rw_ops->rw_release)
@@ -454,7 +454,7 @@ EXPORT_SYMBOL_GPL(nfs_pageio_init);
454 * @task: The task that ran 454 * @task: The task that ran
455 * @calldata: Pageio data to check 455 * @calldata: Pageio data to check
456 */ 456 */
457void nfs_pgio_result(struct rpc_task *task, void *calldata) 457static void nfs_pgio_result(struct rpc_task *task, void *calldata)
458{ 458{
459 struct nfs_pgio_data *data = calldata; 459 struct nfs_pgio_data *data = calldata;
460 struct inode *inode = data->header->inode; 460 struct inode *inode = data->header->inode;
@@ -677,3 +677,8 @@ void nfs_destroy_nfspagecache(void)
677 kmem_cache_destroy(nfs_page_cachep); 677 kmem_cache_destroy(nfs_page_cachep);
678} 678}
679 679
680const struct rpc_call_ops nfs_pgio_common_ops = {
681 .rpc_call_prepare = nfs_pgio_prepare,
682 .rpc_call_done = nfs_pgio_result,
683 .rpc_release = nfs_pgio_release,
684};
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index bc78bd248eb8..a33490c0899f 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -29,7 +29,6 @@
29#define NFSDBG_FACILITY NFSDBG_PAGECACHE 29#define NFSDBG_FACILITY NFSDBG_PAGECACHE
30 30
31static const struct nfs_pageio_ops nfs_pageio_read_ops; 31static const struct nfs_pageio_ops nfs_pageio_read_ops;
32static const struct rpc_call_ops nfs_read_common_ops;
33static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops; 32static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops;
34static const struct nfs_rw_ops nfs_rw_read_ops; 33static const struct nfs_rw_ops nfs_rw_read_ops;
35 34
@@ -314,7 +313,7 @@ static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc,
314 313
315 nfs_list_remove_request(req); 314 nfs_list_remove_request(req);
316 nfs_list_add_request(req, &hdr->pages); 315 nfs_list_add_request(req, &hdr->pages);
317 desc->pg_rpc_callops = &nfs_read_common_ops; 316 desc->pg_rpc_callops = &nfs_pgio_common_ops;
318 return 0; 317 return 0;
319} 318}
320 319
@@ -343,7 +342,7 @@ static int nfs_pagein_one(struct nfs_pageio_descriptor *desc,
343 342
344 nfs_read_rpcsetup(data, desc->pg_count, 0); 343 nfs_read_rpcsetup(data, desc->pg_count, 0);
345 list_add(&data->list, &hdr->rpc_list); 344 list_add(&data->list, &hdr->rpc_list);
346 desc->pg_rpc_callops = &nfs_read_common_ops; 345 desc->pg_rpc_callops = &nfs_pgio_common_ops;
347 return 0; 346 return 0;
348} 347}
349 348
@@ -443,12 +442,6 @@ static void nfs_readpage_result(struct rpc_task *task, struct nfs_pgio_data *dat
443 nfs_readpage_retry(task, data); 442 nfs_readpage_retry(task, data);
444} 443}
445 444
446static const struct rpc_call_ops nfs_read_common_ops = {
447 .rpc_call_prepare = nfs_pgio_prepare,
448 .rpc_call_done = nfs_pgio_result,
449 .rpc_release = nfs_pgio_release,
450};
451
452/* 445/*
453 * Read a page over NFS. 446 * Read a page over NFS.
454 * We read the page synchronously in the following case: 447 * We read the page synchronously in the following case:
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 1d3e1d75c8c5..d877f15fb31a 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -42,7 +42,6 @@
42 * Local function declarations 42 * Local function declarations
43 */ 43 */
44static void nfs_redirty_request(struct nfs_page *req); 44static void nfs_redirty_request(struct nfs_page *req);
45static const struct rpc_call_ops nfs_write_common_ops;
46static const struct rpc_call_ops nfs_commit_ops; 45static const struct rpc_call_ops nfs_commit_ops;
47static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops; 46static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops;
48static const struct nfs_commit_completion_ops nfs_commit_completion_ops; 47static const struct nfs_commit_completion_ops nfs_commit_completion_ops;
@@ -1138,7 +1137,7 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc,
1138 } while (nbytes != 0); 1137 } while (nbytes != 0);
1139 nfs_list_remove_request(req); 1138 nfs_list_remove_request(req);
1140 nfs_list_add_request(req, &hdr->pages); 1139 nfs_list_add_request(req, &hdr->pages);
1141 desc->pg_rpc_callops = &nfs_write_common_ops; 1140 desc->pg_rpc_callops = &nfs_pgio_common_ops;
1142 return 0; 1141 return 0;
1143} 1142}
1144 1143
@@ -1182,7 +1181,7 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc,
1182 /* Set up the argument struct */ 1181 /* Set up the argument struct */
1183 nfs_write_rpcsetup(data, desc->pg_count, 0, desc->pg_ioflags, &cinfo); 1182 nfs_write_rpcsetup(data, desc->pg_count, 0, desc->pg_ioflags, &cinfo);
1184 list_add(&data->list, &hdr->rpc_list); 1183 list_add(&data->list, &hdr->rpc_list);
1185 desc->pg_rpc_callops = &nfs_write_common_ops; 1184 desc->pg_rpc_callops = &nfs_pgio_common_ops;
1186 return 0; 1185 return 0;
1187} 1186}
1188 1187
@@ -1272,12 +1271,6 @@ static void nfs_writeback_release_common(struct nfs_pgio_data *data)
1272 } 1271 }
1273} 1272}
1274 1273
1275static const struct rpc_call_ops nfs_write_common_ops = {
1276 .rpc_call_prepare = nfs_pgio_prepare,
1277 .rpc_call_done = nfs_pgio_result,
1278 .rpc_release = nfs_pgio_release,
1279};
1280
1281/* 1274/*
1282 * Special version of should_remove_suid() that ignores capabilities. 1275 * Special version of should_remove_suid() that ignores capabilities.
1283 */ 1276 */