end_that_request_first()读不明白
/usr/src/linux/drivers/block/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;
blk_finished_io(nsect);
req->bh = bh->b_reqnext;
bh->b_reqnext = NULL;
bh->b_end_io(bh, uptodate);
if ((bh = req->bh) != NULL) {
req->hard_sector += nsect;
req->hard_nr_sectors -= nsect;
req->sector = req->hard_sector;
req->nr_sectors = req->hard_nr_sectors;
req->current_nr_sectors = bh->b_size >> 9;
req->hard_cur_sectors = req->current_nr_sectors;
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;
}
为什么在if (req->nr_sectors < req->current_nr_sectors) {//??????
req->nr_sectors = req->current_nr_sectors;
printk("end_request: buffer-list destroyed\n");
}就说破坏了缓冲区链呢?
request结构中的hard_sector ,hard_nr_sectors,hard_cur_sectors 是指什么呢? :?: 你可以参考LDD2的第12章block driver里的request部分,上面对这个函数说明了,我没有时间仔细看,你自己看看就明白了。~
然后ulk2,13.4.5.1对request的每一个成员仔细描述了。
enjoy jjww, u know so much now. u must work hard.:-D:-D
gxqing, follow the intruction from jjww, that book is very clear about that.
req->nr_sectors should always >= req->current_nr_sectors; 还差的很远, 由于很多其它事,不能专注于linux kernel, 惭愧 :oops: ... me too:oops::oops::oops: 谢谢两位版主的指点!
request->current_nr_sectors是指请求所包含的第一个bh中扇区数,
request->nr_sectors是指请求所包含的总扇区数,
这些我原来看到了,只是没有地方提到hard_sector ,hard_nr_sectors,hard_cur_sectors这几个域的含义 ULK2 13.4.5.1, 你看了的话, 这几个成员的介绍都有
hard_sector: First sector number of the (real) block device
...... o,my god,我只有ULK1 ULK2在公社里面可以下载. ulk1 is for 2.2 kernel. differ from 2.4
use ulk2.
页:
[1]