函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__blkdev_issue_discard

函数原型:int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp_mask, int flags, struct bio **biop)

返回类型:int

参数:

类型参数名称
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  如果非q则返回:负ENXIO
37  如果bdev_read_only(bdev)则返回:负EPERM
40  如果flags按位与ssue a secure erase
41  如果非blk_queue_secure_erase(q)则返回:负EOPNOTSUPP
43  op等于REQ_OP_SECURE_ERASE
44  否则
45  如果非blk_queue_discard(q)则返回:负EOPNOTSUPP
47  op等于REQ_OP_DISCARD
50  bs_mask等于bdev_logical_block_size(bdev)右移9位的值减1
51  如果sector按位或nr_sects的值按位与bs_mask则返回:负EINVAL
54  如果非nr_sects则返回:负EINVAL
57 nr_sects循环
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  返回:0
调用者
名称描述
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: