Commit 1af5bb49 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

filemap: remove the pos argument to generic_file_direct_write

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c64fb5c7
...@@ -1703,18 +1703,17 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file, ...@@ -1703,18 +1703,17 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
return num_written ? num_written : ret; return num_written ? num_written : ret;
} }
static ssize_t __btrfs_direct_write(struct kiocb *iocb, static ssize_t __btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
struct iov_iter *from,
loff_t pos)
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
loff_t pos = iocb->ki_pos;
ssize_t written; ssize_t written;
ssize_t written_buffered; ssize_t written_buffered;
loff_t endbyte; loff_t endbyte;
int err; int err;
written = generic_file_direct_write(iocb, from, pos); written = generic_file_direct_write(iocb, from);
if (written < 0 || !iov_iter_count(from)) if (written < 0 || !iov_iter_count(from))
return written; return written;
...@@ -1832,7 +1831,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, ...@@ -1832,7 +1831,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,
atomic_inc(&BTRFS_I(inode)->sync_writers); atomic_inc(&BTRFS_I(inode)->sync_writers);
if (iocb->ki_flags & IOCB_DIRECT) { if (iocb->ki_flags & IOCB_DIRECT) {
num_written = __btrfs_direct_write(iocb, from, pos); num_written = __btrfs_direct_write(iocb, from);
} else { } else {
num_written = __btrfs_buffered_write(file, from, pos); num_written = __btrfs_buffered_write(file, from, pos);
if (num_written > 0) if (num_written > 0)
......
...@@ -1186,7 +1186,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) ...@@ -1186,7 +1186,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
if (iocb->ki_flags & IOCB_DIRECT) { if (iocb->ki_flags & IOCB_DIRECT) {
loff_t pos = iocb->ki_pos; loff_t pos = iocb->ki_pos;
written = generic_file_direct_write(iocb, from, pos); written = generic_file_direct_write(iocb, from);
if (written < 0 || !iov_iter_count(from)) if (written < 0 || !iov_iter_count(from))
goto out; goto out;
......
...@@ -2703,7 +2703,7 @@ extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *); ...@@ -2703,7 +2703,7 @@ extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *);
extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); 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_file_direct_write(struct kiocb *, struct iov_iter *);
extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos); ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos);
......
...@@ -2499,11 +2499,12 @@ int pagecache_write_end(struct file *file, struct address_space *mapping, ...@@ -2499,11 +2499,12 @@ int pagecache_write_end(struct file *file, struct address_space *mapping,
EXPORT_SYMBOL(pagecache_write_end); EXPORT_SYMBOL(pagecache_write_end);
ssize_t ssize_t
generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos) generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
loff_t pos = iocb->ki_pos;
ssize_t written; ssize_t written;
size_t write_len; size_t write_len;
pgoff_t end; pgoff_t end;
...@@ -2717,7 +2718,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) ...@@ -2717,7 +2718,7 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
if (iocb->ki_flags & IOCB_DIRECT) { if (iocb->ki_flags & IOCB_DIRECT) {
loff_t pos, endbyte; loff_t pos, endbyte;
written = generic_file_direct_write(iocb, from, iocb->ki_pos); written = generic_file_direct_write(iocb, from);
/* /*
* If the write stopped short of completing, fall back to * If the write stopped short of completing, fall back to
* buffered writes. Some filesystems do this for writes to * buffered writes. Some filesystems do this for writes to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment