On Thu, Aug 08, 2019 at 12:10:55PM -0700, James Bottomley wrote: > Since this will be an extension of something that exists both in your > sg driver and in the block bsg interface (and thus needs an > implementation there), I added both linux-block and linux-api to the cc > (the latter because you're adding to an API). > > Simply extending sg to use the v4 header protocol in uapi/linux/bsg.h > is fine modulo the code being in the right form. The problems are the > new ioctls you want to add that would need to be present there as well. > The specific question being how we support async or non-blocking I/O > on the sg and bsg interfaces. The standard way we add asynchronous I/O > is supposed to be via .poll on the file descriptor. you already use > read and write in sg and bsg doesn't have a polling interface, but it > looks like we could use MSG to signal an ioctl is ready to be serviced > for both. Would shifting to a non-blocking poll based interface for > ioctls remove the need to add these SG_IOSUBMIT/SG_IORECEIVE ioctls > since we could now do everything over blocking or non-blocking SG_IO?
I've spent some wading through this patchset, and it is huge. I thing we need to stage it a bit better and split it into multiple. 1) One (or maybe even multiple) with all the cleanups and minor speedups. That alone is a lot of changes, and will take a while to settle 2) extending the bsg/v4 API to /dev/sg. I think that is very useful, although I need to look at the details a bit more 3) adding a new async API. While this seems very useful from the theoretical perspective, I really thing the guts need to be in common code and then be used by sg and the block device nodes (if it happens to be an ioctl). What worries me a bit there is that we have another way to deal with async I/O. I wonder if we can fit this into aio/io_uring somehow. But I'd rather not even thing about that much until we've done all the groundwork.