On Wed, 25 May 2005, Jens Axboe wrote: > On Tue, May 24 2005, Jeff Garzik wrote: > > Jens Axboe wrote: > > >I agree, it's a cleaner approach, with the rq being a container for > > >generel messages as well not just SCSI commands. The one missing piece > > >for that was the rq->end_io() callback so everything doesn't have to go > > >down sync, but that is in now as well. > > > > > >I'll try and cook something up. > > > > Very cool ;) > > This is the base for it. It splits request->flags into two variables: > > - cmd_type. this is not a bitmask, but a value indicating what type of > request this is. > > - cmd_flags. various command modified flags. > > The idea is to add a REQ_TYPE_LINUX_BLOCK request type, where we define > a set of command opcodes that signify an upper level defined function > (such as flush) that is implemented differently at the hardware/driver > level. Basically a way to pass down messages or commands generically. > > I like this better than using scsi opcodes always, it's a cleaner > abstraction. For sending generic commands to a device, we could add a > function ala: > > blk_send_message(queue, unsigned char cmd, completion_callback); > > that would allocate the request, set it up, add to block layer queue, > and call the completion_callback when it is done. So for a flush, a > driver could do > > blk_send_message(q, REQ_LB_OP_FLUSH, flush_done); > > to a target queue. > > What do you think? Heh, very nice! Just what's needed for nbd!:-) NBD has several "threads": 1. the one running in the original nbd-client context, receiving answers from the server and completing requests, 2. the block queue 3. (my addition) block-device operations open, close, ioctl... 1. and 2. are already working in the block queue context, to simplify 3. I also faked those operations with block requests. I didn't go as far as really submitting them to the block layer and completing them respectively, I just used the same request object and inserted it directly into the internal list to process replies in 1. With the current patch from Jens (with some minor extensions) this could be done even nicer. (see also my another post today to linux-scsi) Thanks Guennadi --- Guennadi Liakhovetski - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html