diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-03 14:29:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-06 17:39:41 -0400 |
commit | b30ac0fc4109701fc122d41ee085c65b52dc44a3 (patch) | |
tree | cce87ce1f0b03f0d82d2f82df949b5e4548a0abc /fs/btrfs | |
parent | 3ef045c3d8ae8550abbfd44074efce6ff642cc86 (diff) |
btrfs: switch to ->write_iter()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/file.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 39014d5db9d5..17e7393c50f0 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -447,7 +447,7 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages, | |||
447 | write_bytes -= copied; | 447 | write_bytes -= copied; |
448 | total_copied += copied; | 448 | total_copied += copied; |
449 | 449 | ||
450 | /* Return to btrfs_file_aio_write to fault page */ | 450 | /* Return to btrfs_file_write_iter to fault page */ |
451 | if (unlikely(copied == 0)) | 451 | if (unlikely(copied == 0)) |
452 | break; | 452 | break; |
453 | 453 | ||
@@ -1708,9 +1708,8 @@ static void update_time_for_write(struct inode *inode) | |||
1708 | inode_inc_iversion(inode); | 1708 | inode_inc_iversion(inode); |
1709 | } | 1709 | } |
1710 | 1710 | ||
1711 | static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | 1711 | static ssize_t btrfs_file_write_iter(struct kiocb *iocb, |
1712 | const struct iovec *iov, | 1712 | struct iov_iter *from) |
1713 | unsigned long nr_segs, loff_t pos) | ||
1714 | { | 1713 | { |
1715 | struct file *file = iocb->ki_filp; | 1714 | struct file *file = iocb->ki_filp; |
1716 | struct inode *inode = file_inode(file); | 1715 | struct inode *inode = file_inode(file); |
@@ -1719,15 +1718,12 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1719 | u64 end_pos; | 1718 | u64 end_pos; |
1720 | ssize_t num_written = 0; | 1719 | ssize_t num_written = 0; |
1721 | ssize_t err = 0; | 1720 | ssize_t err = 0; |
1722 | size_t count; | 1721 | size_t count = iov_iter_count(from); |
1723 | bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); | 1722 | bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); |
1724 | struct iov_iter i; | 1723 | loff_t pos = iocb->ki_pos; |
1725 | 1724 | ||
1726 | mutex_lock(&inode->i_mutex); | 1725 | mutex_lock(&inode->i_mutex); |
1727 | 1726 | ||
1728 | count = iov_length(iov, nr_segs); | ||
1729 | iov_iter_init(&i, WRITE, iov, nr_segs, count); | ||
1730 | |||
1731 | current->backing_dev_info = inode->i_mapping->backing_dev_info; | 1727 | current->backing_dev_info = inode->i_mapping->backing_dev_info; |
1732 | err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode)); | 1728 | err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode)); |
1733 | if (err) { | 1729 | if (err) { |
@@ -1740,7 +1736,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1740 | goto out; | 1736 | goto out; |
1741 | } | 1737 | } |
1742 | 1738 | ||
1743 | iov_iter_truncate(&i, count); | 1739 | iov_iter_truncate(from, count); |
1744 | 1740 | ||
1745 | err = file_remove_suid(file); | 1741 | err = file_remove_suid(file); |
1746 | if (err) { | 1742 | if (err) { |
@@ -1783,9 +1779,9 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1783 | atomic_inc(&BTRFS_I(inode)->sync_writers); | 1779 | atomic_inc(&BTRFS_I(inode)->sync_writers); |
1784 | 1780 | ||
1785 | if (unlikely(file->f_flags & O_DIRECT)) { | 1781 | if (unlikely(file->f_flags & O_DIRECT)) { |
1786 | num_written = __btrfs_direct_write(iocb, &i, pos); | 1782 | num_written = __btrfs_direct_write(iocb, from, pos); |
1787 | } else { | 1783 | } else { |
1788 | num_written = __btrfs_buffered_write(file, &i, pos); | 1784 | num_written = __btrfs_buffered_write(file, from, pos); |
1789 | if (num_written > 0) | 1785 | if (num_written > 0) |
1790 | iocb->ki_pos = pos + num_written; | 1786 | iocb->ki_pos = pos + num_written; |
1791 | } | 1787 | } |
@@ -2623,10 +2619,10 @@ out: | |||
2623 | const struct file_operations btrfs_file_operations = { | 2619 | const struct file_operations btrfs_file_operations = { |
2624 | .llseek = btrfs_file_llseek, | 2620 | .llseek = btrfs_file_llseek, |
2625 | .read = new_sync_read, | 2621 | .read = new_sync_read, |
2626 | .write = do_sync_write, | 2622 | .write = new_sync_write, |
2627 | .read_iter = generic_file_read_iter, | 2623 | .read_iter = generic_file_read_iter, |
2628 | .splice_read = generic_file_splice_read, | 2624 | .splice_read = generic_file_splice_read, |
2629 | .aio_write = btrfs_file_aio_write, | 2625 | .write_iter = btrfs_file_write_iter, |
2630 | .mmap = btrfs_file_mmap, | 2626 | .mmap = btrfs_file_mmap, |
2631 | .open = generic_file_open, | 2627 | .open = generic_file_open, |
2632 | .release = btrfs_release_file, | 2628 | .release = btrfs_release_file, |