Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:_alloc_bioset - allocate a bio for I/O*@gfp_mask: the GFP_* mask given to the slab allocator*@nr_iovecs: number of iovecs to pre-allocate*@bs: the bio_set to allocate from

Proto:struct bio *bio_alloc_bioset(gfp_t gfp_mask, unsigned int nr_iovecs, struct bio_set *bs)

Type:struct bio

Parameter:

TypeParameterName
gfp_tgfp_mask
unsigned intnr_iovecs
struct bio_set *bs
432  saved_gfp = gfp_mask
435  struct bio_vec * bvl = NULL
439  If Not bs Then
440  If nr_iovecs > UIO_MAXIOV Then Return NULL
443  p = Allocation memory
446  front_pad = 0
447  inline_vecs = nr_iovecs
448  Else
450  If WARN_ON_ONCE(!mempool_initialized( & bvec_pool) && nr_iovecs > 0) Then Return NULL
474  If bio_list && ( Not bio_list_empty( & bio_list[0]) || Not bio_list_empty( & bio_list[1]) ) && rescue_workqueue Then gfp_mask &= ~Caller can reclaim
480  p = mempool_alloc - allocate an element from a specific memory pool*@pool: pointer to the memory pool which was allocated via* mempool_create().*@gfp_mask: the usual allocation bitmask.* this function only sleeps if the alloc_fn() function sleeps or
481  If Not p && gfp_mask != saved_gfp Then
487  front_pad = front_pad
488  inline_vecs = Test patch to inline a certain number of bi_io_vec's inside the bio* itself, to shrink a bio data allocation from two mempool calls to one
491  If Value for the false possibility is greater at compile time(!p) Then Return NULL
494  bio = p + front_pad
495  Users of this function have their own bio allocation. Subsequently,* they must remember to pair any call to bio_init() with bio_uninit()* when IO has completed, or when the bio is released.
497  If nr_iovecs > inline_vecs Then
498  idx = 0
500  bvl = bvec_alloc(gfp_mask, nr_iovecs, & idx, & bvec_pool)
501  If Not bvl && gfp_mask != saved_gfp Then
507  If Value for the false possibility is greater at compile time(!bvl) Then Go to err_free
510  status, etc and bvec pool number |= idx << BVEC_POOL_OFFSET
511  Else if nr_iovecs Then
512  bvl = * We can inline a number of vecs at the end of the bio, to avoid * double allocations for a small number of bio_vecs. This member * MUST obviously be kept at the very end of the bio.
515  bi_pool = bs
516  max bvl_vecs we can hold = nr_iovecs
517  the actual vec list = bvl
518  Return bio
520  err_free :
521  mempool_free - return an element to the pool.*@element: pool element pointer.*@pool: pointer to the memory pool which was allocated via* mempool_create().* this function only sleeps if the free_fn() function sleeps.
522  Return NULL
Caller
NameDescribe
bio_clone_fast_clone_fast - clone a bio that shares the original bio's biovec*@bio: bio to clone*@gfp_mask: allocation priority*@bs: bio_set to allocate from* Like __bio_clone_fast, only also allocates the returned bio
bounce_clone_bio
iomap_alloc_ioend
bio_alloc
bio_kmalloc