mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-03 10:55:20 +00:00
Fix kvec iterators
A few of the kvec iterators that work with byte offsets forgot to reset the offsets as they advanced to the next vec. These should probably be refactored into a set of iterator helpers. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -50,11 +50,15 @@ int scoutfs_kvec_memcmp(struct kvec *a, struct kvec *b)
|
||||
return ret;
|
||||
|
||||
b_off += len;
|
||||
if (b_off == b->iov_len)
|
||||
if (b_off == b->iov_len) {
|
||||
b++;
|
||||
b_off = 0;
|
||||
}
|
||||
a_off += len;
|
||||
if (a_off == a->iov_len)
|
||||
if (a_off == a->iov_len) {
|
||||
a++;
|
||||
a_off = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return a->iov_base ? 1 : b->iov_base ? -1 : 0;
|
||||
@@ -102,11 +106,15 @@ int scoutfs_kvec_memcpy(struct kvec *dst, struct kvec *src)
|
||||
copied += len;
|
||||
|
||||
src_off += len;
|
||||
if (src_off == src->iov_len)
|
||||
if (src_off == src->iov_len) {
|
||||
src++;
|
||||
src_off = 0;
|
||||
}
|
||||
dst_off += len;
|
||||
if (dst_off == dst->iov_len)
|
||||
if (dst_off == dst->iov_len) {
|
||||
dst++;
|
||||
dst_off = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return copied;
|
||||
|
||||
Reference in New Issue
Block a user