Re: [PATCH] bsg: Add support for submitting requests at tail of queue

James Bottomley
2009-01-22T22:28:00Z

On Fri, 2009-01-23 at 07:03 +0900, FUJITA Tomonori wrote:
> So, Boaz, what do you want to do exactly? It should have in the patch
> description. I don't want to add something that nobody uses.

OK, can we step back a bit from this? Everyone seems to be talking past
each other. The original complaint was that multiple commands against
the same device issued by SG_IO could be executed "out of order". This
is really irrelevant because we never guarantee execution order in the
first place.

However, if you consider our current at head insertion policy coupled
with a multi-threaded application issuing hundreds of SG_IO requests at
once, you can see we have a potential starvation issue: Commands at the
tail of the queue end up pushed further and further back as more
commands are added to the head. This starvation issue is worth
addressing, I think, and it can only be addressed by allowing tail
insertion.

The original reason for at head is, as you surmise, inherited from sg
and the rationale is largely for error handling: you need error
handling commands to pre-empt everything in the current queue.

James