diff options
author | Benny Halevy <bhalevy@panasas.com> | 2011-05-19 14:16:47 -0400 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2011-05-29 13:52:32 -0400 |
commit | f7da7a129d57bfe0f74573dc03531c63e1360fae (patch) | |
tree | 6efcd0fbdde9bb816ebc70731f1c47b8335ccfe3 /fs/nfs | |
parent | 35c8bb543c9e83197e6375142d1d1c2ee3cf017d (diff) |
SUNRPC: introduce xdr_init_decode_pages
Initialize xdr_stream and xdr_buf using an array of page pointers
and length of buffer.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/dir.c | 9 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayout.c | 9 | ||||
-rw-r--r-- | fs/nfs/nfs4filelayoutdev.c | 9 |
3 files changed, 6 insertions, 21 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 7237672216c8..f673a9e1d95d 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -512,12 +512,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en | |||
512 | struct page **xdr_pages, struct page *page, unsigned int buflen) | 512 | struct page **xdr_pages, struct page *page, unsigned int buflen) |
513 | { | 513 | { |
514 | struct xdr_stream stream; | 514 | struct xdr_stream stream; |
515 | struct xdr_buf buf = { | 515 | struct xdr_buf buf; |
516 | .pages = xdr_pages, | ||
517 | .page_len = buflen, | ||
518 | .buflen = buflen, | ||
519 | .len = buflen, | ||
520 | }; | ||
521 | struct page *scratch; | 516 | struct page *scratch; |
522 | struct nfs_cache_array *array; | 517 | struct nfs_cache_array *array; |
523 | unsigned int count = 0; | 518 | unsigned int count = 0; |
@@ -527,7 +522,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en | |||
527 | if (scratch == NULL) | 522 | if (scratch == NULL) |
528 | return -ENOMEM; | 523 | return -ENOMEM; |
529 | 524 | ||
530 | xdr_init_decode(&stream, &buf, NULL); | 525 | xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen); |
531 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); | 526 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); |
532 | 527 | ||
533 | do { | 528 | do { |
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c index 501a9b86b318..33bda24e8cd2 100644 --- a/fs/nfs/nfs4filelayout.c +++ b/fs/nfs/nfs4filelayout.c | |||
@@ -510,12 +510,7 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo, | |||
510 | gfp_t gfp_flags) | 510 | gfp_t gfp_flags) |
511 | { | 511 | { |
512 | struct xdr_stream stream; | 512 | struct xdr_stream stream; |
513 | struct xdr_buf buf = { | 513 | struct xdr_buf buf; |
514 | .pages = lgr->layoutp->pages, | ||
515 | .page_len = lgr->layoutp->len, | ||
516 | .buflen = lgr->layoutp->len, | ||
517 | .len = lgr->layoutp->len, | ||
518 | }; | ||
519 | struct page *scratch; | 514 | struct page *scratch; |
520 | __be32 *p; | 515 | __be32 *p; |
521 | uint32_t nfl_util; | 516 | uint32_t nfl_util; |
@@ -527,7 +522,7 @@ filelayout_decode_layout(struct pnfs_layout_hdr *flo, | |||
527 | if (!scratch) | 522 | if (!scratch) |
528 | return -ENOMEM; | 523 | return -ENOMEM; |
529 | 524 | ||
530 | xdr_init_decode(&stream, &buf, NULL); | 525 | xdr_init_decode_pages(&stream, &buf, lgr->layoutp->pages, lgr->layoutp->len); |
531 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); | 526 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); |
532 | 527 | ||
533 | /* 20 = ufl_util (4), first_stripe_index (4), pattern_offset (8), | 528 | /* 20 = ufl_util (4), first_stripe_index (4), pattern_offset (8), |
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index 5914659c8ec5..3b7bf1377264 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -308,12 +308,7 @@ decode_device(struct inode *ino, struct pnfs_device *pdev, gfp_t gfp_flags) | |||
308 | u8 max_stripe_index; | 308 | u8 max_stripe_index; |
309 | struct nfs4_file_layout_dsaddr *dsaddr = NULL; | 309 | struct nfs4_file_layout_dsaddr *dsaddr = NULL; |
310 | struct xdr_stream stream; | 310 | struct xdr_stream stream; |
311 | struct xdr_buf buf = { | 311 | struct xdr_buf buf; |
312 | .pages = pdev->pages, | ||
313 | .page_len = pdev->pglen, | ||
314 | .buflen = pdev->pglen, | ||
315 | .len = pdev->pglen, | ||
316 | }; | ||
317 | struct page *scratch; | 312 | struct page *scratch; |
318 | 313 | ||
319 | /* set up xdr stream */ | 314 | /* set up xdr stream */ |
@@ -321,7 +316,7 @@ decode_device(struct inode *ino, struct pnfs_device *pdev, gfp_t gfp_flags) | |||
321 | if (!scratch) | 316 | if (!scratch) |
322 | goto out_err; | 317 | goto out_err; |
323 | 318 | ||
324 | xdr_init_decode(&stream, &buf, NULL); | 319 | xdr_init_decode_pages(&stream, &buf, pdev->pages, pdev->pglen); |
325 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); | 320 | xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); |
326 | 321 | ||
327 | /* Get the stripe count (number of stripe index) */ | 322 | /* Get the stripe count (number of stripe index) */ |