Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:_map_user_iov - map user iovec into bio*@q: the struct request_queue for the bio*@iter: iovec iterator*@gfp_mask: memory allocation flags* Map the user space address into a bio suitable for io to a block* device. Returns an error pointer in case of error.

Proto:struct bio *bio_map_user_iov(struct request_queue *q, struct iov_iter *iter, gfp_t gfp_mask)

Type:struct bio

Parameter:

TypeParameterName
struct request_queue *q
struct iov_iter *iter
gfp_tgfp_mask
1398  If Not iov_iter_count(iter) Then Return ERR_PTR( - EINVAL)
1401  bio = bio_kmalloc(gfp_mask, iov_iter_npages(iter, BIO_MAX_PAGES))
1402  If Not bio Then Return ERR_PTR( - ENOMEM)
1405  When iov_iter_count(iter) cycle
1408  added = 0
1411  bytes = iov_iter_get_pages_alloc(iter, & pages, LONG_MAX, & offs)
1413  ret = If bytes Then bytes Else -EFAULT
1414  Go to out_unmap
1417  npages = DIV_ROUND_UP(offs + bytes, PAGE_SIZE)
1420  ret = -EINVAL
1421  j = 0
1422  Else
1423  When j < npages cycle
1447  When j < npages cycle
1448  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
1449  kvfree() - Free memory.*@addr: Pointer to allocated memory.* kvfree frees memory allocated by any of vmalloc(), kmalloc() or kvmalloc().* It is slightly more efficient to use kfree() or vfree() if you are certain* that you know which one to use.
1451  If bytes Then Break
1455  bio_set_flag(bio, BIO_USER_MAPPED)
1463  get a reference to a bio, so it won't disappear. the intended use is* something like:* bio_get(bio);* submit_bio(rw, bio);* if (bio->bi_flags ...)* do_something* bio_put(bio);* without the bio_get(), it could potentially complete I/O before submit_bio
1464  Return bio
1466  out_unmap :
1467  bio_release_pages(bio, false)
1468  _put - release a reference to a bio*@bio: bio to release reference to* Description:* Put a reference to a &struct bio, either one you have gotten with* bio_alloc, bio_get or bio_clone_*. The last put of a bio will free it.
1469  Return ERR_PTR(ret)
Caller
NameDescribe
__blk_rq_map_user_iov