summaryrefslogtreecommitdiffstats
path: root/fs/udf/file.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-04-09 18:55:47 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-12 04:30:21 +0200
commit3309dd04cbcd2cdad168485af5cf3576b5051e49 (patch)
tree3e01f865306dee01b31f34c9e7e819a5f42a4087 /fs/udf/file.c
parentocfs2: move generic_write_checks() before the alignment checks (diff)
downloadlinux-3309dd04cbcd2cdad168485af5cf3576b5051e49.tar.xz
linux-3309dd04cbcd2cdad168485af5cf3576b5051e49.zip
switch generic_write_checks() to iocb and iter
... returning -E... upon error and amount of data left in iter after (possible) truncation upon success. Note, that normal case gives a non-zero (positive) return value, so any tests for != 0 _must_ be updated. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Conflicts: fs/ext4/file.c
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r--fs/udf/file.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c
index ccab8b78e363..3de2edafff73 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -120,21 +120,15 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
ssize_t retval;
struct file *file = iocb->ki_filp;
struct inode *inode = file_inode(file);
- size_t count = iov_iter_count(from);
struct udf_inode_info *iinfo = UDF_I(inode);
int err;
mutex_lock(&inode->i_mutex);
- retval = generic_write_checks(file, &iocb->ki_pos, &count);
- if (retval)
+ retval = generic_write_checks(iocb, from);
+ if (retval <= 0)
goto out;
- if (count == 0)
- goto out;
-
- iov_iter_truncate(from, count);
-
down_write(&iinfo->i_data_sem);
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
loff_t end = iocb->ki_pos + iov_iter_count(from);