aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-04-07 11:51:58 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-01 19:58:39 -0400
commitc8b8e32d700fe943a935e435ae251364d016c497 (patch)
tree956e582a123c6b2761e80901bdaaedc5ba4137e3 /fs/nfs/direct.c
parent13712713caba0c1b8c2c0070a4c1f4487def8dee (diff)
direct-io: eliminate the offset argument to ->direct_IO
Including blkdev_direct_IO and dax_do_io. It has to be ki_pos to actually work, so eliminate the superflous argument. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index c93826e4a8c6..346b5d85ce92 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -250,7 +250,7 @@ static int nfs_direct_cmp_commit_data_verf(struct nfs_direct_req *dreq,
250 * shunt off direct read and write requests before the VFS gets them, 250 * shunt off direct read and write requests before the VFS gets them,
251 * so this method is only ever called for swap. 251 * so this method is only ever called for swap.
252 */ 252 */
253ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t pos) 253ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
254{ 254{
255 struct inode *inode = iocb->ki_filp->f_mapping->host; 255 struct inode *inode = iocb->ki_filp->f_mapping->host;
256 256
@@ -261,7 +261,7 @@ ssize_t nfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t pos)
261 VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE); 261 VM_BUG_ON(iov_iter_count(iter) != PAGE_SIZE);
262 262
263 if (iov_iter_rw(iter) == READ) 263 if (iov_iter_rw(iter) == READ)
264 return nfs_file_direct_read(iocb, iter, pos); 264 return nfs_file_direct_read(iocb, iter);
265 return nfs_file_direct_write(iocb, iter); 265 return nfs_file_direct_write(iocb, iter);
266} 266}
267 267
@@ -545,7 +545,6 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
545 * nfs_file_direct_read - file direct read operation for NFS files 545 * nfs_file_direct_read - file direct read operation for NFS files
546 * @iocb: target I/O control block 546 * @iocb: target I/O control block
547 * @iter: vector of user buffers into which to read data 547 * @iter: vector of user buffers into which to read data
548 * @pos: byte offset in file where reading starts
549 * 548 *
550 * We use this function for direct reads instead of calling 549 * We use this function for direct reads instead of calling
551 * generic_file_aio_read() in order to avoid gfar's check to see if 550 * generic_file_aio_read() in order to avoid gfar's check to see if
@@ -561,8 +560,7 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
561 * client must read the updated atime from the server back into its 560 * client must read the updated atime from the server back into its
562 * cache. 561 * cache.
563 */ 562 */
564ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, 563ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter)
565 loff_t pos)
566{ 564{
567 struct file *file = iocb->ki_filp; 565 struct file *file = iocb->ki_filp;
568 struct address_space *mapping = file->f_mapping; 566 struct address_space *mapping = file->f_mapping;
@@ -574,7 +572,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter,
574 nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count); 572 nfs_add_stats(mapping->host, NFSIOS_DIRECTREADBYTES, count);
575 573
576 dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n", 574 dfprintk(FILE, "NFS: direct read(%pD2, %zd@%Ld)\n",
577 file, count, (long long) pos); 575 file, count, (long long) iocb->ki_pos);
578 576
579 result = 0; 577 result = 0;
580 if (!count) 578 if (!count)
@@ -594,7 +592,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter,
594 592
595 dreq->inode = inode; 593 dreq->inode = inode;
596 dreq->bytes_left = count; 594 dreq->bytes_left = count;
597 dreq->io_start = pos; 595 dreq->io_start = iocb->ki_pos;
598 dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); 596 dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp));
599 l_ctx = nfs_get_lock_context(dreq->ctx); 597 l_ctx = nfs_get_lock_context(dreq->ctx);
600 if (IS_ERR(l_ctx)) { 598 if (IS_ERR(l_ctx)) {
@@ -606,14 +604,14 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter,
606 dreq->iocb = iocb; 604 dreq->iocb = iocb;
607 605
608 NFS_I(inode)->read_io += count; 606 NFS_I(inode)->read_io += count;
609 result = nfs_direct_read_schedule_iovec(dreq, iter, pos); 607 result = nfs_direct_read_schedule_iovec(dreq, iter, iocb->ki_pos);
610 608
611 inode_unlock(inode); 609 inode_unlock(inode);
612 610
613 if (!result) { 611 if (!result) {
614 result = nfs_direct_wait(dreq); 612 result = nfs_direct_wait(dreq);
615 if (result > 0) 613 if (result > 0)
616 iocb->ki_pos = pos + result; 614 iocb->ki_pos += result;
617 } 615 }
618 616
619 nfs_direct_req_release(dreq); 617 nfs_direct_req_release(dreq);
@@ -969,7 +967,6 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
969 * nfs_file_direct_write - file direct write operation for NFS files 967 * nfs_file_direct_write - file direct write operation for NFS files
970 * @iocb: target I/O control block 968 * @iocb: target I/O control block
971 * @iter: vector of user buffers from which to write data 969 * @iter: vector of user buffers from which to write data
972 * @pos: byte offset in file where writing starts
973 * 970 *
974 * We use this function for direct writes instead of calling 971 * We use this function for direct writes instead of calling
975 * generic_file_aio_write() in order to avoid taking the inode 972 * generic_file_aio_write() in order to avoid taking the inode