函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:block\blk-mq.c Create Date:2022-07-27 18:44:49
首页 Copyright©Brick

1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
bool blk_mq_get_driver_tag(struct request *rq)
{
    struct blk_mq_alloc_data data = {
        .q = rq->q,
        .hctx = rq->mq_hctx,
        .flags = BLK_MQ_REQ_NOWAIT,
        .cmd_flags = rq->cmd_flags,
    };
    bool shared;
 
    if (rq->tag != -1)
        return true;
 
    if (blk_mq_tag_is_reserved(data.hctx->sched_tags, rq->internal_tag))
        data.flags |= BLK_MQ_REQ_RESERVED;
 
    shared = blk_mq_tag_busy(data.hctx);
    rq->tag = blk_mq_get_tag(&data);
    if (rq->tag >= 0) {
        if (shared) {
            rq->rq_flags |= RQF_MQ_INFLIGHT;
            atomic_inc(&data.hctx->nr_active);
        }
        data.hctx->tags->rqs[rq->tag] = rq;
    }
 
    return rq->tag != -1;
}