aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-04-06 22:44:11 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:29:47 -0400
commite9d1593d4e9311bca040ecf6ec7599e6f235140c (patch)
tree689e560feb0b69c5bcc5c87a97794101ef03a4d5
parentccca26835dc27f7ba54e09d7aa03f462684a1927 (diff)
cifs: fold cifs_iovec_write() into the only caller
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/cifs/file.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 72394c5abd0f..3cb04129ddb1 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2560,9 +2560,9 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
2560 return rc; 2560 return rc;
2561} 2561}
2562 2562
2563static ssize_t 2563ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
2564cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
2565{ 2564{
2565 struct file *file = iocb->ki_filp;
2566 size_t len; 2566 size_t len;
2567 ssize_t total_written = 0; 2567 ssize_t total_written = 0;
2568 struct cifsFileInfo *open_file; 2568 struct cifsFileInfo *open_file;
@@ -2573,8 +2573,14 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
2573 struct iov_iter saved_from; 2573 struct iov_iter saved_from;
2574 int rc; 2574 int rc;
2575 2575
2576 /*
2577 * BB - optimize the way when signing is disabled. We can drop this
2578 * extra memory-to-memory copying and use iovec buffers for constructing
2579 * write request.
2580 */
2581
2576 len = iov_iter_count(from); 2582 len = iov_iter_count(from);
2577 rc = generic_write_checks(file, poffset, &len, 0); 2583 rc = generic_write_checks(file, &iocb->ki_pos, &len, 0);
2578 if (rc) 2584 if (rc)
2579 return rc; 2585 return rc;
2580 2586
@@ -2593,7 +2599,7 @@ cifs_iovec_write(struct file *file, struct iov_iter *from, loff_t *poffset)
2593 2599
2594 memcpy(&saved_from, from, sizeof(struct iov_iter)); 2600 memcpy(&saved_from, from, sizeof(struct iov_iter));
2595 2601
2596 rc = cifs_write_from_iter(*poffset, len, from, open_file, cifs_sb, 2602 rc = cifs_write_from_iter(iocb->ki_pos, len, from, open_file, cifs_sb,
2597 &wdata_list); 2603 &wdata_list);
2598 2604
2599 /* 2605 /*
@@ -2633,7 +2639,7 @@ restart_loop:
2633 memcpy(&tmp_from, &saved_from, 2639 memcpy(&tmp_from, &saved_from,
2634 sizeof(struct iov_iter)); 2640 sizeof(struct iov_iter));
2635 iov_iter_advance(&tmp_from, 2641 iov_iter_advance(&tmp_from,
2636 wdata->offset - *poffset); 2642 wdata->offset - iocb->ki_pos);
2637 2643
2638 rc = cifs_write_from_iter(wdata->offset, 2644 rc = cifs_write_from_iter(wdata->offset,
2639 wdata->bytes, &tmp_from, 2645 wdata->bytes, &tmp_from,
@@ -2650,34 +2656,13 @@ restart_loop:
2650 kref_put(&wdata->refcount, cifs_uncached_writedata_release); 2656 kref_put(&wdata->refcount, cifs_uncached_writedata_release);
2651 } 2657 }
2652 2658
2653 if (total_written > 0) 2659 if (unlikely(!total_written))
2654 *poffset += total_written; 2660 return rc;
2655 2661
2662 iocb->ki_pos += total_written;
2663 set_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(file_inode(file))->flags);
2656 cifs_stats_bytes_written(tcon, total_written); 2664 cifs_stats_bytes_written(tcon, total_written);
2657 return total_written ? total_written : (ssize_t)rc; 2665 return total_written;
2658}
2659
2660ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from)
2661{
2662 ssize_t written;
2663 struct inode *inode;
2664 loff_t pos = iocb->ki_pos;
2665
2666 inode = file_inode(iocb->ki_filp);
2667
2668 /*
2669 * BB - optimize the way when signing is disabled. We can drop this
2670 * extra memory-to-memory copying and use iovec buffers for constructing
2671 * write request.
2672 */
2673
2674 written = cifs_iovec_write(iocb->ki_filp, from, &pos);
2675 if (written > 0) {
2676 set_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags);
2677 iocb->ki_pos = pos;
2678 }
2679
2680 return written;
2681} 2666}
2682 2667
2683static ssize_t 2668static ssize_t