Commit e9d1593d authored by Al Viro's avatar Al Viro

cifs: fold cifs_iovec_write() into the only caller

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ccca2683
...@@ -2560,9 +2560,9 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, ...@@ -2560,9 +2560,9 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
return rc; return rc;
} }
static ssize_t ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
{ {
struct file *file = iocb->ki_filp;
size_t len; size_t len;
ssize_t total_written = 0; ssize_t total_written = 0;
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
...@@ -2573,8 +2573,14 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset) ...@@ -2573,8 +2573,14 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
struct iov_iter saved_from; struct iov_iter saved_from;
int rc; int rc;
/*
* BB - optimize the way when signing is disabled. We can drop this
* extra memory-to-memory copying and use iovec buffers for constructing
* write request.
*/
len = iov_iter_count(from); len = iov_iter_count(from);
rc = generic_write_checks(file, poffset, &len, 0); rc = generic_write_checks(file, &iocb->ki_pos, &len, 0);
if (rc) if (rc)
return rc; return rc;
...@@ -2593,7 +2599,7 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset) ...@@ -2593,7 +2599,7 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
memcpy(&saved_from, from, sizeof(struct iov_iter)); memcpy(&saved_from, from, sizeof(struct iov_iter));
rc = cifs_write_from_iter(*poffset, len, from, open_file, cifs_sb, rc = cifs_write_from_iter(iocb->ki_pos, len, from, open_file, cifs_sb,
&wdata_list); &wdata_list);
/* /*
...@@ -2633,7 +2639,7 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset) ...@@ -2633,7 +2639,7 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
memcpy(&tmp_from, &saved_from, memcpy(&tmp_from, &saved_from,
sizeof(struct iov_iter)); sizeof(struct iov_iter));
iov_iter_advance(&tmp_from, iov_iter_advance(&tmp_from,
wdata->offset - *poffset); wdata->offset - iocb->ki_pos);
rc = cifs_write_from_iter(wdata->offset, rc = cifs_write_from_iter(wdata->offset,
wdata->bytes, &tmp_from, wdata->bytes, &tmp_from,
...@@ -2650,34 +2656,13 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset) ...@@ -2650,34 +2656,13 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
kref_put(&wdata->refcount, cifs_uncached_writedata_release); kref_put(&wdata->refcount, cifs_uncached_writedata_release);
} }
if (total_written > 0) if (unlikely(!total_written))
*poffset += total_written; return rc;
iocb->ki_pos += total_written;
set_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(file_inode(file))->flags);
cifs_stats_bytes_written(tcon, total_written); cifs_stats_bytes_written(tcon, total_written);
return total_written ? total_written : (ssize_t)rc; return total_written;
}
ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
{
ssize_t written;
struct inode *inode;
loff_t pos = iocb->ki_pos;
inode = file_inode(iocb->ki_filp);
/*
* BB - optimize the way when signing is disabled. We can drop this
* extra memory-to-memory copying and use iovec buffers for constructing
* write request.
*/
written = cifs_iovec_write(iocb->ki_filp, from, &pos);
if (written > 0) {
set_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags);
iocb->ki_pos = pos;
}
return written;
} }
static ssize_t static ssize_t
......
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