summaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-04-07 11:28:12 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:29:47 -0400
commit5f380c7fa7e01f15ca0816bd241ece9a64a73192 (patch)
tree2136f54098eb85d21d17ee43f73724a5befd70a1 /fs/block_dev.c
parent0b8def9d6dfa6b2a9a2740cf81d8d2c134688d39 (diff)
downloadlinux-5f380c7fa7e01f15ca0816bd241ece9a64a73192.tar.bz2
lift generic_write_checks() into callers of __generic_file_write_iter()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6e3de63c3055..bcd7f97beab9 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1597,6 +1597,16 @@ 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;
+ size_t count = iov_iter_count(from);
+
+ ret = generic_write_checks(file, &iocb->ki_pos, &count, 1);
+ if (ret)
+ return ret;
+
+ if (count == 0)
+ return 0;
+
+ iov_iter_truncate(from, count);
blk_start_plug(&plug);
ret = __generic_file_write_iter(iocb, from);