Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\blk-mq.c Create Date:2022-07-28 17:11:03
Last Modify:2020-03-17 23:18:05 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:blk_mq_alloc_hctx

Proto:static struct blk_mq_hw_ctx *blk_mq_alloc_hctx(struct request_queue *q, struct blk_mq_tag_set *set, int node)

Type:struct blk_mq_hw_ctx

Parameter:

TypeParameterName
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 = kzalloc_node - allocate zeroed memory from a particular memory node.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).*@node: memory node from which to allocate
2313  If Not hctx Then Go to fail_alloc_hctx
2316  If Not zalloc_cpumask_var_node( & @cpumask: Map of available CPUs where this hctx can run. , gfp, node) Then Go to free_hctx
2319  atomic_set( & @nr_active: Number of active requests. Only used when a tag set is* shared across request queues., 0)
2320  If node == NUMA_NO_NODE Then node = 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  Process spin lock initialization( & @lock: Protects the dispatch list. )
2326  Initialization list head
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  Initialization list head
2336  @ctxs: Array of software queues. = kmalloc_array_node(Setup number of possible processor ids , size of * , gfp, node)
2338  If Not @ctxs: Array of software queues. Then Go to free_cpumask
2341  If sbitmap_init_node( & @ctx_map: Bitmap for each software queue. If bit is on, there is a* pending request in that software queue., Setup number of possible processor ids , 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) Then Go to free_ctxs
2344  @nr_ctx: Number of software queues. = 0
2346  Process spin lock initialization( & @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  Initialization list head
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  If Not @fq: Queue of requests that need to perform a flush operation. Then Go to free_bitmap
2355  If @flags: BLK_MQ_F_* flags. Defines the behaviour of the queue. & BLK_MQ_F_BLOCKING Then init_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  Return hctx
2361  free_bitmap :
2362  sbitmap_free() - Free memory used by a &struct sbitmap.*@sb: Bitmap to free.
2363  free_ctxs :
2364  kfree(@ctxs: Array of software queues. )
2365  free_cpumask :
2366  free_cpumask_var(@cpumask: Map of available CPUs where this hctx can run. )
2367  free_hctx :
2368  kfree(hctx)
2369  fail_alloc_hctx :
2370  Return NULL
Caller
NameDescribe
blk_mq_alloc_and_init_hctx