Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:_map_kern - map kernel address into bio*@q: the struct request_queue for the bio*@data: pointer to buffer to map*@len: length in bytes*@gfp_mask: allocation flags for bio allocation* Map the kernel address into a bio suitable for io to a block* device

Proto:struct bio *bio_map_kern(struct request_queue *q, void *data, unsigned int len, gfp_t gfp_mask)

Type:struct bio

Parameter:

TypeParameterName
struct request_queue *q
void *data
unsigned intlen
gfp_tgfp_mask
1520  kaddr = data
1521  end = kaddr + len + PAGE_SIZE - 1 >> PAGE_SHIFT determines the page size
1522  start = kaddr >> PAGE_SHIFT determines the page size
1523  nr_pages = end - start
1524  is_vmalloc = Determine if an address is within the vmalloc range* On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there* is no special casing required.
1529  bio = bio_kmalloc(gfp_mask, nr_pages)
1530  If Not bio Then Return ERR_PTR( - ENOMEM)
1533  If is_vmalloc Then
1534  flush_kernel_vmap_range(data, len)
1535  bi_private = data
1538  offset = offset_in_page(kaddr)
1539  When i < nr_pages cycle
1540  bytes = PAGE_SIZE - offset
1542  If len <= 0 Then Break
1545  If bytes > len Then bytes = len
1548  If Not is_vmalloc Then page = virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(data)
1550  Else page = vmalloc_to_page(data)
1552  If bio_add_pc_page(q, bio, page, bytes, offset) < bytes Then
1556  Return ERR_PTR( - EINVAL)
1559  data += bytes
1560  len -= bytes
1561  offset = 0
1564  bi_end_io = bio_map_kern_endio
1565  Return bio
Caller
NameDescribe
blk_rq_map_kernlk_rq_map_kern - map kernel data to a request, for passthrough requests*@q: request queue where request should be inserted*@rq: request to fill*@kbuf: the kernel buffer*@len: length of user data*@gfp_mask: memory allocation flags* Description: