diff options
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.c | 11 | ||||
-rw-r--r-- | fs/nfs/direct.c | 40 | ||||
-rw-r--r-- | fs/nfs/internal.h | 1 | ||||
-rw-r--r-- | fs/nfs/pagelist.c | 13 | ||||
-rw-r--r-- | fs/nfs/read.c | 22 | ||||
-rw-r--r-- | fs/nfs/write.c | 22 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 14 |
7 files changed, 67 insertions, 56 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 7a482517f4c6..7ae8a608956f 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -242,7 +242,7 @@ bl_read_pagelist(struct nfs_read_data *rdata) | |||
242 | int pg_index = rdata->args.pgbase >> PAGE_CACHE_SHIFT; | 242 | int pg_index = rdata->args.pgbase >> PAGE_CACHE_SHIFT; |
243 | 243 | ||
244 | dprintk("%s enter nr_pages %u offset %lld count %u\n", __func__, | 244 | dprintk("%s enter nr_pages %u offset %lld count %u\n", __func__, |
245 | rdata->npages, f_offset, (unsigned int)rdata->args.count); | 245 | rdata->pages.npages, f_offset, (unsigned int)rdata->args.count); |
246 | 246 | ||
247 | par = alloc_parallel(rdata); | 247 | par = alloc_parallel(rdata); |
248 | if (!par) | 248 | if (!par) |
@@ -252,7 +252,7 @@ bl_read_pagelist(struct nfs_read_data *rdata) | |||
252 | 252 | ||
253 | isect = (sector_t) (f_offset >> SECTOR_SHIFT); | 253 | isect = (sector_t) (f_offset >> SECTOR_SHIFT); |
254 | /* Code assumes extents are page-aligned */ | 254 | /* Code assumes extents are page-aligned */ |
255 | for (i = pg_index; i < rdata->npages; i++) { | 255 | for (i = pg_index; i < rdata->pages.npages; i++) { |
256 | if (!extent_length) { | 256 | if (!extent_length) { |
257 | /* We've used up the previous extent */ | 257 | /* We've used up the previous extent */ |
258 | bl_put_extent(be); | 258 | bl_put_extent(be); |
@@ -285,7 +285,8 @@ bl_read_pagelist(struct nfs_read_data *rdata) | |||
285 | struct pnfs_block_extent *be_read; | 285 | struct pnfs_block_extent *be_read; |
286 | 286 | ||
287 | be_read = (hole && cow_read) ? cow_read : be; | 287 | be_read = (hole && cow_read) ? cow_read : be; |
288 | bio = bl_add_page_to_bio(bio, rdata->npages - i, READ, | 288 | bio = bl_add_page_to_bio(bio, rdata->pages.npages - i, |
289 | READ, | ||
289 | isect, pages[i], be_read, | 290 | isect, pages[i], be_read, |
290 | bl_end_io_read, par); | 291 | bl_end_io_read, par); |
291 | if (IS_ERR(bio)) { | 292 | if (IS_ERR(bio)) { |
@@ -654,7 +655,7 @@ next_page: | |||
654 | 655 | ||
655 | /* Middle pages */ | 656 | /* Middle pages */ |
656 | pg_index = wdata->args.pgbase >> PAGE_CACHE_SHIFT; | 657 | pg_index = wdata->args.pgbase >> PAGE_CACHE_SHIFT; |
657 | for (i = pg_index; i < wdata->npages; i++) { | 658 | for (i = pg_index; i < wdata->pages.npages; i++) { |
658 | if (!extent_length) { | 659 | if (!extent_length) { |
659 | /* We've used up the previous extent */ | 660 | /* We've used up the previous extent */ |
660 | bl_put_extent(be); | 661 | bl_put_extent(be); |
@@ -688,7 +689,7 @@ next_page: | |||
688 | goto out; | 689 | goto out; |
689 | } | 690 | } |
690 | } | 691 | } |
691 | bio = bl_add_page_to_bio(bio, wdata->npages - i, WRITE, | 692 | bio = bl_add_page_to_bio(bio, wdata->pages.npages - i, WRITE, |
692 | isect, pages[i], be, | 693 | isect, pages[i], be, |
693 | bl_end_io_write, par); | 694 | bl_end_io_write, par); |
694 | if (IS_ERR(bio)) { | 695 | if (IS_ERR(bio)) { |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 56176af1436f..0faba4cb531d 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -252,11 +252,11 @@ static void nfs_direct_read_release(void *calldata) | |||
252 | } else { | 252 | } else { |
253 | dreq->count += data->res.count; | 253 | dreq->count += data->res.count; |
254 | spin_unlock(&dreq->lock); | 254 | spin_unlock(&dreq->lock); |
255 | nfs_direct_dirty_pages(data->pagevec, | 255 | nfs_direct_dirty_pages(data->pages.pagevec, |
256 | data->args.pgbase, | 256 | data->args.pgbase, |
257 | data->res.count); | 257 | data->res.count); |
258 | } | 258 | } |
259 | nfs_direct_release_pages(data->pagevec, data->npages); | 259 | nfs_direct_release_pages(data->pages.pagevec, data->pages.npages); |
260 | 260 | ||
261 | if (put_dreq(dreq)) | 261 | if (put_dreq(dreq)) |
262 | nfs_direct_complete(dreq); | 262 | nfs_direct_complete(dreq); |
@@ -273,8 +273,8 @@ static void nfs_direct_readhdr_release(struct nfs_read_header *rhdr) | |||
273 | { | 273 | { |
274 | struct nfs_read_data *data = &rhdr->rpc_data; | 274 | struct nfs_read_data *data = &rhdr->rpc_data; |
275 | 275 | ||
276 | if (data->pagevec != data->page_array) | 276 | if (data->pages.pagevec != data->pages.page_array) |
277 | kfree(data->pagevec); | 277 | kfree(data->pages.pagevec); |
278 | nfs_readhdr_free(&rhdr->header); | 278 | nfs_readhdr_free(&rhdr->header); |
279 | } | 279 | } |
280 | 280 | ||
@@ -312,6 +312,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, | |||
312 | do { | 312 | do { |
313 | struct nfs_read_header *rhdr; | 313 | struct nfs_read_header *rhdr; |
314 | struct nfs_read_data *data; | 314 | struct nfs_read_data *data; |
315 | struct nfs_page_array *pages; | ||
315 | size_t bytes; | 316 | size_t bytes; |
316 | 317 | ||
317 | pgbase = user_addr & ~PAGE_MASK; | 318 | pgbase = user_addr & ~PAGE_MASK; |
@@ -322,24 +323,25 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, | |||
322 | if (unlikely(!rhdr)) | 323 | if (unlikely(!rhdr)) |
323 | break; | 324 | break; |
324 | data = &rhdr->rpc_data; | 325 | data = &rhdr->rpc_data; |
326 | pages = &data->pages; | ||
325 | 327 | ||
326 | down_read(¤t->mm->mmap_sem); | 328 | down_read(¤t->mm->mmap_sem); |
327 | result = get_user_pages(current, current->mm, user_addr, | 329 | result = get_user_pages(current, current->mm, user_addr, |
328 | data->npages, 1, 0, data->pagevec, NULL); | 330 | pages->npages, 1, 0, pages->pagevec, NULL); |
329 | up_read(¤t->mm->mmap_sem); | 331 | up_read(¤t->mm->mmap_sem); |
330 | if (result < 0) { | 332 | if (result < 0) { |
331 | nfs_direct_readhdr_release(rhdr); | 333 | nfs_direct_readhdr_release(rhdr); |
332 | break; | 334 | break; |
333 | } | 335 | } |
334 | if ((unsigned)result < data->npages) { | 336 | if ((unsigned)result < pages->npages) { |
335 | bytes = result * PAGE_SIZE; | 337 | bytes = result * PAGE_SIZE; |
336 | if (bytes <= pgbase) { | 338 | if (bytes <= pgbase) { |
337 | nfs_direct_release_pages(data->pagevec, result); | 339 | nfs_direct_release_pages(pages->pagevec, result); |
338 | nfs_direct_readhdr_release(rhdr); | 340 | nfs_direct_readhdr_release(rhdr); |
339 | break; | 341 | break; |
340 | } | 342 | } |
341 | bytes -= pgbase; | 343 | bytes -= pgbase; |
342 | data->npages = result; | 344 | pages->npages = result; |
343 | } | 345 | } |
344 | 346 | ||
345 | get_dreq(dreq); | 347 | get_dreq(dreq); |
@@ -352,7 +354,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_direct_req *dreq, | |||
352 | data->args.lock_context = dreq->l_ctx; | 354 | data->args.lock_context = dreq->l_ctx; |
353 | data->args.offset = pos; | 355 | data->args.offset = pos; |
354 | data->args.pgbase = pgbase; | 356 | data->args.pgbase = pgbase; |
355 | data->args.pages = data->pagevec; | 357 | data->args.pages = pages->pagevec; |
356 | data->args.count = bytes; | 358 | data->args.count = bytes; |
357 | data->res.fattr = &data->fattr; | 359 | data->res.fattr = &data->fattr; |
358 | data->res.eof = 0; | 360 | data->res.eof = 0; |
@@ -462,8 +464,8 @@ static void nfs_direct_writehdr_release(struct nfs_write_header *whdr) | |||
462 | { | 464 | { |
463 | struct nfs_write_data *data = &whdr->rpc_data; | 465 | struct nfs_write_data *data = &whdr->rpc_data; |
464 | 466 | ||
465 | if (data->pagevec != data->page_array) | 467 | if (data->pages.pagevec != data->pages.page_array) |
466 | kfree(data->pagevec); | 468 | kfree(data->pages.pagevec); |
467 | nfs_writehdr_free(&whdr->header); | 469 | nfs_writehdr_free(&whdr->header); |
468 | } | 470 | } |
469 | 471 | ||
@@ -472,8 +474,10 @@ static void nfs_direct_free_writedata(struct nfs_direct_req *dreq) | |||
472 | while (!list_empty(&dreq->rewrite_list)) { | 474 | while (!list_empty(&dreq->rewrite_list)) { |
473 | struct nfs_pgio_header *hdr = list_entry(dreq->rewrite_list.next, struct nfs_pgio_header, pages); | 475 | struct nfs_pgio_header *hdr = list_entry(dreq->rewrite_list.next, struct nfs_pgio_header, pages); |
474 | struct nfs_write_header *whdr = container_of(hdr, struct nfs_write_header, header); | 476 | struct nfs_write_header *whdr = container_of(hdr, struct nfs_write_header, header); |
477 | struct nfs_page_array *p = &whdr->rpc_data.pages; | ||
478 | |||
475 | list_del(&hdr->pages); | 479 | list_del(&hdr->pages); |
476 | nfs_direct_release_pages(whdr->rpc_data.pagevec, whdr->rpc_data.npages); | 480 | nfs_direct_release_pages(p->pagevec, p->npages); |
477 | nfs_direct_writehdr_release(whdr); | 481 | nfs_direct_writehdr_release(whdr); |
478 | } | 482 | } |
479 | } | 483 | } |
@@ -751,6 +755,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, | |||
751 | do { | 755 | do { |
752 | struct nfs_write_header *whdr; | 756 | struct nfs_write_header *whdr; |
753 | struct nfs_write_data *data; | 757 | struct nfs_write_data *data; |
758 | struct nfs_page_array *pages; | ||
754 | size_t bytes; | 759 | size_t bytes; |
755 | 760 | ||
756 | pgbase = user_addr & ~PAGE_MASK; | 761 | pgbase = user_addr & ~PAGE_MASK; |
@@ -762,24 +767,25 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, | |||
762 | break; | 767 | break; |
763 | 768 | ||
764 | data = &whdr->rpc_data; | 769 | data = &whdr->rpc_data; |
770 | pages = &data->pages; | ||
765 | 771 | ||
766 | down_read(¤t->mm->mmap_sem); | 772 | down_read(¤t->mm->mmap_sem); |
767 | result = get_user_pages(current, current->mm, user_addr, | 773 | result = get_user_pages(current, current->mm, user_addr, |
768 | data->npages, 0, 0, data->pagevec, NULL); | 774 | pages->npages, 0, 0, pages->pagevec, NULL); |
769 | up_read(¤t->mm->mmap_sem); | 775 | up_read(¤t->mm->mmap_sem); |
770 | if (result < 0) { | 776 | if (result < 0) { |
771 | nfs_direct_writehdr_release(whdr); | 777 | nfs_direct_writehdr_release(whdr); |
772 | break; | 778 | break; |
773 | } | 779 | } |
774 | if ((unsigned)result < data->npages) { | 780 | if ((unsigned)result < pages->npages) { |
775 | bytes = result * PAGE_SIZE; | 781 | bytes = result * PAGE_SIZE; |
776 | if (bytes <= pgbase) { | 782 | if (bytes <= pgbase) { |
777 | nfs_direct_release_pages(data->pagevec, result); | 783 | nfs_direct_release_pages(pages->pagevec, result); |
778 | nfs_direct_writehdr_release(whdr); | 784 | nfs_direct_writehdr_release(whdr); |
779 | break; | 785 | break; |
780 | } | 786 | } |
781 | bytes -= pgbase; | 787 | bytes -= pgbase; |
782 | data->npages = result; | 788 | pages->npages = result; |
783 | } | 789 | } |
784 | 790 | ||
785 | get_dreq(dreq); | 791 | get_dreq(dreq); |
@@ -794,7 +800,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_direct_req *dreq, | |||
794 | data->args.lock_context = dreq->l_ctx; | 800 | data->args.lock_context = dreq->l_ctx; |
795 | data->args.offset = pos; | 801 | data->args.offset = pos; |
796 | data->args.pgbase = pgbase; | 802 | data->args.pgbase = pgbase; |
797 | data->args.pages = data->pagevec; | 803 | data->args.pages = pages->pagevec; |
798 | data->args.count = bytes; | 804 | data->args.count = bytes; |
799 | data->args.stable = sync; | 805 | data->args.stable = sync; |
800 | data->res.fattr = &data->fattr; | 806 | data->res.fattr = &data->fattr; |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 7dc9be1a6e1a..5c3d77fda560 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -210,6 +210,7 @@ extern void nfs_destroy_writepagecache(void); | |||
210 | 210 | ||
211 | extern int __init nfs_init_directcache(void); | 211 | extern int __init nfs_init_directcache(void); |
212 | extern void nfs_destroy_directcache(void); | 212 | extern void nfs_destroy_directcache(void); |
213 | extern bool nfs_pgarray_set(struct nfs_page_array *p, unsigned int pagecount); | ||
213 | 214 | ||
214 | /* nfs2xdr.c */ | 215 | /* nfs2xdr.c */ |
215 | extern int nfs_stat_to_errno(enum nfs_stat); | 216 | extern int nfs_stat_to_errno(enum nfs_stat); |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index d21fceaa9f62..d349bd4c48db 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -26,6 +26,19 @@ | |||
26 | 26 | ||
27 | static struct kmem_cache *nfs_page_cachep; | 27 | static struct kmem_cache *nfs_page_cachep; |
28 | 28 | ||
29 | bool nfs_pgarray_set(struct nfs_page_array *p, unsigned int pagecount) | ||
30 | { | ||
31 | p->npages = pagecount; | ||
32 | if (pagecount <= ARRAY_SIZE(p->page_array)) | ||
33 | p->pagevec = p->page_array; | ||
34 | else { | ||
35 | p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL); | ||
36 | if (!p->pagevec) | ||
37 | p->npages = 0; | ||
38 | } | ||
39 | return p->pagevec != NULL; | ||
40 | } | ||
41 | |||
29 | static inline struct nfs_page * | 42 | static inline struct nfs_page * |
30 | nfs_page_alloc(void) | 43 | nfs_page_alloc(void) |
31 | { | 44 | { |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index d6d46823d9e4..f6ab30b5a462 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -46,16 +46,10 @@ struct nfs_read_header *nfs_readhdr_alloc(unsigned int pagecount) | |||
46 | 46 | ||
47 | INIT_LIST_HEAD(&hdr->pages); | 47 | INIT_LIST_HEAD(&hdr->pages); |
48 | INIT_LIST_HEAD(&data->list); | 48 | INIT_LIST_HEAD(&data->list); |
49 | data->npages = pagecount; | ||
50 | data->header = hdr; | 49 | data->header = hdr; |
51 | if (pagecount <= ARRAY_SIZE(data->page_array)) | 50 | if (!nfs_pgarray_set(&data->pages, pagecount)) { |
52 | data->pagevec = data->page_array; | 51 | kmem_cache_free(nfs_rdata_cachep, p); |
53 | else { | 52 | p = NULL; |
54 | data->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL); | ||
55 | if (!data->pagevec) { | ||
56 | kmem_cache_free(nfs_rdata_cachep, p); | ||
57 | p = NULL; | ||
58 | } | ||
59 | } | 53 | } |
60 | } | 54 | } |
61 | return p; | 55 | return p; |
@@ -71,8 +65,8 @@ void nfs_readhdr_free(struct nfs_pgio_header *hdr) | |||
71 | void nfs_readdata_release(struct nfs_read_data *rdata) | 65 | void nfs_readdata_release(struct nfs_read_data *rdata) |
72 | { | 66 | { |
73 | put_nfs_open_context(rdata->args.context); | 67 | put_nfs_open_context(rdata->args.context); |
74 | if (rdata->pagevec != rdata->page_array) | 68 | if (rdata->pages.pagevec != rdata->pages.page_array) |
75 | kfree(rdata->pagevec); | 69 | kfree(rdata->pages.pagevec); |
76 | nfs_readhdr_free(rdata->header); | 70 | nfs_readhdr_free(rdata->header); |
77 | } | 71 | } |
78 | 72 | ||
@@ -232,7 +226,7 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data, | |||
232 | data->args.fh = NFS_FH(inode); | 226 | data->args.fh = NFS_FH(inode); |
233 | data->args.offset = req_offset(req) + offset; | 227 | data->args.offset = req_offset(req) + offset; |
234 | data->args.pgbase = req->wb_pgbase + offset; | 228 | data->args.pgbase = req->wb_pgbase + offset; |
235 | data->args.pages = data->pagevec; | 229 | data->args.pages = data->pages.pagevec; |
236 | data->args.count = count; | 230 | data->args.count = count; |
237 | data->args.context = get_nfs_open_context(req->wb_context); | 231 | data->args.context = get_nfs_open_context(req->wb_context); |
238 | data->args.lock_context = req->wb_lock_context; | 232 | data->args.lock_context = req->wb_lock_context; |
@@ -318,7 +312,7 @@ static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc, struct list_head | |||
318 | if (!rhdr) | 312 | if (!rhdr) |
319 | goto out_bad; | 313 | goto out_bad; |
320 | data = &rhdr->rpc_data; | 314 | data = &rhdr->rpc_data; |
321 | data->pagevec[0] = page; | 315 | data->pages.pagevec[0] = page; |
322 | nfs_read_rpcsetup(req, data, len, offset); | 316 | nfs_read_rpcsetup(req, data, len, offset); |
323 | list_add(&data->list, res); | 317 | list_add(&data->list, res); |
324 | requests++; | 318 | requests++; |
@@ -356,7 +350,7 @@ static int nfs_pagein_one(struct nfs_pageio_descriptor *desc, struct list_head * | |||
356 | } | 350 | } |
357 | 351 | ||
358 | data = &rhdr->rpc_data; | 352 | data = &rhdr->rpc_data; |
359 | pages = data->pagevec; | 353 | pages = data->pages.pagevec; |
360 | while (!list_empty(head)) { | 354 | while (!list_empty(head)) { |
361 | req = nfs_list_entry(head->next); | 355 | req = nfs_list_entry(head->next); |
362 | nfs_list_remove_request(req); | 356 | nfs_list_remove_request(req); |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index dbb5c0a613b8..2efae049b4f0 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -80,16 +80,10 @@ struct nfs_write_header *nfs_writehdr_alloc(unsigned int pagecount) | |||
80 | memset(p, 0, sizeof(*p)); | 80 | memset(p, 0, sizeof(*p)); |
81 | INIT_LIST_HEAD(&hdr->pages); | 81 | INIT_LIST_HEAD(&hdr->pages); |
82 | INIT_LIST_HEAD(&data->list); | 82 | INIT_LIST_HEAD(&data->list); |
83 | data->npages = pagecount; | ||
84 | data->header = hdr; | 83 | data->header = hdr; |
85 | if (pagecount <= ARRAY_SIZE(data->page_array)) | 84 | if (!nfs_pgarray_set(&data->pages, pagecount)) { |
86 | data->pagevec = data->page_array; | 85 | mempool_free(p, nfs_wdata_mempool); |
87 | else { | 86 | p = NULL; |
88 | data->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_NOFS); | ||
89 | if (!data->pagevec) { | ||
90 | mempool_free(p, nfs_wdata_mempool); | ||
91 | p = NULL; | ||
92 | } | ||
93 | } | 87 | } |
94 | } | 88 | } |
95 | return p; | 89 | return p; |
@@ -104,8 +98,8 @@ void nfs_writehdr_free(struct nfs_pgio_header *hdr) | |||
104 | void nfs_writedata_release(struct nfs_write_data *wdata) | 98 | void nfs_writedata_release(struct nfs_write_data *wdata) |
105 | { | 99 | { |
106 | put_nfs_open_context(wdata->args.context); | 100 | put_nfs_open_context(wdata->args.context); |
107 | if (wdata->pagevec != wdata->page_array) | 101 | if (wdata->pages.pagevec != wdata->pages.page_array) |
108 | kfree(wdata->pagevec); | 102 | kfree(wdata->pages.pagevec); |
109 | nfs_writehdr_free(wdata->header); | 103 | nfs_writehdr_free(wdata->header); |
110 | } | 104 | } |
111 | 105 | ||
@@ -916,7 +910,7 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
916 | /* pnfs_set_layoutcommit needs this */ | 910 | /* pnfs_set_layoutcommit needs this */ |
917 | data->mds_offset = data->args.offset; | 911 | data->mds_offset = data->args.offset; |
918 | data->args.pgbase = req->wb_pgbase + offset; | 912 | data->args.pgbase = req->wb_pgbase + offset; |
919 | data->args.pages = data->pagevec; | 913 | data->args.pages = data->pages.pagevec; |
920 | data->args.count = count; | 914 | data->args.count = count; |
921 | data->args.context = get_nfs_open_context(req->wb_context); | 915 | data->args.context = get_nfs_open_context(req->wb_context); |
922 | data->args.lock_context = req->wb_lock_context; | 916 | data->args.lock_context = req->wb_lock_context; |
@@ -1011,7 +1005,7 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc, struct list_head | |||
1011 | if (!whdr) | 1005 | if (!whdr) |
1012 | goto out_bad; | 1006 | goto out_bad; |
1013 | data = &whdr->rpc_data; | 1007 | data = &whdr->rpc_data; |
1014 | data->pagevec[0] = page; | 1008 | data->pages.pagevec[0] = page; |
1015 | nfs_write_rpcsetup(req, data, len, offset, desc->pg_ioflags); | 1009 | nfs_write_rpcsetup(req, data, len, offset, desc->pg_ioflags); |
1016 | list_add(&data->list, res); | 1010 | list_add(&data->list, res); |
1017 | requests++; | 1011 | requests++; |
@@ -1061,7 +1055,7 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc, struct list_head *r | |||
1061 | goto out; | 1055 | goto out; |
1062 | } | 1056 | } |
1063 | data = &whdr->rpc_data; | 1057 | data = &whdr->rpc_data; |
1064 | pages = data->pagevec; | 1058 | pages = data->pages.pagevec; |
1065 | while (!list_empty(head)) { | 1059 | while (!list_empty(head)) { |
1066 | req = nfs_list_entry(head->next); | 1060 | req = nfs_list_entry(head->next); |
1067 | nfs_list_remove_request(req); | 1061 | nfs_list_remove_request(req); |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index fee324175391..e34beaf86e9c 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1167,19 +1167,23 @@ struct nfs_page; | |||
1167 | 1167 | ||
1168 | #define NFS_PAGEVEC_SIZE (8U) | 1168 | #define NFS_PAGEVEC_SIZE (8U) |
1169 | 1169 | ||
1170 | struct nfs_page_array { | ||
1171 | struct page **pagevec; | ||
1172 | unsigned int npages; /* Max length of pagevec */ | ||
1173 | struct page *page_array[NFS_PAGEVEC_SIZE]; | ||
1174 | }; | ||
1175 | |||
1170 | struct nfs_read_data { | 1176 | struct nfs_read_data { |
1171 | struct nfs_pgio_header *header; | 1177 | struct nfs_pgio_header *header; |
1172 | struct list_head list; | 1178 | struct list_head list; |
1173 | struct rpc_task task; | 1179 | struct rpc_task task; |
1174 | struct nfs_fattr fattr; /* fattr storage */ | 1180 | struct nfs_fattr fattr; /* fattr storage */ |
1175 | struct page **pagevec; | ||
1176 | unsigned int npages; /* Max length of pagevec */ | ||
1177 | struct nfs_readargs args; | 1181 | struct nfs_readargs args; |
1178 | struct nfs_readres res; | 1182 | struct nfs_readres res; |
1179 | unsigned long timestamp; /* For lease renewal */ | 1183 | unsigned long timestamp; /* For lease renewal */ |
1180 | int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data); | 1184 | int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data); |
1181 | __u64 mds_offset; | 1185 | __u64 mds_offset; |
1182 | struct page *page_array[NFS_PAGEVEC_SIZE]; | 1186 | struct nfs_page_array pages; |
1183 | struct nfs_client *ds_clp; /* pNFS data server */ | 1187 | struct nfs_client *ds_clp; /* pNFS data server */ |
1184 | }; | 1188 | }; |
1185 | 1189 | ||
@@ -1206,14 +1210,12 @@ struct nfs_write_data { | |||
1206 | struct rpc_task task; | 1210 | struct rpc_task task; |
1207 | struct nfs_fattr fattr; | 1211 | struct nfs_fattr fattr; |
1208 | struct nfs_writeverf verf; | 1212 | struct nfs_writeverf verf; |
1209 | struct page **pagevec; | ||
1210 | unsigned int npages; /* Max length of pagevec */ | ||
1211 | struct nfs_writeargs args; /* argument struct */ | 1213 | struct nfs_writeargs args; /* argument struct */ |
1212 | struct nfs_writeres res; /* result struct */ | 1214 | struct nfs_writeres res; /* result struct */ |
1213 | unsigned long timestamp; /* For lease renewal */ | 1215 | unsigned long timestamp; /* For lease renewal */ |
1214 | int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); | 1216 | int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); |
1215 | __u64 mds_offset; /* Filelayout dense stripe */ | 1217 | __u64 mds_offset; /* Filelayout dense stripe */ |
1216 | struct page *page_array[NFS_PAGEVEC_SIZE]; | 1218 | struct nfs_page_array pages; |
1217 | struct nfs_client *ds_clp; /* pNFS data server */ | 1219 | struct nfs_client *ds_clp; /* pNFS data server */ |
1218 | }; | 1220 | }; |
1219 | 1221 | ||