[PATCH V3 02/10] blk-mq: Introduce blk_mq_dev_map_queues
Christoph Hellwig
hch at lst.de
Mon Jul 12 00:32:33 PDT 2021
> + /*
> + * fallback to default mapping if driver doesn't provide
> + * get_queue_affinity callback
> + */
> + if (!get_queue_affinity) {
> + fallback = true;
> + goto fallback;
> + }
> +
> + for (queue = 0; queue < qmap->nr_queues; queue++) {
> + mask = get_queue_affinity(dev_data, dev_off, queue);
> + if (!mask)
> + goto fallback;
> +
> + for_each_cpu(cpu, mask)
> + qmap->mq_map[cpu] = qmap->queue_offset + queue;
> + }
> +
> + return 0;
> +
> +fallback:
> + if (!fallback) {
> + WARN_ON_ONCE(qmap->nr_queues > 1);
> + blk_mq_clear_mq_map(qmap);
> + return 0;
> + }
> + return blk_mq_map_queues(qmap);
Please remove the NULL get_affinity case and let the callers handle
the fallback. Also I think it makes sense to leave the !mask fallback
case to the callers as well to simplify the calling conventions.
More information about the Linux-nvme
mailing list