mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]>
This commit is contained in:
parent
28060d5d9b
commit
0c949334a9
7 changed files with 40 additions and 42 deletions
|
|
@ -1188,8 +1188,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct address_space *mapping = file->f_mapping;
|
||||
size_t count = 0;
|
||||
size_t ocount = 0;
|
||||
size_t count;
|
||||
ssize_t written = 0;
|
||||
ssize_t written_buffered = 0;
|
||||
struct inode *inode = mapping->host;
|
||||
|
|
@ -1208,7 +1207,8 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|||
|
||||
WARN_ON(iocb->ki_pos != pos);
|
||||
|
||||
count = ocount = iov_length(iov, nr_segs);
|
||||
count = iov_length(iov, nr_segs);
|
||||
iov_iter_init(&i, WRITE, iov, nr_segs, count);
|
||||
mutex_lock(&inode->i_mutex);
|
||||
|
||||
/* We can write back this queue in page reclaim */
|
||||
|
|
@ -1217,11 +1217,11 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|||
err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
|
||||
if (err)
|
||||
goto out;
|
||||
iov_iter_init(&i, WRITE, iov, nr_segs, count);
|
||||
|
||||
if (count == 0)
|
||||
goto out;
|
||||
|
||||
iov_iter_truncate(&i, count);
|
||||
err = file_remove_suid(file);
|
||||
if (err)
|
||||
goto out;
|
||||
|
|
@ -1231,8 +1231,8 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|||
goto out;
|
||||
|
||||
if (file->f_flags & O_DIRECT) {
|
||||
written = generic_file_direct_write(iocb, &i, pos, count, ocount);
|
||||
if (written < 0 || written == count)
|
||||
written = generic_file_direct_write(iocb, &i, pos);
|
||||
if (written < 0 || !iov_iter_count(&i))
|
||||
goto out;
|
||||
|
||||
pos += written;
|
||||
|
|
@ -1469,8 +1469,7 @@ static ssize_t __fuse_direct_write(struct fuse_io_priv *io,
|
|||
|
||||
res = generic_write_checks(file, ppos, &count, 0);
|
||||
if (!res) {
|
||||
if (iter->count > count)
|
||||
iter->count = count;
|
||||
iov_iter_truncate(iter, count);
|
||||
res = fuse_direct_io(io, iter, ppos, FUSE_DIO_WRITE);
|
||||
}
|
||||
|
||||
|
|
@ -2896,8 +2895,7 @@ fuse_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter,
|
|||
if (offset >= i_size)
|
||||
return 0;
|
||||
count = min_t(loff_t, count, fuse_round_up(i_size - offset));
|
||||
if (iter->count > count)
|
||||
iter->count = count;
|
||||
iov_iter_truncate(iter, count);
|
||||
}
|
||||
|
||||
io = kmalloc(sizeof(struct fuse_io_priv), GFP_KERNEL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue