Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\blk-merge.c Create Date:2022-07-28 17:06:02
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

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

Proto:int blk_rq_map_sg(struct request_queue *q, struct request *rq, struct scatterlist *sglist)

Type:int

Parameter:

TypeParameterName
struct request_queue *q
struct request *rq
struct scatterlist *sglist
525  struct scatterlist * sg = NULL
526  nsegs = 0
528  If rq_flags & Look at ->special_vec for the actual data payload instead of thebio chain. Then nsegs = __blk_bvec_map_sg(special_vec, sglist, & sg)
530  Else if bio && bio_op(bio) == REQ_OP_WRITE_SAME Then nsegs = __blk_bvec_map_sg(bio_iovec(bio), sglist, & sg)
532  Else if bio Then nsegs = __blk_bios_map_sg(q, bio, sglist, & sg)
535  If Value for the false possibility is greater at compile time(rq_flags & contains copies of user pages ) && blk_rq_bytes(rq) & dma_pad_mask Then
537  pad_len = (dma_pad_mask & ~blk_rq_bytes(rq)) + 1
540  length += pad_len
541  length of alignment and padding += pad_len
544  If dma_drain_size && dma_drain_needed(rq) Then
545  If op_is_write(req_op(rq)) Then memset(dma_drain_buffer, 0, dma_drain_size)
548  sg_unmark_end - Undo setting the end of the scatterlist*@sg: SG entryScatterlist* Description:* Removes the termination marker from the given entry of the scatterlist.
549  sg = sg_next - return the next scatterlist entry in a list*@sg: The current sg entry* Description:* Usually the next entry will be @sg@ + 1, but if this sg element is part* of a chained scatterlist, it could jump to the start of a new* scatterlist array.
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  If sg Then sg_mark_end - Mark the end of the scatterlist*@sg: SG entryScatterlist* Description:* Marks the passed in sg entry as the termination point for the sg* table. A call to sg_next() on this entry will return NULL.
565  WARN_ON(nsegs > Number of physical segments as sent to the device)
567  Return nsegs
Caller
NameDescribe
bsg_map_buffer