Re: [PATCH 22/79] block: rnull: add no_sched module parameter and configfs attribute

Alice Ryhl
2026-03-16T10:54:35Z

On Mon, Feb 16, 2026 at 12:35:09AM +0100, Andreas Hindborg wrote:
> Add support for disabling the default IO scheduler by adding:
> - no_sched module parameter to control scheduler selection at device
> creation.
> - no_sched configfs attribute (ID 11) for runtime configuration.
> - Use of NO_DEFAULT_SCHEDULER flag when no_sched is enabled.
>
> This allows bypassing the default 'mq-deadline' scheduler and using 'none'
> instead, which can improve performance for certain workloads. The flag
> selection logic is updated to use compound assignment operators for better
> readability.
>
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>

> +#[vtable]
> +impl configfs::AttributeOperations<11> for DeviceConfig {
> + type Data = DeviceConfig;
> +
> + fn show(this: &DeviceConfig, page: &mut [u8; PAGE_SIZE]) -> Result<usize> {
> + let mut writer = kernel::str::Formatter::new(page);
> +
> + if this.data.lock().no_sched {
> + writer.write_str("1\n")?;
> + } else {
> + writer.write_str("0\n")?;
> + }
> +
> + Ok(writer.bytes_written())
> + }
> +
> + fn store(this: &DeviceConfig, page: &[u8]) -> Result {
> + if this.data.lock().powered {
> + return Err(EBUSY);
> + }
> +
> + this.data.lock().no_sched = kstrtobool_bytes(page)?;
> +
> + Ok(())
> + }

Not using your fancy macro. Also, TOCTOU.

Alice