函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\blk-merge.c Create Date:2022-07-27 18:41:20
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:map a request to scatterlist, return number of sg entries setup. Caller* must make sure sg can hold rq->nr_phys_segments entries

函数原型:int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist)

返回类型:int

参数:

类型参数名称
struct request_queue *q
struct request *rq
struct scatterlist *sglist
525  struct scatterlist * sg = NULL
526  nsegs等于0
528  如果rq_flags按位与Look at ->special_vec for the actual data payload instead of thebio chain. nsegs等于__blk_bvec_map_sg(special_vec, sglist, & sg)
530  否则如果biobio_op(bio)恒等于REQ_OP_WRITE_SAMEnsegs等于__blk_bvec_map_sg(bio_iovec(bio), sglist, & sg)
532  否则如果bionsegs等于__blk_bios_map_sg(q, bio, sglist, & sg)
535  如果此条件成立可能性小(为编译器优化)(rq_flags & contains copies of user pages )且blk_rq_bytes(rq)按位与dma_pad_mask
537  pad_len等于dma_pad_mask按位与blk_rq_bytes(rq)的反的值加1
540  length加等于pad_len
541  length of alignment and padding 加等于pad_len
544  如果dma_drain_sizedma_drain_needed(rq)则
545  如果op_is_write(req_op(rq))则memset(dma_drain_buffer, 0, dma_drain_size)
548  取消设置的散列表结束标记
549  sg等于 返回下一个散列表的条目
550  sg_set_page - Set sg entry to point at given page*@sg: SG entry*@page: The page*@len: Length of data*@offset: Offset into page* Description:* Use this function to set an sg entry pointing at a page, never assign* the page directly
554  nsegs自加
555  length of alignment and padding 加等于dma_drain_size
558  如果sg标记散列表结束
565  WARN_ON(nsegs > Number of physical segments as sent to the device)
567  返回:nsegs
调用者
名称描述
bsg_map_buffer