mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-11 00:00:12 +03:00
Add better valgrind support for journal write buffers.
This commit is contained in:
parent
ff4d082246
commit
bf7574260c
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
#include <valgrind/memcheck.h>
|
||||||
|
|
||||||
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
|
||||||
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
|
BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
|
||||||
@ -52,4 +53,6 @@
|
|||||||
__ret_warn_on; \
|
__ret_warn_on; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#define DEBUG_MEMORY_FREED(p, len) VALGRIND_MAKE_MEM_UNDEFINED(p, len)
|
||||||
|
|
||||||
#endif /* __TOOLS_LINUX_BUG_H */
|
#endif /* __TOOLS_LINUX_BUG_H */
|
||||||
|
|||||||
@ -934,6 +934,8 @@ out:
|
|||||||
/* also must come before signalling write completion: */
|
/* also must come before signalling write completion: */
|
||||||
closure_debug_destroy(cl);
|
closure_debug_destroy(cl);
|
||||||
|
|
||||||
|
DEBUG_MEMORY_FREED(w->data, w->buf_size);
|
||||||
|
|
||||||
BUG_ON(!j->reservations.prev_buf_unwritten);
|
BUG_ON(!j->reservations.prev_buf_unwritten);
|
||||||
atomic64_sub(((union journal_res_state) { .prev_buf_unwritten = 1 }).v,
|
atomic64_sub(((union journal_res_state) { .prev_buf_unwritten = 1 }).v,
|
||||||
&j->reservations.counter);
|
&j->reservations.counter);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user