question about end_that_request_first

harry@hebutterworth.freeserve.co.uk
Sat, 1 May 1999 10:56:10 +0100 (BST)


Hi,

I'm looking at the source for end_that_request_first in ll_rw_blk.c:

int
end_that_request_first( struct request *req, int uptodate, char *name )
{
struct buffer_head * bh;
int nsect;

req->errors = 0;
if (!uptodate) {
printk("end_request: I/O error, dev %s (%s), sector %lu\n",
kdevname(req->rq_dev), name, req->sector);
if ((bh = req->bh) != NULL) {
nsect = bh->b_size >> 9;
req->nr_sectors--;
req->nr_sectors &= ~(nsect - 1);
req->sector += nsect;
req->sector &= ~(nsect - 1);
}
}

if ((bh = req->bh) != NULL) {
req->bh = bh->b_reqnext;
bh->b_reqnext = NULL;
bh->b_end_io(bh, uptodate);
if ((bh = req->bh) != NULL) {
req->current_nr_sectors = bh->b_size >> 9;
if (req->nr_sectors < req->current_nr_sectors) {
req->nr_sectors = req->current_nr_sectors;
printk("end_request: buffer-list destroyed\n");
}
req->buffer = bh->b_data;
return 1;
}
}
return 0;
}

and I'm thinking "why doesn't the sector field in the request get updated when
there are more buffer heads on the list?". Doesn't this mean that a driver
which processes the buffer heads on the list one at a time will start trying to
read/write subsequent buffer heads from/to the wrong sector?

If you could explain this little mystery to me I should be most grateful.

Please cc on any reply, thanks, Harry.

-
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/