aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-22 06:51:37 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:32:54 -0400
commit0c949334a9e2581646c6ff0d1470a805b1e5be99 (patch)
tree60a4d6bc2260d648915baa9b78626cd4b6915431 /fs/xfs
parent28060d5d9b261da110afe48aae7a2aa6555f798f (diff)
iov_iter_truncate()
Now It Can Be Done(tm) - we don't need to do iov_shorten() in generic_file_direct_write() anymore, now that all ->direct_IO() instances are converted to proper iov_iter methods and honour iter->count and iter->iov_offset properly. Get rid of count/ocount arguments of generic_file_direct_write(), while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 762bb3e148a6..c997aa2751b2 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -626,7 +626,7 @@ xfs_file_dio_aio_write(
626 const struct iovec *iovp, 626 const struct iovec *iovp,
627 unsigned long nr_segs, 627 unsigned long nr_segs,
628 loff_t pos, 628 loff_t pos,
629 size_t ocount) 629 size_t count)
630{ 630{
631 struct file *file = iocb->ki_filp; 631 struct file *file = iocb->ki_filp;
632 struct address_space *mapping = file->f_mapping; 632 struct address_space *mapping = file->f_mapping;
@@ -634,7 +634,6 @@ xfs_file_dio_aio_write(
634 struct xfs_inode *ip = XFS_I(inode); 634 struct xfs_inode *ip = XFS_I(inode);
635 struct xfs_mount *mp = ip->i_mount; 635 struct xfs_mount *mp = ip->i_mount;
636 ssize_t ret = 0; 636 ssize_t ret = 0;
637 size_t count = ocount;
638 int unaligned_io = 0; 637 int unaligned_io = 0;
639 int iolock; 638 int iolock;
640 struct xfs_buftarg *target = XFS_IS_REALTIME_INODE(ip) ? 639 struct xfs_buftarg *target = XFS_IS_REALTIME_INODE(ip) ?
@@ -645,6 +644,8 @@ xfs_file_dio_aio_write(
645 if ((pos | count) & target->bt_logical_sectormask) 644 if ((pos | count) & target->bt_logical_sectormask)
646 return -XFS_ERROR(EINVAL); 645 return -XFS_ERROR(EINVAL);
647 646
647 iov_iter_init(&from, WRITE, iovp, nr_segs, count);
648
648 /* "unaligned" here means not aligned to a filesystem block */ 649 /* "unaligned" here means not aligned to a filesystem block */
649 if ((pos & mp->m_blockmask) || ((pos + count) & mp->m_blockmask)) 650 if ((pos & mp->m_blockmask) || ((pos + count) & mp->m_blockmask))
650 unaligned_io = 1; 651 unaligned_io = 1;
@@ -676,6 +677,7 @@ xfs_file_dio_aio_write(
676 ret = xfs_file_aio_write_checks(file, &pos, &count, &iolock); 677 ret = xfs_file_aio_write_checks(file, &pos, &count, &iolock);
677 if (ret) 678 if (ret)
678 goto out; 679 goto out;
680 iov_iter_truncate(&from, count);
679 681
680 if (mapping->nrpages) { 682 if (mapping->nrpages) {
681 ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, 683 ret = filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
@@ -697,8 +699,7 @@ xfs_file_dio_aio_write(
697 } 699 }
698 700
699 trace_xfs_file_direct_write(ip, count, iocb->ki_pos, 0); 701 trace_xfs_file_direct_write(ip, count, iocb->ki_pos, 0);
700 iov_iter_init(&from, WRITE, iovp, nr_segs, count); 702 ret = generic_file_direct_write(iocb, &from, pos);
701 ret = generic_file_direct_write(iocb, &from, pos, count, ocount);
702 703
703out: 704out:
704 xfs_rw_iunlock(ip, iolock); 705 xfs_rw_iunlock(ip, iolock);