Re: [PATCH v3 0/3] rust: block: add rbrd, a RAM backed block driver

From: Andreas Hindborg

Date: Fri Dec 04 2026 - 08:56:46 EST


"Vitaly Wool" <vitaly.wool@xxxxxxxxxxx> writes:

> This series adds rbrd, a RAM backed block driver written in Rust that
> works like brd, together with the Rust abstractions it needs:
>
> 1) a `Guarded` page kind: a reference counted page whose data is only
> accessed under a bit spinlock in `page->private`. A guard gives
> access to the page data as a byte slice while the lock is held, and
> `try_get_raw()` takes a speculative reference for lock-free lookups;
> 2) a `discard_granularity` option for `GenDiskBuilder`;
> 3) the driver itself, configured through configfs like rnull. Its pages
> are kept in a flat array of atomic page pointers, so finding, adding
> or removing a page takes no lock.
>
> Unlike brd, rbrd never lets a read and a write copy the same page at
> the same time: each copy holds the page's bit spinlock. brd allows
> this race, so a read that overlaps a write can return a torn mix of
> old and new data. In Rust the race would also be undefined behaviour.
>
> This guarantee costs very little now. Under parallel load rbrd matches
> brd: with 16 or more threads, writes run at 98-100% of brd's rate, and
> 64k I/O runs at 99-103% (O_DIRECT, 1 GiB device, 24 vCPU KVM guest on
> a Xeon host pinned to one NUMA node, both drivers on the same kernel,
> median of 3 boots, kIOPS):
>
> test brd rbrd rbrd/brd
> write 4k, 16 threads 5572 5468 98%
> write 4k, 48 threads 5444 5333 98%
> randwrite 4k, 24 thr 5797 5789 100%
> randwrite 4k, 48 thr 5727 5735 100%
> read 64k, 24 threads 264 270 102%
> read 64k, 48 threads 262 266 102%
> write 64k, 24 threads 258 259 101%
> randwrite 64k, 24 thr 263 270 103%
>
> rbrd was stress tested with data verification on 4k and 512-byte
> block devices while a third device was created, used and removed in a
> loop, on a normal kernel and on a KASAN, lockdep and kmemleak build:
> no errors, no leaks and a clean dmesg. The Rust doctests, including
> the new `alloc_guarded()` example, pass.
>

Similar to v2 I only got 0/3 and 1/3 for this one.


Best regards,
Andreas Hindborg