write_iter variants of {__,}generic_file_aio_write()
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 3 Apr 2014 07:17:43 +0000 (03:17 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 6 May 2014 21:38:00 +0000 (17:38 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
29 files changed:
fs/9p/vfs_file.c
fs/adfs/file.c
fs/affs/file.c
fs/bfs/file.c
fs/ecryptfs/file.c
fs/exofs/file.c
fs/ext2/file.c
fs/ext3/file.c
fs/f2fs/file.c
fs/fat/file.c
fs/hfs/inode.c
fs/hfsplus/inode.c
fs/hostfs/hostfs_kern.c
fs/hpfs/file.c
fs/jffs2/file.c
fs/jfs/file.c
fs/logfs/file.c
fs/minix/file.c
fs/nilfs2/file.c
fs/omfs/file.c
fs/ramfs/file-mmu.c
fs/ramfs/file-nommu.c
fs/reiserfs/file.c
fs/sysv/file.c
fs/ufs/file.c
include/linux/fs.h
mm/filemap.c
mm/shmem.c
mm/vmscan.c

index 47e0597d1e9b8ebc4da81547874a0d1f87fdfe50..b9b5f979a2ca7baafa426037229f6d208dd3710d 100644 (file)
@@ -763,7 +763,7 @@ err_out:
 
 buff_write:
        mutex_unlock(&inode->i_mutex);
-       return do_sync_write(filp, data, count, offsetp);
+       return new_sync_write(filp, data, count, offsetp);
 }
 
 /**
@@ -781,7 +781,7 @@ v9fs_cached_file_write(struct file *filp, const char __user * data,
 
        if (filp->f_flags & O_DIRECT)
                return v9fs_direct_write(filp, data, count, offset);
-       return do_sync_write(filp, data, count, offset);
+       return new_sync_write(filp, data, count, offset);
 }
 
 
@@ -851,7 +851,7 @@ const struct file_operations v9fs_cached_file_operations = {
        .read = v9fs_cached_file_read,
        .write = v9fs_cached_file_write,
        .read_iter = generic_file_read_iter,
-       .aio_write = generic_file_aio_write,
+       .write_iter = generic_file_write_iter,
        .open = v9fs_file_open,
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
@@ -864,7 +864,7 @@ const struct file_operations v9fs_cached_file_operations_dotl = {
        .read = v9fs_cached_file_read,
        .write = v9fs_cached_file_write,
        .read_iter = generic_file_read_iter,
-       .aio_write = generic_file_aio_write,
+       .write_iter = generic_file_write_iter,
        .open = v9fs_file_open,
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock_dotl,
index 3bfc9efa29b452c4b8b834161953bff63876bdac..07c9edce5aa768ddeb7ae203c8c9cab489ea8417 100644 (file)
@@ -27,8 +27,8 @@ const struct file_operations adfs_file_operations = {
        .read_iter      = generic_file_read_iter,
        .mmap           = generic_file_mmap,
        .fsync          = generic_file_fsync,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .splice_read    = generic_file_splice_read,
 };
 
index 982853f17afc9762fb75efc5465bedb8e277d2e6..9df23175e28b910e5cec924dd87249956d4051a7 100644 (file)
@@ -29,8 +29,8 @@ const struct file_operations affs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .open           = affs_file_open,
        .release        = affs_file_release,
index 0aa788892f93ecb5a99a3961f4ca6dbefeca1b36..e7f88ace1a2508d260ea8feae3addc5e2752980c 100644 (file)
@@ -25,8 +25,8 @@ const struct file_operations bfs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .splice_read    = generic_file_splice_read,
 };
index b32827c917e1f0820fd609c0527c7a4a0693e4eb..db0fad3269c0395f230c39cc0fcd6c9975f6d633 100644 (file)
@@ -353,8 +353,8 @@ const struct file_operations ecryptfs_main_fops = {
        .llseek = generic_file_llseek,
        .read = new_sync_read,
        .read_iter = ecryptfs_read_update_atime,
-       .write = do_sync_write,
-       .aio_write = generic_file_aio_write,
+       .write = new_sync_write,
+       .write_iter = generic_file_write_iter,
        .iterate = ecryptfs_readdir,
        .unlocked_ioctl = ecryptfs_unlocked_ioctl,
 #ifdef CONFIG_COMPAT
index 90d394da747192fedd266e5e22bae230fd98869c..5b7f6be5a2d54323a2a430dc17156720d58fc885 100644 (file)
@@ -68,9 +68,9 @@ static int exofs_flush(struct file *file, fl_owner_t id)
 const struct file_operations exofs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .open           = generic_file_open,
        .release        = exofs_release_file,
index 407305072597e8d5925efb95770b5a41437e5103..970c6aca15ccbd9862b8249c93f7fabc0537f8cd 100644 (file)
@@ -63,9 +63,9 @@ int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 const struct file_operations ext2_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .unlocked_ioctl = ext2_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl   = ext2_compat_ioctl,
index 5439d2f0141b6cf66adf891fe77fac7c1d3a2bcf..c833b1226d4d4299c9962ea23349c433aa3965da 100644 (file)
@@ -51,9 +51,9 @@ static int ext3_release_file (struct inode * inode, struct file * filp)
 const struct file_operations ext3_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .unlocked_ioctl = ext3_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl   = ext3_compat_ioctl,
index 0e01fb0bc97c24a6bbfa1ff3fa4d1185dd5fb46f..22f4900dd8eb4d1d1139ac6c6f95ccc57849deec 100644 (file)
@@ -680,9 +680,9 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 const struct file_operations f2fs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .open           = generic_file_open,
        .mmap           = f2fs_file_mmap,
        .fsync          = f2fs_sync_file,
index 29285e990c909fdd49682852928b839ef85bcafd..85f79a89e7474658c8c552cfe027e72ff048d542 100644 (file)
@@ -171,9 +171,9 @@ int fat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
 const struct file_operations fat_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .release        = fat_file_release,
        .unlocked_ioctl = fat_generic_ioctl,
index 6d4055aff1097ffc71086fa98955234b36f34199..d0929bc817826e012cc829bb0f021832eea24379 100644 (file)
@@ -676,8 +676,8 @@ static const struct file_operations hfs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .splice_read    = generic_file_splice_read,
        .fsync          = hfs_file_fsync,
index cccc89e47cb667a0bd2cbb55d9fe56ed83e24d83..0cf786f2d046f9fbae9b110a2a2d212c008fb3aa 100644 (file)
@@ -343,8 +343,8 @@ static const struct file_operations hfsplus_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .splice_read    = generic_file_splice_read,
        .fsync          = hfsplus_file_fsync,
index ce0005d8ffebbe101bb374acabe4c6101a374f49..bb529f3b7f2bf8a119ec5f2eba3c260e09c361c7 100644 (file)
@@ -381,8 +381,8 @@ static const struct file_operations hostfs_file_fops = {
        .read           = new_sync_read,
        .splice_read    = generic_file_splice_read,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
-       .write          = do_sync_write,
+       .write_iter     = generic_file_write_iter,
+       .write          = new_sync_write,
        .mmap           = generic_file_mmap,
        .open           = hostfs_file_open,
        .release        = hostfs_file_release,
index bacb478a49907857d7dcd44c10e01c50f708a6e7..7f54e5f76cececd4bf76354edb13eb246a81df78 100644 (file)
@@ -199,8 +199,8 @@ const struct file_operations hpfs_file_ops =
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .release        = hpfs_file_release,
        .fsync          = hpfs_file_fsync,
index 9192127d591cd8e5ee04a13f483158e6b3fa1706..64989ca9ba90b71e3a8d16ff90dda67a913cc988 100644 (file)
@@ -53,8 +53,8 @@ const struct file_operations jffs2_file_operations =
        .open =         generic_file_open,
        .read =         new_sync_read,
        .read_iter =    generic_file_read_iter,
-       .write =        do_sync_write,
-       .aio_write =    generic_file_aio_write,
+       .write =        new_sync_write,
+       .write_iter =   generic_file_write_iter,
        .unlocked_ioctl=jffs2_ioctl,
        .mmap =         generic_file_readonly_mmap,
        .fsync =        jffs2_fsync,
index a5d8299b2208175d78aec6f54eae4347cddfe3be..cc744ecaf51fa22c3b2b89a0f621c7260d1d9317 100644 (file)
@@ -151,10 +151,10 @@ const struct inode_operations jfs_file_inode_operations = {
 const struct file_operations jfs_file_operations = {
        .open           = jfs_open,
        .llseek         = generic_file_llseek,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .splice_read    = generic_file_splice_read,
        .splice_write   = generic_file_splice_write,
index 1ca8026dc664c2324a2a26628409a9ca12fc197a..8538752df2f6a7dbb3dad0119e4e8bc47f4a25f4 100644 (file)
@@ -265,14 +265,14 @@ const struct inode_operations logfs_reg_iops = {
 
 const struct file_operations logfs_reg_fops = {
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .fsync          = logfs_fsync,
        .unlocked_ioctl = logfs_ioctl,
        .llseek         = generic_file_llseek,
        .mmap           = generic_file_readonly_mmap,
        .open           = generic_file_open,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
 };
 
 const struct address_space_operations logfs_reg_aops = {
index 607b4714532504ee644ac79b7adb916d6b96482a..a967de085ac0f4cf7193101cd4e54a08bb4fff50 100644 (file)
@@ -16,8 +16,8 @@ const struct file_operations minix_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .fsync          = generic_file_fsync,
        .splice_read    = generic_file_splice_read,
index dcb1b0e8b4359163b242e433a7ea7f756a38bb04..24978153c0c4daefd04f2853576db34aa3e8e0fe 100644 (file)
@@ -153,9 +153,9 @@ static int nilfs_file_mmap(struct file *file, struct vm_area_struct *vma)
 const struct file_operations nilfs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = generic_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .unlocked_ioctl = nilfs_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl   = nilfs_compat_ioctl,
index 3bf28da9f0dfe603f982fc76fdd9aa65c3e9d306..902e88527fcec443244bd12a9a25e1cf895ba763 100644 (file)
@@ -338,9 +338,9 @@ static sector_t omfs_bmap(struct address_space *mapping, sector_t block)
 const struct file_operations omfs_file_operations = {
        .llseek = generic_file_llseek,
        .read = new_sync_read,
-       .write = do_sync_write,
+       .write = new_sync_write,
        .read_iter = generic_file_read_iter,
-       .aio_write = generic_file_aio_write,
+       .write_iter = generic_file_write_iter,
        .mmap = generic_file_mmap,
        .fsync = generic_file_fsync,
        .splice_read = generic_file_splice_read,
index 30ffb367bc0b33ed8821dac1414685cb0c4a7571..6ea0b9718a9d3399542f1a3c0f55fced08e9b144 100644 (file)
@@ -33,8 +33,8 @@
 const struct file_operations ramfs_file_operations = {
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .fsync          = noop_fsync,
        .splice_read    = generic_file_splice_read,
index 416db04f8464eb567b25165e6a55e5f1c9d28b3d..9ed420f8f3cab88abd49ab8258f6e3538bc10cba 100644 (file)
@@ -39,8 +39,8 @@ const struct file_operations ramfs_file_operations = {
        .get_unmapped_area      = ramfs_nommu_get_unmapped_area,
        .read                   = new_sync_read,
        .read_iter              = generic_file_read_iter,
-       .write                  = do_sync_write,
-       .aio_write              = generic_file_aio_write,
+       .write                  = new_sync_write,
+       .write_iter             = generic_file_write_iter,
        .fsync                  = noop_fsync,
        .splice_read            = generic_file_splice_read,
        .splice_write           = generic_file_splice_write,
index 7592d681fd8ca64d4603e45bfc8503d7eef568a0..7c8ecd6468db50828c2302166439d06eb8530fd4 100644 (file)
@@ -236,7 +236,7 @@ int reiserfs_commit_page(struct inode *inode, struct page *page,
 
 const struct file_operations reiserfs_file_operations = {
        .read = new_sync_read,
-       .write = do_sync_write,
+       .write = new_sync_write,
        .unlocked_ioctl = reiserfs_ioctl,
 #ifdef CONFIG_COMPAT
        .compat_ioctl = reiserfs_compat_ioctl,
@@ -246,7 +246,7 @@ const struct file_operations reiserfs_file_operations = {
        .release = reiserfs_file_release,
        .fsync = reiserfs_sync_file,
        .read_iter = generic_file_read_iter,
-       .aio_write = generic_file_aio_write,
+       .write_iter = generic_file_write_iter,
        .splice_read = generic_file_splice_read,
        .splice_write = generic_file_splice_write,
        .llseek = generic_file_llseek,
index d99be88773882a42fccf88068eba950d014dbd64..b00811c75b24f63acb1651991f6972f4b0b6ff54 100644 (file)
@@ -23,8 +23,8 @@ const struct file_operations sysv_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .fsync          = generic_file_fsync,
        .splice_read    = generic_file_splice_read,
index b6b402989e6bf6c6f738e7f2422229d12f96de75..c84ec010a6761ff683e732973bd8780d989e6531 100644 (file)
@@ -37,8 +37,8 @@ const struct file_operations ufs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = generic_file_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = generic_file_write_iter,
        .mmap           = generic_file_mmap,
        .open           = generic_file_open,
        .fsync          = generic_file_fsync,
index 17535e0a45475476d0275445421bbd25d68a7df3..4b221637f09eb502b6d6b22ca5628a8963760dcb 100644 (file)
@@ -2414,7 +2414,9 @@ int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isbl
 extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
 extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
 extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long);
+extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
 extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
+extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *);
 extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t);
 extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
 extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
index c0404b763a17fb48832b58ac0137589148da915c..d2d9eeec8bf0559ec717a5843210a60116690410 100644 (file)
@@ -2542,10 +2542,9 @@ again:
 EXPORT_SYMBOL(generic_perform_write);
 
 /**
- * __generic_file_aio_write - write data to a file
+ * __generic_file_write_iter - write data to a file
  * @iocb:      IO state structure (file, offset, etc.)
- * @iov:       vector with data to write
- * @nr_segs:   number of segments in the vector
+ * @from:      iov_iter with data to write
  *
  * This function does all the work needed for actually writing data to a
  * file. It does all basic checks, removes SUID from the file, updates
@@ -2559,21 +2558,16 @@ EXPORT_SYMBOL(generic_perform_write);
  * A caller has to handle it. This is mainly due to the fact that we want to
  * avoid syncing under i_mutex.
  */
-ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
-                                unsigned long nr_segs)
+ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 {
        struct file *file = iocb->ki_filp;
        struct address_space * mapping = file->f_mapping;
-       size_t count;           /* after file limit checks */
        struct inode    *inode = mapping->host;
        loff_t          pos = iocb->ki_pos;
        ssize_t         written = 0;
        ssize_t         err;
        ssize_t         status;
-       struct iov_iter from;
-
-       count = iov_length(iov, nr_segs);
-       iov_iter_init(&from, WRITE, iov, nr_segs, count);
+       size_t          count = iov_iter_count(from);
 
        /* We can write back this queue in page reclaim */
        current->backing_dev_info = mapping->backing_dev_info;
@@ -2584,7 +2578,7 @@ ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
        if (count == 0)
                goto out;
 
-       iov_iter_truncate(&from, count);
+       iov_iter_truncate(from, count);
 
        err = file_remove_suid(file);
        if (err)
@@ -2598,7 +2592,7 @@ ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
        if (unlikely(file->f_flags & O_DIRECT)) {
                loff_t endbyte;
 
-               written = generic_file_direct_write(iocb, &from, pos);
+               written = generic_file_direct_write(iocb, from, pos);
                if (written < 0 || written == count)
                        goto out;
 
@@ -2609,7 +2603,7 @@ ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
                pos += written;
                count -= written;
 
-               status = generic_perform_write(file, &from, pos);
+               status = generic_perform_write(file, from, pos);
                /*
                 * If generic_perform_write() returned a synchronous error
                 * then we want to return the number of bytes which were
@@ -2641,7 +2635,7 @@ ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
                         */
                }
        } else {
-               written = generic_perform_write(file, &from, pos);
+               written = generic_perform_write(file, from, pos);
                if (likely(written >= 0))
                        iocb->ki_pos = pos + written;
        }
@@ -2649,30 +2643,36 @@ out:
        current->backing_dev_info = NULL;
        return written ? written : err;
 }
+EXPORT_SYMBOL(__generic_file_write_iter);
+
+ssize_t __generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
+                                unsigned long nr_segs)
+{
+       size_t count = iov_length(iov, nr_segs);
+       struct iov_iter from;
+
+       iov_iter_init(&from, WRITE, iov, nr_segs, count);
+       return __generic_file_write_iter(iocb, &from);
+}
 EXPORT_SYMBOL(__generic_file_aio_write);
 
 /**
- * generic_file_aio_write - write data to a file
+ * generic_file_write_iter - write data to a file
  * @iocb:      IO state structure
- * @iov:       vector with data to write
- * @nr_segs:   number of segments in the vector
- * @pos:       position in file where to write
+ * @from:      iov_iter with data to write
  *
- * This is a wrapper around __generic_file_aio_write() to be used by most
+ * This is a wrapper around __generic_file_write_iter() to be used by most
  * filesystems. It takes care of syncing the file in case of O_SYNC file
  * and acquires i_mutex as needed.
  */
-ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
-               unsigned long nr_segs, loff_t pos)
+ssize_t generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 {
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_mapping->host;
        ssize_t ret;
 
-       BUG_ON(iocb->ki_pos != pos);
-
        mutex_lock(&inode->i_mutex);
-       ret = __generic_file_aio_write(iocb, iov, nr_segs);
+       ret = __generic_file_write_iter(iocb, from);
        mutex_unlock(&inode->i_mutex);
 
        if (ret > 0) {
@@ -2684,6 +2684,19 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
        }
        return ret;
 }
+EXPORT_SYMBOL(generic_file_write_iter);
+
+ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
+               unsigned long nr_segs, loff_t pos)
+{
+       size_t count = iov_length(iov, nr_segs);
+       struct iov_iter from;
+
+       BUG_ON(iocb->ki_pos != pos);
+
+       iov_iter_init(&from, WRITE, iov, nr_segs, count);
+       return generic_file_write_iter(iocb, &from);
+}
 EXPORT_SYMBOL(generic_file_aio_write);
 
 /**
index edc6c7e817e95e10dc5ed9b42020e7d70a0dab70..d3e5c6fc313ce94720c0f865859f71591d51cbe7 100644 (file)
@@ -2618,9 +2618,9 @@ static const struct file_operations shmem_file_operations = {
 #ifdef CONFIG_TMPFS
        .llseek         = shmem_file_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = shmem_file_read_iter,
-       .aio_write      = generic_file_aio_write,
+       .write_iter     = generic_file_write_iter,
        .fsync          = noop_fsync,
        .splice_read    = shmem_file_splice_read,
        .splice_write   = generic_file_splice_write,
index 32c661d66a45498e270ba5e9019cda60a114cc27..9c2dba6ac68541397b5f3c9658c1a898284833cf 100644 (file)
@@ -458,7 +458,7 @@ static pageout_t pageout(struct page *page, struct address_space *mapping,
         * stalls if we need to run get_block().  We could test
         * PagePrivate for that.
         *
-        * If this process is currently in __generic_file_aio_write() against
+        * If this process is currently in __generic_file_write_iter() against
         * this page's queue, we can perform writeback even if that
         * will block.
         *