通用块层bio处理的接口generic_make_request
void generic_make_request(struct bio *bio)
{
if (current->bio_tail) {
/* make_request is active */
*(current->bio_tail) = bio;
bio->bi_next = NULL;
current->bio_tail = &bio->bi_next;
return;
}
/* following loop may be a bit non-obvious, and so deserves some
* explanation.
* Before entering the loop, bio->bi_next is NULL (as all callers
* ensure that) so we have a list with a single bio.
* We pretend that we have just taken it off a longer list, so
* we assign bio_list to the next (which is NULL) and bio_tail
* to &bio_list, thus initialising the bio_list of new bios to be
* added. __generic_make_request may indeed add some more bios
* through a recursive call to generic_make_request. If it
* did, we find a non-NULL value in bio_list and re-enter the loop

本文详细介绍了Linux内核中通用块层的bio处理接口generic_make_request的实现过程,包括bio列表的管理、设备请求队列的查找、扇区重映射以及错误处理等关键步骤,旨在理解块设备驱动的内部工作机制。
最低0.47元/天 解锁文章
269

被折叠的 条评论
为什么被折叠?



