|
最近看cowloop-3.0的源代码,对request有一些疑问,
在cowloop.c中的cowlo_do_request函数中对request处理时,直接把request中的buffer做为请求中的数据,
这个req->buffer与bio是什么关系,如何把bio中的数据映射到req->buffer中去的?
static long int
cowlo_do_request(struct request *req)
{
................
................
................
len = req->current_nr_sectors << 9;
offset = (loff_t) req->sector << 9;
................
................
................
switch (rq_data_dir(req)) {
/**********************************************************/
case READ:
switch ( cowlo_checkio(cowdev, len, offset) ) {
case ALLCOW:
rv = cowlo_readcow(cowdev, req->buffer, len, offset);
break;
case ALLRDO:
rv = cowlo_readrdo(cowdev, req->buffer, len, offset);
break;
case MIXEDUP:
rv = cowlo_readmix(cowdev, req->buffer, len, offset);
break;
default:
rv = 0; /* never happens */
}
break;
................
................
................
return (rv <= 0 ? 0 : 1);
} |
|