[PATCH v6 6/7] rust: id_pool: do not round capacity up to BitmapVec::MAX_INLINE_LEN

From: Eliot Courtney

Date: Thu Aug 13 2026 - 03:37:32 EST


Current code in IdPool::with_capacity rounds the capacity up to
BitmapVec::MAX_INLINE_LEN, but BitmapVec::new works fine with values
smaller than this and still uses an inline representation. Remove this
behaviour.

Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
rust/kernel/id_pool.rs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/rust/kernel/id_pool.rs b/rust/kernel/id_pool.rs
index 1423a5fbca69..9baafc1732be 100644
--- a/rust/kernel/id_pool.rs
+++ b/rust/kernel/id_pool.rs
@@ -113,14 +113,9 @@ pub fn new() -> Self {
}

/// Constructs a new [`IdPool`] with space for a specific number of bits.
- ///
- /// A capacity below [`MAX_INLINE_LEN`] is adjusted to [`MAX_INLINE_LEN`].
- ///
- /// [`MAX_INLINE_LEN`]: BitmapVec::MAX_INLINE_LEN
#[inline]
pub fn with_capacity(num_ids: NonZero<usize>, flags: Flags) -> Result<Self, AllocError> {
- let num_ids = usize::max(num_ids.get(), BitmapVec::MAX_INLINE_LEN);
- let map = BitmapVec::new(num_ids, flags)?;
+ let map = BitmapVec::new(num_ids.get(), flags)?;
Ok(Self { map })
}


--
2.55.0