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/ceph | |
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/ceph')
-rw-r--r-- | fs/ceph/file.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 761841903160..3f0b9339d823 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -941,9 +941,9 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
941 | struct ceph_inode_info *ci = ceph_inode(inode); | 941 | struct ceph_inode_info *ci = ceph_inode(inode); |
942 | struct ceph_osd_client *osdc = | 942 | struct ceph_osd_client *osdc = |
943 | &ceph_sb_to_client(inode->i_sb)->client->osdc; | 943 | &ceph_sb_to_client(inode->i_sb)->client->osdc; |
944 | ssize_t count = iov_iter_count(from), written = 0; | 944 | ssize_t count, written = 0; |
945 | int err, want, got; | 945 | int err, want, got; |
946 | loff_t pos = iocb->ki_pos; | 946 | loff_t pos; |
947 | 947 | ||
948 | if (ceph_snap(inode) != CEPH_NOSNAP) | 948 | if (ceph_snap(inode) != CEPH_NOSNAP) |
949 | return -EROFS; | 949 | return -EROFS; |
@@ -953,14 +953,12 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
953 | /* We can write back this queue in page reclaim */ | 953 | /* We can write back this queue in page reclaim */ |
954 | current->backing_dev_info = inode_to_bdi(inode); | 954 | current->backing_dev_info = inode_to_bdi(inode); |
955 | 955 | ||
956 | err = generic_write_checks(file, &pos, &count); | 956 | err = generic_write_checks(iocb, from); |
957 | if (err) | 957 | if (err <= 0) |
958 | goto out; | ||
959 | |||
960 | if (count == 0) | ||
961 | goto out; | 958 | goto out; |
962 | iov_iter_truncate(from, count); | ||
963 | 959 | ||
960 | pos = iocb->ki_pos; | ||
961 | count = iov_iter_count(from); | ||
964 | err = file_remove_suid(file); | 962 | err = file_remove_suid(file); |
965 | if (err) | 963 | if (err) |
966 | goto out; | 964 | goto out; |