Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:blk_bio_discard_split

Proto:static struct bio *blk_bio_discard_split(struct request_queue *q, struct bio *bio, struct bio_set *bs, unsigned *nsegs)

Type:struct bio

Parameter:

TypeParameterName
struct request_queue *q
struct bio *bio
struct bio_set *bs
unsigned *nsegs
71  nsegs = 1
74  granularity = max - return maximum of two values of the same or compatible types*@x: first value*@y: second value(discard_granularity >> 9, 1U)
76  max_discard_sectors = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(max_discard_sectors, The max size one bio can handle is UINT_MAX becasue bvec_iter.bi_size* is defined as 'unsigned int', meantime it has to aligned to with logical* block size which is the minimum accepted unit by hardware.)
78  max_discard_sectors -= max_discard_sectors % granularity
80  If Value for the false possibility is greater at compile time(!max_discard_sectors) Then
82  Return NULL
85  If bio_sectors(bio) <= max_discard_sectors Then Return NULL
88  split_sectors = max_discard_sectors
94  alignment = (discard_alignment >> 9) % granularity
96  tmp = device address in 512 byte sectors + split_sectors - alignment
97  tmp = sector_div(tmp, granularity)
99  If split_sectors > tmp Then split_sectors -= tmp
102  Return _split - split a bio*@bio: bio to split*@sectors: number of sectors to split from the front of @bio*@gfp: gfp mask*@bs: bio set to allocate from* Allocates and returns a new bio which represents @sectors from the start of
Caller
NameDescribe
__blk_queue_split__blk_queue_split - split a bio and submit the second half*@q: [in] request queue pointer*@bio: [in, out] bio to be split*@nr_segs: [out] number of segments in the first bio* Split a bio into two bios, chain the two bios, submit the second half and