Re: [PATCH 0/4] rust: Add support for reserving of ranges of IDs
From: Alice Ryhl
Date: Tue Jul 07 2026 - 09:40:24 EST
On Tue, Jul 7, 2026 at 3:26 PM Eliot Courtney <ecourtney@xxxxxxxxxx> wrote:
>
> On Mon Jul 6, 2026 at 8:48 PM JST, Alice Ryhl wrote:
> > On Fri, Jul 03, 2026 at 07:16:03PM +0900, Eliot Courtney wrote:
> >> Add support for reserving of ranges of IDs, with a usage in nova-core
> >> for channel IDs. This entails adding the helpers+users of the C bitmap
> >> API for ranges of bits, then users of that in `IdPool`, and finally a
> >> user of `IdPool` in nova-core, `ChannelIdPool`.
> >
> > If you need ranges of IDs, perhaps you want the maple tree instead?
> >
> > Alice
>
> I think maple tree would work, but it looked like not as good a fit to
> me because:
> - the number of channel IDs is small (limited to 2048)
> - allocation of a contiguous sequence of channel IDs is sometimes
> aligned to its size (which should be a power of two, AFAICT) - I
> realise patch 4 doesn't reflect this (yet). The bitmap APIs natively
> support this.
> - maple tree's alloc_range stores a value: T for the range which isn't
> necessary for ID alloc
The limited number of channel IDs (2048) is a good reason to use a
bitmap. Please include this context in the commit message for the next
version.
Alice