diff options
author | Fred Isaman <iisaman@netapp.com> | 2011-03-03 10:13:48 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-03-11 15:38:44 -0500 |
commit | c76069bda0f17cd3e153e54d9ac01242909c6b15 (patch) | |
tree | b21a8844fdcfbda430cda191c84597393398e461 /fs/nfs/read.c | |
parent | a69aef1496726ed88386dad65abfcc8cd3195304 (diff) |
NFSv4.1: rearrange ->doio args
This will make it possible to clear the lseg pointer in the same
function as it is put, instead of in the caller nfs_pageio_doio().
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r-- | fs/nfs/read.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index f40c7f4dc16b..ab9c7768b7c6 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -31,8 +31,8 @@ | |||
31 | 31 | ||
32 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE | 32 | #define NFSDBG_FACILITY NFSDBG_PAGECACHE |
33 | 33 | ||
34 | static int nfs_pagein_multi(struct inode *, struct list_head *, unsigned int, size_t, int, struct pnfs_layout_segment *); | 34 | static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc); |
35 | static int nfs_pagein_one(struct inode *, struct list_head *, unsigned int, size_t, int, struct pnfs_layout_segment *); | 35 | static int nfs_pagein_one(struct nfs_pageio_descriptor *desc); |
36 | static const struct rpc_call_ops nfs_read_partial_ops; | 36 | static const struct rpc_call_ops nfs_read_partial_ops; |
37 | static const struct rpc_call_ops nfs_read_full_ops; | 37 | static const struct rpc_call_ops nfs_read_full_ops; |
38 | 38 | ||
@@ -117,9 +117,9 @@ static void nfs_readpage_truncate_uninitialised_page(struct nfs_read_data *data) | |||
117 | int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, | 117 | int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, |
118 | struct page *page) | 118 | struct page *page) |
119 | { | 119 | { |
120 | LIST_HEAD(one_request); | ||
121 | struct nfs_page *new; | 120 | struct nfs_page *new; |
122 | unsigned int len; | 121 | unsigned int len; |
122 | struct nfs_pageio_descriptor pgio; | ||
123 | 123 | ||
124 | len = nfs_page_length(page); | 124 | len = nfs_page_length(page); |
125 | if (len == 0) | 125 | if (len == 0) |
@@ -132,11 +132,14 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, | |||
132 | if (len < PAGE_CACHE_SIZE) | 132 | if (len < PAGE_CACHE_SIZE) |
133 | zero_user_segment(page, len, PAGE_CACHE_SIZE); | 133 | zero_user_segment(page, len, PAGE_CACHE_SIZE); |
134 | 134 | ||
135 | nfs_list_add_request(new, &one_request); | 135 | nfs_pageio_init(&pgio, inode, NULL, 0, 0); |
136 | nfs_list_add_request(new, &pgio.pg_list); | ||
137 | pgio.pg_count = len; | ||
138 | |||
136 | if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE) | 139 | if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE) |
137 | nfs_pagein_multi(inode, &one_request, 1, len, 0, NULL); | 140 | nfs_pagein_multi(&pgio); |
138 | else | 141 | else |
139 | nfs_pagein_one(inode, &one_request, 1, len, 0, NULL); | 142 | nfs_pagein_one(&pgio); |
140 | return 0; | 143 | return 0; |
141 | } | 144 | } |
142 | 145 | ||
@@ -258,20 +261,21 @@ nfs_async_read_error(struct list_head *head) | |||
258 | * won't see the new data until our attribute cache is updated. This is more | 261 | * won't see the new data until our attribute cache is updated. This is more |
259 | * or less conventional NFS client behavior. | 262 | * or less conventional NFS client behavior. |
260 | */ | 263 | */ |
261 | static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags, struct pnfs_layout_segment *lseg) | 264 | static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc) |
262 | { | 265 | { |
263 | struct nfs_page *req = nfs_list_entry(head->next); | 266 | struct nfs_page *req = nfs_list_entry(desc->pg_list.next); |
264 | struct page *page = req->wb_page; | 267 | struct page *page = req->wb_page; |
265 | struct nfs_read_data *data; | 268 | struct nfs_read_data *data; |
266 | size_t rsize = NFS_SERVER(inode)->rsize, nbytes; | 269 | size_t rsize = NFS_SERVER(desc->pg_inode)->rsize, nbytes; |
267 | unsigned int offset; | 270 | unsigned int offset; |
268 | int requests = 0; | 271 | int requests = 0; |
269 | int ret = 0; | 272 | int ret = 0; |
273 | struct pnfs_layout_segment *lseg; | ||
270 | LIST_HEAD(list); | 274 | LIST_HEAD(list); |
271 | 275 | ||
272 | nfs_list_remove_request(req); | 276 | nfs_list_remove_request(req); |
273 | 277 | ||
274 | nbytes = count; | 278 | nbytes = desc->pg_count; |
275 | do { | 279 | do { |
276 | size_t len = min(nbytes,rsize); | 280 | size_t len = min(nbytes,rsize); |
277 | 281 | ||
@@ -284,11 +288,11 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne | |||
284 | } while(nbytes != 0); | 288 | } while(nbytes != 0); |
285 | atomic_set(&req->wb_complete, requests); | 289 | atomic_set(&req->wb_complete, requests); |
286 | 290 | ||
287 | /* We know lseg==NULL */ | 291 | BUG_ON(desc->pg_lseg != NULL); |
288 | lseg = pnfs_update_layout(inode, req->wb_context, IOMODE_READ); | 292 | lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_READ); |
289 | ClearPageError(page); | 293 | ClearPageError(page); |
290 | offset = 0; | 294 | offset = 0; |
291 | nbytes = count; | 295 | nbytes = desc->pg_count; |
292 | do { | 296 | do { |
293 | int ret2; | 297 | int ret2; |
294 | 298 | ||
@@ -321,14 +325,17 @@ out_bad: | |||
321 | return -ENOMEM; | 325 | return -ENOMEM; |
322 | } | 326 | } |
323 | 327 | ||
324 | static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags, struct pnfs_layout_segment *lseg) | 328 | static int nfs_pagein_one(struct nfs_pageio_descriptor *desc) |
325 | { | 329 | { |
326 | struct nfs_page *req; | 330 | struct nfs_page *req; |
327 | struct page **pages; | 331 | struct page **pages; |
328 | struct nfs_read_data *data; | 332 | struct nfs_read_data *data; |
333 | struct list_head *head = &desc->pg_list; | ||
334 | struct pnfs_layout_segment *lseg = desc->pg_lseg; | ||
329 | int ret = -ENOMEM; | 335 | int ret = -ENOMEM; |
330 | 336 | ||
331 | data = nfs_readdata_alloc(npages); | 337 | data = nfs_readdata_alloc(nfs_page_array_len(desc->pg_base, |
338 | desc->pg_count)); | ||
332 | if (!data) { | 339 | if (!data) { |
333 | nfs_async_read_error(head); | 340 | nfs_async_read_error(head); |
334 | goto out; | 341 | goto out; |
@@ -344,9 +351,10 @@ static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned | |||
344 | } | 351 | } |
345 | req = nfs_list_entry(data->pages.next); | 352 | req = nfs_list_entry(data->pages.next); |
346 | if ((!lseg) && list_is_singular(&data->pages)) | 353 | if ((!lseg) && list_is_singular(&data->pages)) |
347 | lseg = pnfs_update_layout(inode, req->wb_context, IOMODE_READ); | 354 | lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, IOMODE_READ); |
348 | 355 | ||
349 | ret = nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0, lseg); | 356 | ret = nfs_read_rpcsetup(req, data, &nfs_read_full_ops, desc->pg_count, |
357 | 0, lseg); | ||
350 | out: | 358 | out: |
351 | put_lseg(lseg); | 359 | put_lseg(lseg); |
352 | return ret; | 360 | return ret; |