aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-04-16 09:07:21 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-28 17:48:38 -0400
commita20c93e3160e37ecccc738d8eef085c8507949ed (patch)
tree22f179b47930f42ae8e1a8ac12d70f1aeee1b071
parent1b33809ea8c671ccbceeaaa8d842631b441bed54 (diff)
nfs: remove ->write_pageio_init from rpc ops
The write_pageio_init method is just a very convoluted way to grab the right nfs_pageio_ops vector. The vector to chose is not a choice of protocol version, but just a pNFS vs MDS I/O choice that can simply be done inside nfs_pageio_init_write based on the presence of a layout driver, and a new force_mds flag to the special case of falling back to MDS I/O on a pNFS-capable volume. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/direct.c4
-rw-r--r--fs/nfs/internal.h2
-rw-r--r--fs/nfs/nfs3proc.c1
-rw-r--r--fs/nfs/nfs4proc.c1
-rw-r--r--fs/nfs/pnfs.c16
-rw-r--r--fs/nfs/pnfs.h8
-rw-r--r--fs/nfs/proc.c1
-rw-r--r--fs/nfs/write.c21
-rw-r--r--include/linux/nfs_xdr.h2
9 files changed, 17 insertions, 39 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index b8797ae6831f..6a31102b0819 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -564,7 +564,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
564 dreq->count = 0; 564 dreq->count = 0;
565 get_dreq(dreq); 565 get_dreq(dreq);
566 566
567 NFS_PROTO(dreq->inode)->write_pageio_init(&desc, dreq->inode, FLUSH_STABLE, 567 nfs_pageio_init_write(&desc, dreq->inode, FLUSH_STABLE, false,
568 &nfs_direct_write_completion_ops); 568 &nfs_direct_write_completion_ops);
569 desc.pg_dreq = dreq; 569 desc.pg_dreq = dreq;
570 570
@@ -874,7 +874,7 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
874 size_t requested_bytes = 0; 874 size_t requested_bytes = 0;
875 unsigned long seg; 875 unsigned long seg;
876 876
877 NFS_PROTO(inode)->write_pageio_init(&desc, inode, FLUSH_COND_STABLE, 877 nfs_pageio_init_write(&desc, inode, FLUSH_COND_STABLE, false,
878 &nfs_direct_write_completion_ops); 878 &nfs_direct_write_completion_ops);
879 desc.pg_dreq = dreq; 879 desc.pg_dreq = dreq;
880 get_dreq(dreq); 880 get_dreq(dreq);
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index dd8bfc2e2464..8431083de179 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -422,7 +422,7 @@ int nfs_remount(struct super_block *sb, int *flags, char *raw_data);
422 422
423/* write.c */ 423/* write.c */
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, 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_write_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);
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index db60149c4579..e98488053906 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -951,7 +951,6 @@ const struct nfs_rpc_ops nfs_v3_clientops = {
951 .read_rpc_prepare = nfs3_proc_read_rpc_prepare, 951 .read_rpc_prepare = nfs3_proc_read_rpc_prepare,
952 .read_done = nfs3_read_done, 952 .read_done = nfs3_read_done,
953 .write_setup = nfs3_proc_write_setup, 953 .write_setup = nfs3_proc_write_setup,
954 .write_pageio_init = nfs_pageio_init_write,
955 .write_rpc_prepare = nfs3_proc_write_rpc_prepare, 954 .write_rpc_prepare = nfs3_proc_write_rpc_prepare,
956 .write_done = nfs3_write_done, 955 .write_done = nfs3_write_done,
957 .commit_setup = nfs3_proc_commit_setup, 956 .commit_setup = nfs3_proc_commit_setup,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 397be39c6dc8..8da0c62966b5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -8437,7 +8437,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
8437 .read_rpc_prepare = nfs4_proc_read_rpc_prepare, 8437 .read_rpc_prepare = nfs4_proc_read_rpc_prepare,
8438 .read_done = nfs4_read_done, 8438 .read_done = nfs4_read_done,
8439 .write_setup = nfs4_proc_write_setup, 8439 .write_setup = nfs4_proc_write_setup,
8440 .write_pageio_init = pnfs_pageio_init_write,
8441 .write_rpc_prepare = nfs4_proc_write_rpc_prepare, 8440 .write_rpc_prepare = nfs4_proc_write_rpc_prepare,
8442 .write_done = nfs4_write_done, 8441 .write_done = nfs4_write_done,
8443 .commit_setup = nfs4_proc_commit_setup, 8442 .commit_setup = nfs4_proc_commit_setup,
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index cb53d450ae32..9edac9f01c2a 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1447,20 +1447,6 @@ pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct inode *inode,
1447 nfs_pageio_init(pgio, inode, ld->pg_read_ops, compl_ops, server->rsize, 0); 1447 nfs_pageio_init(pgio, inode, ld->pg_read_ops, compl_ops, server->rsize, 0);
1448} 1448}
1449 1449
1450void
1451pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode,
1452 int ioflags,
1453 const struct nfs_pgio_completion_ops *compl_ops)
1454{
1455 struct nfs_server *server = NFS_SERVER(inode);
1456 struct pnfs_layoutdriver_type *ld = server->pnfs_curr_ld;
1457
1458 if (ld == NULL)
1459 nfs_pageio_init_write(pgio, inode, ioflags, compl_ops);
1460 else
1461 nfs_pageio_init(pgio, inode, ld->pg_write_ops, compl_ops, server->wsize, ioflags);
1462}
1463
1464bool 1450bool
1465pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, 1451pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
1466 struct nfs_page *req) 1452 struct nfs_page *req)
@@ -1496,7 +1482,7 @@ int pnfs_write_done_resend_to_mds(struct inode *inode,
1496 LIST_HEAD(failed); 1482 LIST_HEAD(failed);
1497 1483
1498 /* Resend all requests through the MDS */ 1484 /* Resend all requests through the MDS */
1499 nfs_pageio_init_write(&pgio, inode, FLUSH_STABLE, compl_ops); 1485 nfs_pageio_init_write(&pgio, inode, FLUSH_STABLE, true, compl_ops);
1500 pgio.pg_dreq = dreq; 1486 pgio.pg_dreq = dreq;
1501 while (!list_empty(head)) { 1487 while (!list_empty(head)) {
1502 struct nfs_page *req = nfs_list_entry(head->next); 1488 struct nfs_page *req = nfs_list_entry(head->next);
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 023793909778..e9ac8fbaee3d 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -182,8 +182,6 @@ void pnfs_put_lseg(struct pnfs_layout_segment *lseg);
182 182
183void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *, 183void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *,
184 const struct nfs_pgio_completion_ops *); 184 const struct nfs_pgio_completion_ops *);
185void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *,
186 int, const struct nfs_pgio_completion_ops *);
187 185
188void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); 186void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32);
189void unset_pnfs_layoutdriver(struct nfs_server *); 187void unset_pnfs_layoutdriver(struct nfs_server *);
@@ -467,12 +465,6 @@ static inline void pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, str
467 nfs_pageio_init_read(pgio, inode, compl_ops); 465 nfs_pageio_init_read(pgio, inode, compl_ops);
468} 466}
469 467
470static inline void pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode, int ioflags,
471 const struct nfs_pgio_completion_ops *compl_ops)
472{
473 nfs_pageio_init_write(pgio, inode, ioflags, compl_ops);
474}
475
476static inline int 468static inline int
477pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how, 469pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how,
478 struct nfs_commit_info *cinfo) 470 struct nfs_commit_info *cinfo)
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index e55ce9e8b034..f9cc29590a18 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -739,7 +739,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
739 .read_rpc_prepare = nfs_proc_read_rpc_prepare, 739 .read_rpc_prepare = nfs_proc_read_rpc_prepare,
740 .read_done = nfs_read_done, 740 .read_done = nfs_read_done,
741 .write_setup = nfs_proc_write_setup, 741 .write_setup = nfs_proc_write_setup,
742 .write_pageio_init = nfs_pageio_init_write,
743 .write_rpc_prepare = nfs_proc_write_rpc_prepare, 742 .write_rpc_prepare = nfs_proc_write_rpc_prepare,
744 .write_done = nfs_write_done, 743 .write_done = nfs_write_done,
745 .commit_setup = nfs_proc_commit_setup, 744 .commit_setup = nfs_proc_commit_setup,
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index cd7c651f9b84..ee6d46fde76c 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -354,10 +354,8 @@ static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc
354 struct nfs_pageio_descriptor pgio; 354 struct nfs_pageio_descriptor pgio;
355 int err; 355 int err;
356 356
357 NFS_PROTO(page_file_mapping(page)->host)->write_pageio_init(&pgio, 357 nfs_pageio_init_write(&pgio, page->mapping->host, wb_priority(wbc),
358 page->mapping->host, 358 false, &nfs_async_write_completion_ops);
359 wb_priority(wbc),
360 &nfs_async_write_completion_ops);
361 err = nfs_do_writepage(page, wbc, &pgio); 359 err = nfs_do_writepage(page, wbc, &pgio);
362 nfs_pageio_complete(&pgio); 360 nfs_pageio_complete(&pgio);
363 if (err < 0) 361 if (err < 0)
@@ -400,7 +398,8 @@ int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
400 398
401 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES); 399 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGES);
402 400
403 NFS_PROTO(inode)->write_pageio_init(&pgio, inode, wb_priority(wbc), &nfs_async_write_completion_ops); 401 nfs_pageio_init_write(&pgio, inode, wb_priority(wbc), false,
402 &nfs_async_write_completion_ops);
404 err = write_cache_pages(mapping, wbc, nfs_writepages_callback, &pgio); 403 err = write_cache_pages(mapping, wbc, nfs_writepages_callback, &pgio);
405 nfs_pageio_complete(&pgio); 404 nfs_pageio_complete(&pgio);
406 405
@@ -1282,11 +1281,17 @@ static const struct nfs_pageio_ops nfs_pageio_write_ops = {
1282}; 1281};
1283 1282
1284void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, 1283void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
1285 struct inode *inode, int ioflags, 1284 struct inode *inode, int ioflags, bool force_mds,
1286 const struct nfs_pgio_completion_ops *compl_ops) 1285 const struct nfs_pgio_completion_ops *compl_ops)
1287{ 1286{
1288 nfs_pageio_init(pgio, inode, &nfs_pageio_write_ops, compl_ops, 1287 struct nfs_server *server = NFS_SERVER(inode);
1289 NFS_SERVER(inode)->wsize, ioflags); 1288 const struct nfs_pageio_ops *pg_ops = &nfs_pageio_write_ops;
1289
1290#ifdef CONFIG_NFS_V4_1
1291 if (server->pnfs_curr_ld && !force_mds)
1292 pg_ops = server->pnfs_curr_ld->pg_write_ops;
1293#endif
1294 nfs_pageio_init(pgio, inode, pg_ops, compl_ops, server->wsize, ioflags);
1290} 1295}
1291EXPORT_SYMBOL_GPL(nfs_pageio_init_write); 1296EXPORT_SYMBOL_GPL(nfs_pageio_init_write);
1292 1297
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6fb5b2335b59..78216f859527 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1471,8 +1471,6 @@ struct nfs_rpc_ops {
1471 int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); 1471 int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
1472 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1472 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1473 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1473 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1474 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
1475 const struct nfs_pgio_completion_ops *);
1476 int (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *); 1474 int (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1477 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 1475 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1478 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1476 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);