On Fri, Sep 17, 2021 at 06:29:26PM -0700, Darrick J. Wong wrote:
From: Darrick J. Wong <djwong@kernel.org>
Reorganize struct xchk_btree so that we can dynamically size the context
structure to fit the type of btree cursor that we have. This will
enable us to use memory more efficiently once we start adding very tall
btree types.
So bs->levels[0].has_lastkey replaces bs->firstkey? Can you explain
a bit more how this works for someone not too familiar with the scrub
code.
+static inline size_t
+xchk_btree_sizeof(unsigned int levels)
+{
+ return sizeof(struct xchk_btree) +
+ (levels * sizeof(struct xchk_btree_levels));
This should probably use struct_size().