Re: [PATCH v4 2/3] rust: block: add rnull, Rust null_blk implementation

Matthew Wilcox
2024-06-02T03:49:35Z

On Sat, Jun 01, 2024 at 10:01:40AM -0600, Keith Busch wrote:
> It's fine, just wondering why it's there. But it also allows values like
> 1536 and 3584, which are not valid block sizes, so I think you want the
> check to be:
>
> if !(512..=4096).contains(&block_size) || ((block_size & (block_size - 1)) != 0)

I'd drop the range check. We're pretty close to landing the bs>PS
patches, so just

if block_size & block_size - 1 != 0

should be enough of a validation. Is it considered "good style" in
Rust to omit the brackets here?