Block device request merging - repeated requests.

David Woodhouse dwmw2 en infradead.org
Lun Ene 31 21:09:17 CST 2000


axboe en suse.de said:
>  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. 

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.

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)


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


axboe en suse.de said:
>  If people think that would be a good idea, I'd be happy to provide
> it.

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.

> 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 :)

/me ducks


--
dwmw2



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



Más información sobre la lista de distribución Ayuda