linux内核之块设备一---通用块层bio处理

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

通用块层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
  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值