我正在为2.6.43.2-6.fc15上的热插拔PCI存储设备编写块设备驱动程序(因此LDD3与许多功能相比已经过时)而且我无法获得块设备de - 注册顺利。 当设备被删除时,我会拆除gendisk和request_queue,但它挂起在blk_cleanup_queue() 。 据推测,在此之前我忽略了一些与队列相关的进程,但我看不出与我用于参考的内核树中的其他块驱动程序有任何重大的一致差异( memstick , cciss等)。 在整理队列和gendisk之前我应该执行哪些步骤?
我在.open实现.open , .release , .ioctl以及与blk_init_queue(mydev_request, &mydev->lock)附加的mydev_request(struct request_queue *q) blk_init_queue(mydev_request, &mydev->lock) ,但我不确定如何整理队列当请求发生时或取消注册块设备时。
I'm writing a block device driver for a hot-pluggable PCI memory device on 2.6.43.2-6.fc15 (so LDD3 is out of date with respect to a lot of functions) and I'm having trouble getting the block device de-registration to go smoothly. When the device is removed, I go to tear down the gendisk and request_queue, but it hangs on blk_cleanup_queue(). Presumably there's some queue-related process I have neglected to carry out before that, but I can't see any major consistent differences with other block drivers from that kernel tree that i am using for reference (memstick, cciss, etc). What are the steps I should carry out before going to tidy up the queue and gendisk?
I am implementing .open, .release, .ioctl in the block_ops as well as a mydev_request(struct request_queue *q) attached with blk_init_queue(mydev_request, &mydev->lock), but I'm not sure exactly how to tidy the queue either when requests occur or when de-registering the block device.
最满意答案
这是因为没有结束您从队列中获取的请求。 要解决此问题,请按以下方式结束请求:
while ((req = blk_fetch_request(q)) != NULL ) { res = mydev_submit_request_sg(mydev, req); if (res) __blk_end_request_all(req, res); else __blk_end_request_cur (req, res); }This is caused by not ending the requests that you fetch off the queue. To fix it, end the request as follows:
while ((req = blk_fetch_request(q)) != NULL ) { res = mydev_submit_request_sg(mydev, req); if (res) __blk_end_request_all(req, res); else __blk_end_request_cur (req, res); }更多推荐
发布评论