Re: Block device request merging - repeated requests.

From: Jens Axboe (axboe@suse.de)
Date: Mon Jan 31 2000 - 12:04:51 EST


On Mon, Jan 31 2000, David Woodhouse wrote:
> axboe@suse.de said:
> > No, CURRENT->sector is always the "current" sector. When you call
> > end_request, end_that_request_first will adjust rq->sector for you.
>
> I only see a modification of req->sector in the !uptodate case.
>
> I get 'correct' behaviour if I add the following line immediately before
> every occurrence of end_request(1) in my driver:
> CURRENT->sector += CURRENT->current_nr_sectors;
>
> # dd if=nftl.c bs=512 of=/dev/nftla count=6
> NFTL write request of 0x2 sectors @ 0 (CURRENT->nr_sectors == 6
> NFTL write request completed OK
> NFTL write request of 0x2 sectors @ 2 (CURRENT->nr_sectors == 6
> NFTL write request completed OK
> NFTL write request of 0x2 sectors @ 4 (CURRENT->nr_sectors == 6
> NFTL write request completed OK

You are right, I spoke too quickly, you do have to keep track of
what sector you are working on. But I don't see why we shouldn't
update rq->sector regardless of outcome.

> > The logic goes something like this:
> > - receive request
> > - transfer CURRENT->current_nr_sectors
> > - end_request
>
> That's what I'm doing, modulo any stupid mistakes on my part - which is
> unlikely since this code hasn't changed for a while, and it worked before.

The rest of your request function looks fine.

> > FWIW, I have verified request handling with a dummy driver I wrote. It
> > even handles merged requests with "holes", i.e. non-consequitive
> > buffer heads.
>
> I think it would be a very good idea to include that in the kernel tree, as
> with drivers/net/skeleton.c.
>
> Please could I have a copy?

If people think that would be a good idea, I'd be happy to provide it.
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).

-- 
*  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 Jan 31 2000 - 21:00:28 EST