diff options
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r-- | fs/nfs/direct.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 7101405713e1..e4c9e03aff12 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -73,9 +73,6 @@ struct nfs_direct_req { | |||
73 | struct nfs_open_context *ctx; /* file open context info */ | 73 | struct nfs_open_context *ctx; /* file open context info */ |
74 | struct kiocb * iocb; /* controlling i/o request */ | 74 | struct kiocb * iocb; /* controlling i/o request */ |
75 | struct inode * inode; /* target file of i/o */ | 75 | struct inode * inode; /* target file of i/o */ |
76 | unsigned long user_addr; /* location of user's buffer */ | ||
77 | size_t user_count; /* total bytes to move */ | ||
78 | loff_t pos; /* starting offset in file */ | ||
79 | struct page ** pages; /* pages in our buffer */ | 76 | struct page ** pages; /* pages in our buffer */ |
80 | unsigned int npages; /* count of pages */ | 77 | unsigned int npages; /* count of pages */ |
81 | 78 | ||
@@ -327,19 +324,17 @@ static const struct rpc_call_ops nfs_read_direct_ops = { | |||
327 | * For each nfs_read_data struct that was allocated on the list, dispatch | 324 | * For each nfs_read_data struct that was allocated on the list, dispatch |
328 | * an NFS READ operation | 325 | * an NFS READ operation |
329 | */ | 326 | */ |
330 | static void nfs_direct_read_schedule(struct nfs_direct_req *dreq) | 327 | static void nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned long user_addr, size_t count, loff_t pos) |
331 | { | 328 | { |
332 | struct nfs_open_context *ctx = dreq->ctx; | 329 | struct nfs_open_context *ctx = dreq->ctx; |
333 | struct inode *inode = ctx->dentry->d_inode; | 330 | struct inode *inode = ctx->dentry->d_inode; |
334 | struct list_head *list = &dreq->list; | 331 | struct list_head *list = &dreq->list; |
335 | struct page **pages = dreq->pages; | 332 | struct page **pages = dreq->pages; |
336 | size_t count = dreq->user_count; | ||
337 | loff_t pos = dreq->pos; | ||
338 | size_t rsize = NFS_SERVER(inode)->rsize; | 333 | size_t rsize = NFS_SERVER(inode)->rsize; |
339 | unsigned int curpage, pgbase; | 334 | unsigned int curpage, pgbase; |
340 | 335 | ||
341 | curpage = 0; | 336 | curpage = 0; |
342 | pgbase = dreq->user_addr & ~PAGE_MASK; | 337 | pgbase = user_addr & ~PAGE_MASK; |
343 | do { | 338 | do { |
344 | struct nfs_read_data *data; | 339 | struct nfs_read_data *data; |
345 | size_t bytes; | 340 | size_t bytes; |
@@ -403,9 +398,6 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size | |||
403 | if (!dreq) | 398 | if (!dreq) |
404 | return -ENOMEM; | 399 | return -ENOMEM; |
405 | 400 | ||
406 | dreq->user_addr = user_addr; | ||
407 | dreq->user_count = count; | ||
408 | dreq->pos = pos; | ||
409 | dreq->pages = pages; | 401 | dreq->pages = pages; |
410 | dreq->npages = nr_pages; | 402 | dreq->npages = nr_pages; |
411 | dreq->inode = inode; | 403 | dreq->inode = inode; |
@@ -415,7 +407,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size | |||
415 | 407 | ||
416 | nfs_add_stats(inode, NFSIOS_DIRECTREADBYTES, count); | 408 | nfs_add_stats(inode, NFSIOS_DIRECTREADBYTES, count); |
417 | rpc_clnt_sigmask(clnt, &oldset); | 409 | rpc_clnt_sigmask(clnt, &oldset); |
418 | nfs_direct_read_schedule(dreq); | 410 | nfs_direct_read_schedule(dreq, user_addr, count, pos); |
419 | result = nfs_direct_wait(dreq); | 411 | result = nfs_direct_wait(dreq); |
420 | rpc_clnt_sigunmask(clnt, &oldset); | 412 | rpc_clnt_sigunmask(clnt, &oldset); |
421 | 413 | ||
@@ -516,8 +508,8 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) | |||
516 | data->cred = dreq->ctx->cred; | 508 | data->cred = dreq->ctx->cred; |
517 | 509 | ||
518 | data->args.fh = NFS_FH(data->inode); | 510 | data->args.fh = NFS_FH(data->inode); |
519 | data->args.offset = dreq->pos; | 511 | data->args.offset = 0; |
520 | data->args.count = dreq->user_count; | 512 | data->args.count = 0; |
521 | data->res.count = 0; | 513 | data->res.count = 0; |
522 | data->res.fattr = &data->fattr; | 514 | data->res.fattr = &data->fattr; |
523 | data->res.verf = &data->verf; | 515 | data->res.verf = &data->verf; |
@@ -675,19 +667,17 @@ static const struct rpc_call_ops nfs_write_direct_ops = { | |||
675 | * For each nfs_write_data struct that was allocated on the list, dispatch | 667 | * For each nfs_write_data struct that was allocated on the list, dispatch |
676 | * an NFS WRITE operation | 668 | * an NFS WRITE operation |
677 | */ | 669 | */ |
678 | static void nfs_direct_write_schedule(struct nfs_direct_req *dreq, int sync) | 670 | static void nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned long user_addr, size_t count, loff_t pos, int sync) |
679 | { | 671 | { |
680 | struct nfs_open_context *ctx = dreq->ctx; | 672 | struct nfs_open_context *ctx = dreq->ctx; |
681 | struct inode *inode = ctx->dentry->d_inode; | 673 | struct inode *inode = ctx->dentry->d_inode; |
682 | struct list_head *list = &dreq->list; | 674 | struct list_head *list = &dreq->list; |
683 | struct page **pages = dreq->pages; | 675 | struct page **pages = dreq->pages; |
684 | size_t count = dreq->user_count; | ||
685 | loff_t pos = dreq->pos; | ||
686 | size_t wsize = NFS_SERVER(inode)->wsize; | 676 | size_t wsize = NFS_SERVER(inode)->wsize; |
687 | unsigned int curpage, pgbase; | 677 | unsigned int curpage, pgbase; |
688 | 678 | ||
689 | curpage = 0; | 679 | curpage = 0; |
690 | pgbase = dreq->user_addr & ~PAGE_MASK; | 680 | pgbase = user_addr & ~PAGE_MASK; |
691 | do { | 681 | do { |
692 | struct nfs_write_data *data; | 682 | struct nfs_write_data *data; |
693 | size_t bytes; | 683 | size_t bytes; |
@@ -756,9 +746,6 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz | |||
756 | if (dreq->commit_data == NULL || count < wsize) | 746 | if (dreq->commit_data == NULL || count < wsize) |
757 | sync = FLUSH_STABLE; | 747 | sync = FLUSH_STABLE; |
758 | 748 | ||
759 | dreq->user_addr = user_addr; | ||
760 | dreq->user_count = count; | ||
761 | dreq->pos = pos; | ||
762 | dreq->pages = pages; | 749 | dreq->pages = pages; |
763 | dreq->npages = nr_pages; | 750 | dreq->npages = nr_pages; |
764 | dreq->inode = inode; | 751 | dreq->inode = inode; |
@@ -771,7 +758,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz | |||
771 | nfs_begin_data_update(inode); | 758 | nfs_begin_data_update(inode); |
772 | 759 | ||
773 | rpc_clnt_sigmask(clnt, &oldset); | 760 | rpc_clnt_sigmask(clnt, &oldset); |
774 | nfs_direct_write_schedule(dreq, sync); | 761 | nfs_direct_write_schedule(dreq, user_addr, count, pos, sync); |
775 | result = nfs_direct_wait(dreq); | 762 | result = nfs_direct_wait(dreq); |
776 | rpc_clnt_sigunmask(clnt, &oldset); | 763 | rpc_clnt_sigunmask(clnt, &oldset); |
777 | 764 | ||