Thread (48 messages) 48 messages, 4 authors, 2021-09-23

Re: [PATCH 03/14] xfs: dynamically allocate btree scrub context structure

From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-09-22 16:17:53

On Tue, Sep 21, 2021 at 09:43:18AM +0100, Christoph Hellwig wrote:
On Fri, Sep 17, 2021 at 06:29:26PM -0700, Darrick J. Wong wrote:
quoted
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.
For each record and key that the btree scrubber encounters, it needs to
know if it should call ->{recs,keys}_inorder to check the ordering of
each item in the btree block.

Hmm.  Come to think of it, we could use "cur->bc_ptrs[level] > 0"
instead of tracking it separately.  Ok, that'll become a separate
cleanup patch to reduce memory further.  Good question!
quoted
+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().
Assuming it's ok with sending a typed null pointer into a macro:

	return struct_size((struct xchk_btree *)NULL, levels, nr_levels);

Then ok.

--D
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help