summaryrefslogtreecommitdiff
path: root/lib/iov_iter.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2022-09-15 20:20:59 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2022-11-25 13:01:20 -0500
commitc67f1fd2b2b79299e617eca1c17f168d19e58510 (patch)
treecd45f563ba7b14a808be949c1dea2d5b38a8d5af /lib/iov_iter.c
parent40a86061a5619da8b2840efe1b26696077785cf1 (diff)
csum_and_copy_to_iter(): handle ITER_DISCARD
Not hard to implement - we are not copying anything here, so csum_and_memcpy() is not usable, but calculating a checksum of source directly is trivial... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'lib/iov_iter.c')
-rw-r--r--lib/iov_iter.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index e9a8fc9ee8ee..020e009d71c5 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1549,8 +1549,12 @@ size_t csum_and_copy_to_iter(const void *addr, size_t bytes, void *_csstate,
__wsum sum, next;
if (unlikely(iov_iter_is_discard(i))) {
- WARN_ON(1); /* for now */
- return 0;
+ // can't use csum_memcpy() for that one - data is not copied
+ csstate->csum = csum_block_add(csstate->csum,
+ csum_partial(addr, bytes, 0),
+ csstate->off);
+ csstate->off += bytes;
+ return bytes;
}
sum = csum_shift(csstate->csum, csstate->off);