diff --git a/INSTALL b/INSTALL index 5e22623b..46833a39 100644 --- a/INSTALL +++ b/INSTALL @@ -12,10 +12,11 @@ Dependencies: * libzstd * pkg-config * zlib1g + * valgrind On debian, you can install these with apt install -y pkg-config libaio-dev libblkid-dev libkeyutils-dev \ liblz4-dev libscrypt-dev libsodium-dev liburcu-dev libzstd-dev \ - uuid-dev zlib1g-dev + uuid-dev zlib1g-dev valgrind Then, just make && make install 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 +#include + #include #include #include @@ -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