Re: [RFC V5 02/16] blk/rq-qos: prepare to make blk-rq-qos pluggable

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

 



On Thu, Feb 24, 2022 at 05:06:40PM +0800, Wang Jianchao (Kuaishou) wrote:
> This patch makes blk-rq-qos policies pluggable as following,
> (1) Add code to maintain the rq_qos_ops. A rq-qos policy need to
>     register itself with rq_qos_register(). The original enum
>     rq_qos_id will be removed in following patch. They will use
>     a dynamic id maintained by rq_qos_ida.
> (2) Add .init callback into rq_qos_ops. We use it to initialize the
>     resource.
> (3) Add /sys/block/x/queue/qos
>     We can use '+name' or "-name" to open or close the blk-rq-qos
>     policy.

This sunds like most of these should be separate patches.

>  {
>  	struct request_queue *q = rqos->q;
> -	const char *dir_name = rq_qos_id_to_name(rqos->id);
> +	const char *dir_name;
> +
> +	if (rqos->ops->name)
> +		dir_name = rqos->ops->name;
> +	else
> +		dir_name = rq_qos_id_to_name(rqos->id);

Plase split out a patch to add the name to all the ops and remove
rq_qos_id_to_name, which can be at the beginning of the series.

> +	spin_lock_irq(&q->rqos_lock);
> +	pos = q->rq_qos;
> +	if (pos) {
> +		while (pos->next)
> +			pos = pos->next;
> +		pos->next = rqos;
> +	} else {
> +		q->rq_qos = rqos;
> +	}

I think another really useful prep patch would be to switch the queue
linkage to use a hlist_head instead of all this open coded list
manipulation.

> +	rqos = rq_qos_by_name(q, qosname);
> +	if ((buf[0] == '+' && rqos)) {
> +		ret = -EEXIST;
> +		goto out;
> +	}
> +
> +	if ((buf[0] == '-' && !rqos)) {

These two conditionals have pretty odd extra braces.



[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