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/ntfs | |
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/ntfs')
-rw-r--r-- | fs/ntfs/file.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index cec4ec3c1ede..7bb487e663b4 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -339,17 +339,14 @@ static ssize_t ntfs_prepare_file_for_write(struct kiocb *iocb, | |||
339 | struct inode *vi = file_inode(file); | 339 | struct inode *vi = file_inode(file); |
340 | ntfs_inode *base_ni, *ni = NTFS_I(vi); | 340 | ntfs_inode *base_ni, *ni = NTFS_I(vi); |
341 | ntfs_volume *vol = ni->vol; | 341 | ntfs_volume *vol = ni->vol; |
342 | size_t count = iov_iter_count(from); | ||
343 | 342 | ||
344 | ntfs_debug("Entering for i_ino 0x%lx, attribute type 0x%x, pos " | 343 | ntfs_debug("Entering for i_ino 0x%lx, attribute type 0x%x, pos " |
345 | "0x%llx, count 0x%zx.", vi->i_ino, | 344 | "0x%llx, count 0x%zx.", vi->i_ino, |
346 | (unsigned)le32_to_cpu(ni->type), | 345 | (unsigned)le32_to_cpu(ni->type), |
347 | (unsigned long long)iocb->ki_pos, count); | 346 | (unsigned long long)iocb->ki_pos, |
348 | err = generic_write_checks(file, &iocb->ki_pos, &count); | 347 | iov_iter_count(from)); |
349 | if (unlikely(err)) | 348 | err = generic_write_checks(iocb, from); |
350 | goto out; | 349 | if (unlikely(err <= 0)) |
351 | iov_iter_truncate(from, count); | ||
352 | if (count == 0) | ||
353 | goto out; | 350 | goto out; |
354 | /* | 351 | /* |
355 | * All checks have passed. Before we start doing any writing we want | 352 | * All checks have passed. Before we start doing any writing we want |