diff options
author | Christoph Hellwig <hch@lst.de> | 2014-04-16 09:07:22 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-28 17:50:08 -0400 |
commit | fab5fc25d230edcc8ee72367e505955a2fae0cac (patch) | |
tree | ea5d0df777acfeef50068c4b031bb9417be9743f | |
parent | a20c93e3160e37ecccc738d8eef085c8507949ed (diff) |
nfs: remove ->read_pageio_init from rpc ops
The read_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_read 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.c | 2 | ||||
-rw-r--r-- | fs/nfs/internal.h | 2 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 15 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 9 | ||||
-rw-r--r-- | fs/nfs/proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/read.c | 19 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 2 |
9 files changed, 17 insertions, 35 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 6a31102b0819..bbe688e2cc89 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -424,7 +424,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | |||
424 | size_t requested_bytes = 0; | 424 | size_t requested_bytes = 0; |
425 | unsigned long seg; | 425 | unsigned long seg; |
426 | 426 | ||
427 | NFS_PROTO(dreq->inode)->read_pageio_init(&desc, dreq->inode, | 427 | nfs_pageio_init_read(&desc, dreq->inode, false, |
428 | &nfs_direct_read_completion_ops); | 428 | &nfs_direct_read_completion_ops); |
429 | get_dreq(dreq); | 429 | get_dreq(dreq); |
430 | desc.pg_dreq = dreq; | 430 | desc.pg_dreq = dreq; |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 8431083de179..98fe618db2aa 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -398,7 +398,7 @@ struct nfs_pgio_completion_ops; | |||
398 | extern struct nfs_read_header *nfs_readhdr_alloc(void); | 398 | extern struct nfs_read_header *nfs_readhdr_alloc(void); |
399 | extern void nfs_readhdr_free(struct nfs_pgio_header *hdr); | 399 | extern void nfs_readhdr_free(struct nfs_pgio_header *hdr); |
400 | extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, | 400 | extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, |
401 | struct inode *inode, | 401 | struct inode *inode, bool force_mds, |
402 | const struct nfs_pgio_completion_ops *compl_ops); | 402 | const struct nfs_pgio_completion_ops *compl_ops); |
403 | extern int nfs_initiate_read(struct rpc_clnt *clnt, | 403 | extern int nfs_initiate_read(struct rpc_clnt *clnt, |
404 | struct nfs_read_data *data, | 404 | struct nfs_read_data *data, |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index e98488053906..d873241a9b3a 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -947,7 +947,6 @@ const struct nfs_rpc_ops nfs_v3_clientops = { | |||
947 | .pathconf = nfs3_proc_pathconf, | 947 | .pathconf = nfs3_proc_pathconf, |
948 | .decode_dirent = nfs3_decode_dirent, | 948 | .decode_dirent = nfs3_decode_dirent, |
949 | .read_setup = nfs3_proc_read_setup, | 949 | .read_setup = nfs3_proc_read_setup, |
950 | .read_pageio_init = nfs_pageio_init_read, | ||
951 | .read_rpc_prepare = nfs3_proc_read_rpc_prepare, | 950 | .read_rpc_prepare = nfs3_proc_read_rpc_prepare, |
952 | .read_done = nfs3_read_done, | 951 | .read_done = nfs3_read_done, |
953 | .write_setup = nfs3_proc_write_setup, | 952 | .write_setup = nfs3_proc_write_setup, |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 8da0c62966b5..21cd1f2ee35a 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -8433,7 +8433,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = { | |||
8433 | .set_capabilities = nfs4_server_capabilities, | 8433 | .set_capabilities = nfs4_server_capabilities, |
8434 | .decode_dirent = nfs4_decode_dirent, | 8434 | .decode_dirent = nfs4_decode_dirent, |
8435 | .read_setup = nfs4_proc_read_setup, | 8435 | .read_setup = nfs4_proc_read_setup, |
8436 | .read_pageio_init = pnfs_pageio_init_read, | ||
8437 | .read_rpc_prepare = nfs4_proc_read_rpc_prepare, | 8436 | .read_rpc_prepare = nfs4_proc_read_rpc_prepare, |
8438 | .read_done = nfs4_read_done, | 8437 | .read_done = nfs4_read_done, |
8439 | .write_setup = nfs4_proc_write_setup, | 8438 | .write_setup = nfs4_proc_write_setup, |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 9edac9f01c2a..3d5bc2baafd1 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1434,19 +1434,6 @@ pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, | |||
1434 | } | 1434 | } |
1435 | EXPORT_SYMBOL_GPL(pnfs_generic_pg_init_write); | 1435 | EXPORT_SYMBOL_GPL(pnfs_generic_pg_init_write); |
1436 | 1436 | ||
1437 | void | ||
1438 | pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct inode *inode, | ||
1439 | const struct nfs_pgio_completion_ops *compl_ops) | ||
1440 | { | ||
1441 | struct nfs_server *server = NFS_SERVER(inode); | ||
1442 | struct pnfs_layoutdriver_type *ld = server->pnfs_curr_ld; | ||
1443 | |||
1444 | if (ld == NULL) | ||
1445 | nfs_pageio_init_read(pgio, inode, compl_ops); | ||
1446 | else | ||
1447 | nfs_pageio_init(pgio, inode, ld->pg_read_ops, compl_ops, server->rsize, 0); | ||
1448 | } | ||
1449 | |||
1450 | bool | 1437 | bool |
1451 | pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, | 1438 | pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, |
1452 | struct nfs_page *req) | 1439 | struct nfs_page *req) |
@@ -1641,7 +1628,7 @@ int pnfs_read_done_resend_to_mds(struct inode *inode, | |||
1641 | LIST_HEAD(failed); | 1628 | LIST_HEAD(failed); |
1642 | 1629 | ||
1643 | /* Resend all requests through the MDS */ | 1630 | /* Resend all requests through the MDS */ |
1644 | nfs_pageio_init_read(&pgio, inode, compl_ops); | 1631 | nfs_pageio_init_read(&pgio, inode, true, compl_ops); |
1645 | pgio.pg_dreq = dreq; | 1632 | pgio.pg_dreq = dreq; |
1646 | while (!list_empty(head)) { | 1633 | while (!list_empty(head)) { |
1647 | struct nfs_page *req = nfs_list_entry(head->next); | 1634 | struct nfs_page *req = nfs_list_entry(head->next); |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index e9ac8fbaee3d..94a9a1834b3f 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -180,9 +180,6 @@ extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp); | |||
180 | void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo); | 180 | void pnfs_get_layout_hdr(struct pnfs_layout_hdr *lo); |
181 | void pnfs_put_lseg(struct pnfs_layout_segment *lseg); | 181 | void pnfs_put_lseg(struct pnfs_layout_segment *lseg); |
182 | 182 | ||
183 | void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *, | ||
184 | const struct nfs_pgio_completion_ops *); | ||
185 | |||
186 | void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); | 183 | void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, u32); |
187 | void unset_pnfs_layoutdriver(struct nfs_server *); | 184 | void unset_pnfs_layoutdriver(struct nfs_server *); |
188 | void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *); | 185 | void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *); |
@@ -459,12 +456,6 @@ static inline void unset_pnfs_layoutdriver(struct nfs_server *s) | |||
459 | { | 456 | { |
460 | } | 457 | } |
461 | 458 | ||
462 | static inline void pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct inode *inode, | ||
463 | const struct nfs_pgio_completion_ops *compl_ops) | ||
464 | { | ||
465 | nfs_pageio_init_read(pgio, inode, compl_ops); | ||
466 | } | ||
467 | |||
468 | static inline int | 459 | static inline int |
469 | pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how, | 460 | pnfs_commit_list(struct inode *inode, struct list_head *mds_pages, int how, |
470 | struct nfs_commit_info *cinfo) | 461 | struct nfs_commit_info *cinfo) |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index f9cc29590a18..8cc227fcd4d2 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -735,7 +735,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
735 | .pathconf = nfs_proc_pathconf, | 735 | .pathconf = nfs_proc_pathconf, |
736 | .decode_dirent = nfs2_decode_dirent, | 736 | .decode_dirent = nfs2_decode_dirent, |
737 | .read_setup = nfs_proc_read_setup, | 737 | .read_setup = nfs_proc_read_setup, |
738 | .read_pageio_init = nfs_pageio_init_read, | ||
739 | .read_rpc_prepare = nfs_proc_read_rpc_prepare, | 738 | .read_rpc_prepare = nfs_proc_read_rpc_prepare, |
740 | .read_done = nfs_read_done, | 739 | .read_done = nfs_read_done, |
741 | .write_setup = nfs_proc_write_setup, | 740 | .write_setup = nfs_proc_write_setup, |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 411aedda14bb..7f87461be3a9 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #include "iostat.h" | 25 | #include "iostat.h" |
26 | #include "fscache.h" | 26 | #include "fscache.h" |
27 | #include "pnfs.h" | ||
27 | 28 | ||
28 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE | 29 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE |
29 | 30 | ||
@@ -114,11 +115,17 @@ int nfs_return_empty_page(struct page *page) | |||
114 | } | 115 | } |
115 | 116 | ||
116 | void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, | 117 | void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, |
117 | struct inode *inode, | 118 | struct inode *inode, bool force_mds, |
118 | const struct nfs_pgio_completion_ops *compl_ops) | 119 | const struct nfs_pgio_completion_ops *compl_ops) |
119 | { | 120 | { |
120 | nfs_pageio_init(pgio, inode, &nfs_pageio_read_ops, compl_ops, | 121 | struct nfs_server *server = NFS_SERVER(inode); |
121 | NFS_SERVER(inode)->rsize, 0); | 122 | const struct nfs_pageio_ops *pg_ops = &nfs_pageio_read_ops; |
123 | |||
124 | #ifdef CONFIG_NFS_V4_1 | ||
125 | if (server->pnfs_curr_ld && !force_mds) | ||
126 | pg_ops = server->pnfs_curr_ld->pg_read_ops; | ||
127 | #endif | ||
128 | nfs_pageio_init(pgio, inode, pg_ops, compl_ops, server->rsize, 0); | ||
122 | } | 129 | } |
123 | EXPORT_SYMBOL_GPL(nfs_pageio_init_read); | 130 | EXPORT_SYMBOL_GPL(nfs_pageio_init_read); |
124 | 131 | ||
@@ -147,7 +154,8 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, | |||
147 | if (len < PAGE_CACHE_SIZE) | 154 | if (len < PAGE_CACHE_SIZE) |
148 | zero_user_segment(page, len, PAGE_CACHE_SIZE); | 155 | zero_user_segment(page, len, PAGE_CACHE_SIZE); |
149 | 156 | ||
150 | NFS_PROTO(inode)->read_pageio_init(&pgio, inode, &nfs_async_read_completion_ops); | 157 | nfs_pageio_init_read(&pgio, inode, false, |
158 | &nfs_async_read_completion_ops); | ||
151 | nfs_pageio_add_request(&pgio, new); | 159 | nfs_pageio_add_request(&pgio, new); |
152 | nfs_pageio_complete(&pgio); | 160 | nfs_pageio_complete(&pgio); |
153 | NFS_I(inode)->read_io += pgio.pg_bytes_written; | 161 | NFS_I(inode)->read_io += pgio.pg_bytes_written; |
@@ -654,7 +662,8 @@ int nfs_readpages(struct file *filp, struct address_space *mapping, | |||
654 | if (ret == 0) | 662 | if (ret == 0) |
655 | goto read_complete; /* all pages were read */ | 663 | goto read_complete; /* all pages were read */ |
656 | 664 | ||
657 | NFS_PROTO(inode)->read_pageio_init(&pgio, inode, &nfs_async_read_completion_ops); | 665 | nfs_pageio_init_read(&pgio, inode, false, |
666 | &nfs_async_read_completion_ops); | ||
658 | 667 | ||
659 | ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc); | 668 | ret = read_cache_pages(mapping, pages, readpage_async_filler, &desc); |
660 | 669 | ||
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 78216f859527..3e8fc1fe585b 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1466,8 +1466,6 @@ struct nfs_rpc_ops { | |||
1466 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); | 1466 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); |
1467 | int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); | 1467 | int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); |
1468 | void (*read_setup) (struct nfs_read_data *, struct rpc_message *); | 1468 | void (*read_setup) (struct nfs_read_data *, struct rpc_message *); |
1469 | void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, | ||
1470 | const struct nfs_pgio_completion_ops *); | ||
1471 | int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); | 1469 | int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); |
1472 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); | 1470 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); |
1473 | void (*write_setup) (struct nfs_write_data *, struct rpc_message *); | 1471 | void (*write_setup) (struct nfs_write_data *, struct rpc_message *); |