diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-09 12:55:47 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:30:21 -0400 |
commit | 3309dd04cbcd2cdad168485af5cf3576b5051e49 (patch) | |
tree | 3e01f865306dee01b31f34c9e7e819a5f42a4087 /fs/udf | |
parent | 90320251db0fe3d05f2b10686ec936c7d6ecd99a (diff) |
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')
-rw-r--r-- | fs/udf/file.c | 10 |
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) | |||
120 | ssize_t retval; | 120 | ssize_t retval; |
121 | struct file *file = iocb->ki_filp; | 121 | struct file *file = iocb->ki_filp; |
122 | struct inode *inode = file_inode(file); | 122 | struct inode *inode = file_inode(file); |
123 | size_t count = iov_iter_count(from); | ||
124 | struct udf_inode_info *iinfo = UDF_I(inode); | 123 | struct udf_inode_info *iinfo = UDF_I(inode); |
125 | int err; | 124 | int err; |
126 | 125 | ||
127 | mutex_lock(&inode->i_mutex); | 126 | mutex_lock(&inode->i_mutex); |
128 | 127 | ||
129 | retval = generic_write_checks(file, &iocb->ki_pos, &count); | 128 | retval = generic_write_checks(iocb, from); |
130 | if (retval) | 129 | if (retval <= 0) |
131 | goto out; | 130 | goto out; |
132 | 131 | ||
133 | if (count == 0) | ||
134 | goto out; | ||
135 | |||
136 | iov_iter_truncate(from, count); | ||
137 | |||
138 | down_write(&iinfo->i_data_sem); | 132 | down_write(&iinfo->i_data_sem); |
139 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 133 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
140 | loff_t end = iocb->ki_pos + iov_iter_count(from); | 134 | loff_t end = iocb->ki_pos + iov_iter_count(from); |