Re: [PATCH 08/15] block: add `struct elev_change_ctx` for unifying elevator change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 10, 2025 at 09:30:20PM +0800, Ming Lei wrote:
> +		struct elev_change_ctx ctx = {
> +			.name	= "none",
> +			.force	= 1,
> +			.uevent	= 1,
> +		};
>  
>  		mutex_lock(&q->elevator_lock);
>  		if (q->elevator && !blk_queue_dying(q))
> +			ctx.name = q->elevator->type->elevator_name;
> +		__elevator_change(q, &ctx);
>  		mutex_unlock(&q->elevator_lock);

Can we have this whole code section in a helper in elevator.c and
keep the low-level __elevator_change function private there?

> +/* Holding data for changing elevator */
> +struct elev_change_ctx {
> +	const char *name;
> +	unsigned int force:1;
> +	unsigned int uevent:1;

Using an integer type for flags is odd.  This should a boolean, or even
better aflags field with flag names.

And I think with the flag names we can just pass the name and the flags
and do away with the separate structure entirely.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux