Re: Block device request merging - repeated requests.

From: Jens Axboe (axboe@suse.de)
Date: Mon Jan 31 2000 - 16:55:35 EST


On Mon, Jan 31 2000, David Woodhouse wrote:
> OK. So - trying to fill in the absent documentation, then:
>
> When writing a block device driver, you can either make it handle clustered
> requests, or not.

Rather you can make it handle clustered requests explicitly, or
you can work CURRENT and not care since as long as you do the right
thing you are handling the clustered requests just fine.

> If you don't want to make it handle clustered requests, then when you get a
> request, you must:
> 1. Transfer CURRENT->current_nr_sectors, in the appropriate direction
> to/from CURRENT->buffer
> 2. Increase CURRENT->sector yourself by CURRENT->current_nr_sectors
> 3. Call end_request(1)

You don't need to increase CURRENT->sector, you just need to keep
track of it. I still think we should sector to refer to the current
cluster, but you can always look at CURRENT->b_rsector and b_blocknr
is you want.

> If you _do_ want to handle clustered requests, then what are you supposed to
> do?

You can just handle the entire request your self, and call use
end_that_request_{first,last} appropriately.

> I can't speak for anyone else - but I think it would be a good idea. I
> certainly would have found it useful if there had been a correct template for
> me to use. My block device code was lifted directly from rd.c, and I
> therefore assume that rd.c doesn't correctly handle clustered requests,
> either.

Oh but it does! The request function of rd is very simple, but it
does look at current_nr_sectors and lets the ll_rw_blk layer
worry about the clusters.

> > It needs some cleaning up, as it also does read gathering of
> > adjacent blocks before writing (it's actually a block layer between
> > ll_rw_blk and another block driver).
>
> If it's going to take much time to clean it up, you might find that it's more
> productive just to write some documentation :)

;) Yes, I suppose I should.

-- 
*  Jens Axboe <axboe@suse.de>
*  Linux CD-ROM Maintainer
*  http://www.kernel.dk

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Feb 07 2000 - 21:00:05 EST