Re: [PATCH] megaraid_sas: Enable shared tag map

Christoph Hellwig
2014-10-02T14:32:58Z

On Thu, Oct 02, 2014 at 02:00:32PM +0200, Hannes Reinecke wrote:
> Actually, I've hit a similar issue for megaraid_sas (and I guess
> others which implement a host-wide tag map might suffer here, too):
> tags need to be used even for internal commands.
> But tag allocation is done exclusively in the block layer, so one
> cannot readily influence this.
> (Or, if you do, you'll end up with code duplication like the fnic
> driver).
> Thing is, for internal commands we typically do not _need_ a fully
> formed request, we just need to tag number.

blk-mq allows a driver to reserve tags, and allocate them using
blk_mq_alloc_request with the reserved flag. Take a look at the
mtip32xx driver, which is using that feature.

The lockless hpsa series has a patch to expose the nr of reserved
tags to scsi, but there is no equivalent in the old blk code yet.

Another issue is that we only setup the tag allocator at scsi_add_host
time, and to fully support drivers that needs tags during initialization
we need move it to scsi_host_alloc time, which doesn't sound like a
major problem.