mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
Put valgrind support behind CONFIG_VALGRIND
This commit is contained in:
parent
ffced87f08
commit
f712a866a4
1
Makefile
1
Makefile
@ -36,6 +36,7 @@ endif
|
||||
ifdef D
|
||||
CFLAGS+=-Werror
|
||||
CFLAGS+=-DCONFIG_BCACHEFS_DEBUG=y
|
||||
CFLAGS+=-DCONFIG_VALGRIND=y
|
||||
endif
|
||||
|
||||
PKGCONFIG_LIBS="blkid uuid liburcu libsodium zlib liblz4 libzstd"
|
||||
|
@ -3,8 +3,13 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
#ifdef CONFIG_VALGRIND
|
||||
#include <valgrind/memcheck.h>
|
||||
|
||||
#define DEBUG_MEMORY_FREED(p, len) VALGRIND_MAKE_MEM_UNDEFINED(p, len)
|
||||
#endif
|
||||
|
||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
||||
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
@ -53,6 +58,4 @@
|
||||
__ret_warn_on; \
|
||||
})
|
||||
|
||||
#define DEBUG_MEMORY_FREED(p, len) VALGRIND_MAKE_MEM_UNDEFINED(p, len)
|
||||
|
||||
#endif /* __TOOLS_LINUX_BUG_H */
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
#include <libaio.h>
|
||||
|
||||
#ifdef CONFIG_VALGRIND
|
||||
#include <valgrind/memcheck.h>
|
||||
#endif
|
||||
|
||||
#include <linux/bio.h>
|
||||
#include <linux/blkdev.h>
|
||||
@ -57,9 +59,11 @@ void generic_make_request(struct bio *bio)
|
||||
.iov_len = len,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_VALGRIND
|
||||
/* To be pedantic it should only be on IO completion. */
|
||||
if (bio_op(bio) == REQ_OP_READ)
|
||||
VALGRIND_MAKE_MEM_DEFINED(start, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct iocb iocb = {
|
||||
|
Loading…
Reference in New Issue
Block a user