summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorJustin Husted <sigstop@gmail.com>2019-10-04 14:18:33 -0700
committerKent Overstreet <kent.overstreet@gmail.com>2019-10-18 16:23:39 -0400
commite1ed5557bf93030017af8a866a6abb2f98c87bca (patch)
treea45a4dac4b2d307be4e6ff860ba74b0c3f46b93a /linux
parent94980e189242db14c41f0bd65ec46640d086ce81 (diff)
Add valgrind handling: data read from io_submit was not being marked
properly. Manually mark it. This might be better done by improving the valgrind wrapper for io_submit.
Diffstat (limited to 'linux')
-rw-r--r--linux/blkdev.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/linux/blkdev.c b/linux/blkdev.c
index 156d5353..8139e18d 100644
--- a/linux/blkdev.c
+++ b/linux/blkdev.c
@@ -10,6 +10,8 @@
#include <libaio.h>
+#include <valgrind/memcheck.h>
+
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/completion.h>
@@ -45,12 +47,20 @@ void generic_make_request(struct bio *bio)
iov = alloca(sizeof(*iov) * i);
i = 0;
- bio_for_each_segment(bv, bio, iter)
+ bio_for_each_segment(bv, bio, iter) {
+ void *start = page_address(bv.bv_page) + bv.bv_offset;
+ size_t len = bv.bv_len;
+
iov[i++] = (struct iovec) {
- .iov_base = page_address(bv.bv_page) + bv.bv_offset,
- .iov_len = bv.bv_len,
+ .iov_base = start,
+ .iov_len = len,
};
+ /* To be pedantic it should only be on IO completion. */
+ if (bio_op(bio) == REQ_OP_READ)
+ VALGRIND_MAKE_MEM_DEFINED(start, len);
+ }
+
struct iocb iocb = {
.data = bio,
.aio_fildes = bio->bi_opf & REQ_FUA