aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-04 21:53:33 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:32:44 -0400
commit619d30b4b8c488042b4a720ca79dccc346d1a516 (patch)
tree70877e3e8e2e47032512bc49d9e23cabd33c0f3b /fs/nfs/file.c
parentd8d3d94b80aa1a1c0ca75c58b8abdc7356f38418 (diff)
convert the guts of nfs_direct_IO() to iov_iter
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 284ca901fe16..3d01b152894e 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -169,14 +169,18 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
169 unsigned long nr_segs, loff_t pos) 169 unsigned long nr_segs, loff_t pos)
170{ 170{
171 struct inode *inode = file_inode(iocb->ki_filp); 171 struct inode *inode = file_inode(iocb->ki_filp);
172 size_t count = iov_length(iov, nr_segs);
172 ssize_t result; 173 ssize_t result;
174 struct iov_iter to;
175
176 iov_iter_init(&to, iov, nr_segs, count, 0);
173 177
174 if (iocb->ki_filp->f_flags & O_DIRECT) 178 if (iocb->ki_filp->f_flags & O_DIRECT)
175 return nfs_file_direct_read(iocb, iov, nr_segs, pos, true); 179 return nfs_file_direct_read(iocb, &to, pos, true);
176 180
177 dprintk("NFS: read(%pD2, %lu@%lu)\n", 181 dprintk("NFS: read(%pD2, %zu@%lu)\n",
178 iocb->ki_filp, 182 iocb->ki_filp,
179 (unsigned long) iov_length(iov, nr_segs), (unsigned long) pos); 183 count, (unsigned long) pos);
180 184
181 result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping); 185 result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
182 if (!result) { 186 if (!result) {
@@ -643,16 +647,18 @@ ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
643 unsigned long written = 0; 647 unsigned long written = 0;
644 ssize_t result; 648 ssize_t result;
645 size_t count = iov_length(iov, nr_segs); 649 size_t count = iov_length(iov, nr_segs);
650 struct iov_iter from;
651 iov_iter_init(&from, iov, nr_segs, count, 0);
646 652
647 result = nfs_key_timeout_notify(file, inode); 653 result = nfs_key_timeout_notify(file, inode);
648 if (result) 654 if (result)
649 return result; 655 return result;
650 656
651 if (file->f_flags & O_DIRECT) 657 if (file->f_flags & O_DIRECT)
652 return nfs_file_direct_write(iocb, iov, nr_segs, pos, true); 658 return nfs_file_direct_write(iocb, &from, pos, true);
653 659
654 dprintk("NFS: write(%pD2, %lu@%Ld)\n", 660 dprintk("NFS: write(%pD2, %zu@%Ld)\n",
655 file, (unsigned long) count, (long long) pos); 661 file, count, (long long) pos);
656 662
657 result = -EBUSY; 663 result = -EBUSY;
658 if (IS_SWAPFILE(inode)) 664 if (IS_SWAPFILE(inode))