Re: [PATCH v4 08/19] kho: block: Add the feature header to blocks

From: Pratyush Yadav

Date: Thu Nov 26 2026 - 13:05:05 EST


On Sat, Nov 14 2026, tarunsahu@xxxxxxxxxx wrote:

> "David Matlack" <dmatlack@xxxxxxxxxx> writes:
>
>> On Tue Nov 10, 2026 at 5:01 AM UTC, Tarun Sahu wrote:
>>> Precede struct kho_block_header_ser with struct kho_ser_hdr using
>>> DECLARE_KHO_SER. Each block in a block set starts with struct
>>> kho_ser_hdr followed by struct kho_block_header_ser. Serialized entries
>>> start immediately after the header payload at offset fhdr->size.
>>
>> This adds a feature header to every block in the set, but the layout it
>> describes is a property of the whole set: all blocks are written by the
>> same kernel with the same header.
>>
>> Blocks are only ever added and removed at the tail, so the head block
>> is stable for the lifetime of the set. I'd put a single set-wide
>> header in the first block only, e.g. a struct kho_block_set_ser with
>> its own feature header, and keep the per-block header to next and
>> count.
>>
>> entry_size (added in patch 2) is another set-wide property that belongs
>> there. All blocks in a set have the same entry size, so recording it in
>> every block is redundant, and restore has to check that the copies
>> agree.
>>
>
> Yes, adding a ser_hdr to each block_header is unnecessary and also cause
> 8 bytes to get added to every block. This can be solved like you said by
> adding it only to the first block. But this will make number of entries
> in block[0] to be less than blocks 1..N. I am not sure if that is
> acceptable but if it can be then we can avoid adding ser_hdr to each
> block. Same for entry_size which can be moved to the first block only
> like you suggested part of struct kho_block_set_ser.

I think it is simpler to do as kho_vmalloc does and just have a separate
out-of-band structure to hold all the metadata.

[...]

--
Regards,
Pratyush Yadav