diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-07 11:28:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:29:47 -0400 |
commit | 5f380c7fa7e01f15ca0816bd241ece9a64a73192 (patch) | |
tree | 2136f54098eb85d21d17ee43f73724a5befd70a1 /fs/ext4 | |
parent | 0b8def9d6dfa6b2a9a2740cf81d8d2c134688d39 (diff) |
lift generic_write_checks() into callers of __generic_file_write_iter()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/file.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 9ad03036d9f5..f7cca423dded 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -132,9 +132,8 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
132 | ret = -EFBIG; | 132 | ret = -EFBIG; |
133 | goto errout; | 133 | goto errout; |
134 | } | 134 | } |
135 | 135 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); | |
136 | if (pos + length > sbi->s_bitmap_maxbytes) | 136 | length = iov_iter_count(from); |
137 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); | ||
138 | } | 137 | } |
139 | 138 | ||
140 | iocb->private = &overwrite; | 139 | iocb->private = &overwrite; |
@@ -172,7 +171,16 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
172 | } | 171 | } |
173 | } | 172 | } |
174 | 173 | ||
174 | ret = generic_write_checks(file, &iocb->ki_pos, &length, 0); | ||
175 | if (ret) | ||
176 | goto out; | ||
177 | |||
178 | if (length == 0) | ||
179 | goto out; | ||
180 | |||
181 | iov_iter_truncate(from, length); | ||
175 | ret = __generic_file_write_iter(iocb, from); | 182 | ret = __generic_file_write_iter(iocb, from); |
183 | out: | ||
176 | mutex_unlock(&inode->i_mutex); | 184 | mutex_unlock(&inode->i_mutex); |
177 | 185 | ||
178 | if (ret > 0) { | 186 | if (ret > 0) { |