函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\blk-mq.c Create Date:2022-07-27 18:46:24
Last Modify:2020-03-17 23:18:05 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:blk_mq_alloc_hctx

函数原型:static struct blk_mq_hw_ctx *blk_mq_alloc_hctx(struct request_queue *q, struct blk_mq_tag_set *set, int node)

返回类型:struct blk_mq_hw_ctx

参数:

类型参数名称
struct request_queue *q
struct blk_mq_tag_set *set
intnode
2310  gfp等于GFP_NOIO按位或DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.按位或__GFP_NORETRY
2312  hctx等于根据内存节点分配内存
2313  如果非hctx则转到:fail_alloc_hctx
2316  如果非zalloc_cpumask_var_node( & @cpumask: Map of available CPUs where this hctx can run. , gfp, node)则转到:free_hctx
2319  atomic_set( & @nr_active: Number of active requests. Only used when a tag set is* shared across request queues., 0)
2320  如果node恒等于NUMA_NO_NODEnode等于numa_node
2322  @numa_node: NUMA node the storage adapter has been connected to. 等于node
2324  INIT_DELAYED_WORK( & @run_work: Used for scheduling a hardware queue run at a later time., blk_mq_run_work_fn)
2325  spin_lock_init( & @lock: Protects the dispatch list. )
2326  初始化链表头
2327  @queue: Pointer to the request queue that owns this hardware context.等于q
2328  @flags: BLK_MQ_F_* flags. Defines the behaviour of the queue. 等于flags按位与BLK_MQ_F_TAG_SHARED的反
2330  初始化链表头
2336  @ctxs: Array of software queues. 等于kmalloc_array_node(CPU数量, *的长度, gfp, node)
2338  如果非@ctxs: Array of software queues. 则转到:free_cpumask
2341  如果sbitmap_init_node( & @ctx_map: Bitmap for each software queue. If bit is on, there is a* pending request in that software queue., CPU数量, log2 - log base 2 of 32-bit or a 64-bit unsigned value*@n: parameter* constant-capable log of base 2 calculation* - this can be used to initialise global variables from constant data, hence* the massive ternary operator construction* selects the (8), gfp, node)则转到:free_ctxs
2344  @nr_ctx: Number of software queues. 等于0
2346  spin_lock_init( & @dispatch_wait_lock: Lock for dispatch_wait queue. )
2347  init_waitqueue_func_entry( & @dispatch_wait: Waitqueue to put requests when there is no tag* available at the moment, to wait for another try in the future., blk_mq_dispatch_wake)
2348  初始化链表头
2350  @fq: Queue of requests that need to perform a flush operation. 等于blk_alloc_flush_queue(q, @numa_node: NUMA node the storage adapter has been connected to. , cmd_size, gfp)
2352  如果非@fq: Queue of requests that need to perform a flush operation. 则转到:free_bitmap
2355  如果@flags: BLK_MQ_F_* flags. Defines the behaviour of the queue. 按位与BLK_MQ_F_BLOCKINGinit_srcu_struct(@srcu: Sleepable RCU. Use as lock when type of the hardware queue is* blocking (BLK_MQ_F_BLOCKING). Must be the last member - see also* blk_mq_hw_ctx_size().)
2357  blk_mq_hctx_kobj_init(hctx)
2359  返回:hctx
2361  free_bitmap :
2362  sbitmap_free() - Free memory used by a &struct sbitmap.*@sb: Bitmap to free.
2363  free_ctxs :
2364  释放内存
2365  free_cpumask :
2366  释放CPU掩码
2367  free_hctx :
2368  释放内存
2369  fail_alloc_hctx :
2370  返回:NULL
调用者
名称描述
blk_mq_alloc_and_init_hctx