红联Linux门户
Linux帮助

块设备驱动 请教

发布时间:2006-05-30 23:31:18来源:红联作者:gg940231
小弟目前参考《LINUX驱动 第3版》的块设备驱动sbull.c,在写自己的驱动程序,目前的问题是:
比如:在用 CP 命令拷贝文件的时候,
当底层读写函数出错后,上层还在不停的发送新的读写请求,当所有的请求发送完了后,系统才退出,回到命令行状态。
请问,有没有什么办法,让系统不在处理后续的请求,并立即退出回到命令行状态呢?
还请各位大侠多多指点啊,小弟先谢谢了!!!


static void sbull_full_request(request_queue_t *q)
{
struct request *req;
int sectors_xferred;
struct sbull_dev *dev = q->queuedata;

while ((req = elv_next_request(q)) != NULL) {
if (! blk_fs_request(req)) {
printk (KERN_NOTICE "Skip non-fs request\n");
end_request(req, 0);
continue;
}
sectors_xferred = sbull_xfer_request(dev, req);
if (! end_that_request_first(req, 1, sectors_xferred)) {
blkdev_dequeue_request(req);
end_that_request_last(req);
}
}
}
文章评论

共有 1 条评论

  1. gg940231 于 2006-05-31 22:37:14发表:

    那位大侠指点下把,先谢谢了