Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__blkdev_issue_discard

Proto:int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp_mask, int flags, struct bio **biop)

Type:int

Parameter:

TypeParameterName
struct block_device *bdev
sector_tsector
sector_tnr_sects
gfp_tgfp_mask
intflags
struct bio **biop
29  q = bdev_get_queue(bdev)
30  bio = biop
34  If Not q Then Return -ENXIO
37  If bdev_read_only(bdev) Then Return -EPERM
40  If flags & ssue a secure erase Then
41  If Not blk_queue_secure_erase(q) Then Return -EOPNOTSUPP
43  op = REQ_OP_SECURE_ERASE
44  Else
45  If Not blk_queue_discard(q) Then Return -EOPNOTSUPP
47  op = REQ_OP_DISCARD
50  bs_mask = (bdev_logical_block_size(bdev) >> 9) - 1
51  If (sector | nr_sects) & bs_mask Then Return -EINVAL
54  If Not nr_sects Then Return -EINVAL
57  When nr_sects cycle
58  req_sects = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(sector_t, nr_sects, 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.)
61  WARN_ON_ONCE((req_sects << 9) > UINT_MAX)
63  bio = blk_next_bio(bio, 0, gfp_mask)
64  device address in 512 byte sectors = sector
65  bio_set_dev(bio, bdev)
66  bsolete, don't use in new code
68  residual I/O count = req_sects << 9
69  sector += req_sects
70  nr_sects -= req_sects
78  cond_resched()
81  biop = bio
82  Return 0
Caller
NameDescribe
blkdev_issue_discardlkdev_issue_discard - queue a discard*@bdev: blockdev to issue discard for*@sector: start sector*@nr_sects: number of sectors to discard*@gfp_mask: memory allocation flags (for bio_alloc)*@flags: BLKDEV_DISCARD_* flags to control behaviour* Description: