blkdev_aio_write() - turn into blkdev_write_iter()
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 3 Apr 2014 07:21:50 +0000 (03:21 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 6 May 2014 21:38:01 +0000 (17:38 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/char/raw.c
fs/block_dev.c
include/linux/fs.h

index cfb607a64b85bb2ee311d2bdf1e6afacc17eb9c9..0102dc788608ec0060cf2fe1666e058c2d2d8076 100644 (file)
@@ -286,8 +286,8 @@ static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd,
 static const struct file_operations raw_fops = {
        .read           = new_sync_read,
        .read_iter      = generic_file_read_iter,
-       .write          = do_sync_write,
-       .aio_write      = blkdev_aio_write,
+       .write          = new_sync_write,
+       .write_iter     = blkdev_write_iter,
        .fsync          = blkdev_fsync,
        .open           = raw_open,
        .release        = raw_release,
index 3d97f4a257ff67ad0152eb18e85729eaf64229d8..4e36b8ea8aa456345a0675abb82e8b1b61d5cb86 100644 (file)
@@ -1509,28 +1509,24 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
  * Does not take i_mutex for the write and thus is not for general purpose
  * use.
  */
-ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
-                        unsigned long nr_segs, loff_t pos)
+ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
 {
        struct file *file = iocb->ki_filp;
        struct blk_plug plug;
        ssize_t ret;
 
-       BUG_ON(iocb->ki_pos != pos);
-
        blk_start_plug(&plug);
-       ret = __generic_file_aio_write(iocb, iov, nr_segs);
+       ret = __generic_file_write_iter(iocb, from);
        if (ret > 0) {
                ssize_t err;
-
-               err = generic_write_sync(file, pos, ret);
+               err = generic_write_sync(file, iocb->ki_pos - ret, ret);
                if (err < 0)
                        ret = err;
        }
        blk_finish_plug(&plug);
        return ret;
 }
-EXPORT_SYMBOL_GPL(blkdev_aio_write);
+EXPORT_SYMBOL_GPL(blkdev_write_iter);
 
 static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
 {
@@ -1577,9 +1573,9 @@ const struct file_operations def_blk_fops = {
        .release        = blkdev_close,
        .llseek         = block_llseek,
        .read           = new_sync_read,
-       .write          = do_sync_write,
+       .write          = new_sync_write,
        .read_iter      = blkdev_read_iter,
-       .aio_write      = blkdev_aio_write,
+       .write_iter     = blkdev_write_iter,
        .mmap           = generic_file_mmap,
        .fsync          = blkdev_fsync,
        .unlocked_ioctl = block_ioctl,
index 4b221637f09eb502b6d6b22ca5628a8963760dcb..1b9b6c59abdd805940f37f8b2ec2078de8d14e64 100644 (file)
@@ -2425,8 +2425,7 @@ extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo
 extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
 
 /* fs/block_dev.c */
-extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
-                               unsigned long nr_segs, loff_t pos);
+extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from);
 extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
                        int datasync);
 extern void block_sync_page(struct page *page);