Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\bio.c Create Date:2022-07-28 16:54:32
Last Modify:2020-03-17 23:13:58 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:bio_find_or_create_slab

Proto:static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)

Type:struct kmem_cache

Parameter:

TypeParameterName
unsigned intextra_size
64  sz = sizeof(structbio) + extra_size
65  struct kmem_cache * slab = NULL
68  entry = -1
70  mutex_lock( & bio_slab_lock)
72  i = 0
73  When i < bio_slab_nr cycle
74  bslab = bio_slabs[i]
76  If Not slab && entry == -1 Then entry = i
78  Else if slab_size == sz Then
79  slab = slab
80  slab_ref++
81  Break
83  i++
86  If slab Then Go to out_unlock
89  If bio_slab_nr == bio_slab_max && entry == -1 Then
90  new_bio_slab_max = bio_slab_max << 1
91  new_bio_slabs = krealloc - reallocate memory. The contents will remain unchanged.*@p: object to reallocate memory for.*@new_size: how many bytes of memory are required.*@flags: the type of memory to allocate.* The contents of the object pointed to are preserved up to the
94  If Not new_bio_slabs Then Go to out_unlock
96  bio_slab_max = new_bio_slab_max
97  bio_slabs = new_bio_slabs
99  If entry == -1 Then entry = bio_slab_nr++
102  bslab = bio_slabs[entry]
104  snprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@
105  slab = kmem_cache_create - Create a cache.*@name: A string which is used in /proc/slabinfo to identify this cache.*@size: The size of objects to be created in this cache.*@align: The required alignment for the objects.*@flags: SLAB flags
107  If Not slab Then Go to out_unlock
110  slab = slab
111  slab_ref = 1
112  slab_size = sz
113  out_unlock :
114  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
115  Return slab
Caller
NameDescribe
bioset_initset_init - Initialize a bio_set*@bs: pool to initialize*@pool_size: Number of bio and bio_vecs to cache in the mempool*@front_pad: Number of bytes to allocate in front of the returned bio*@flags: Flags to modify behavior, currently %BIOSET_NEED_BVECS* and