Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:lkdev_zone_mgmt - Execute a zone management operation on a range of zones*@bdev: Target block device*@op: Operation to be performed on the zones*@sector: Start sector of the first zone to operate on*@nr_sectors: Number of sectors, should be at least the

Proto:int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op, sector_t sector, sector_t nr_sectors, gfp_t gfp_mask)

Type:int

Parameter:

TypeParameterName
struct block_device *bdev
enum req_opfop
sector_tsector
sector_tnr_sectors
gfp_tgfp_mask
160  q = bdev_get_queue(bdev)
161  zone_sectors = blk_queue_zone_sectors(q)
162  capacity = get_capacity(bd_disk)
163  end_sector = sector + nr_sectors
164  struct bio * bio = NULL
167  If Not blk_queue_is_zoned(q) Then Return -EOPNOTSUPP
170  If bdev_read_only(bdev) Then Return -EPERM
173  If Not Check if a bio or request operation is a zone management operation, with* the exception of REQ_OP_ZONE_RESET_ALL which is treated as a special case* due to its different handling in the block layer and device response in* case of command failure. Then Return -EOPNOTSUPP
176  If Not nr_sectors || end_sector > capacity Then Return -EINVAL
181  If sector & zone_sectors - 1 Then Return -EINVAL
184  If nr_sectors & zone_sectors - 1 && end_sector != capacity Then Return -EINVAL
187  When sector < end_sector cycle
188  bio = blk_next_bio(bio, 0, gfp_mask)
189  bio_set_dev(bio, bdev)
198  Break
201  bottom bits req flags, * top bits REQ_OP. Use * accessors. = op
202  device address in 512 byte sectors = sector
203  sector += zone_sectors
206  cond_resched()
209  ret = submit_bio_wait - submit a bio, and wait until it completes*@bio: The &struct bio which describes the I/O* Simple wrapper around submit_bio()
210  _put - release a reference to a bio*@bio: bio to release reference to* Description:* Put a reference to a &struct bio, either one you have gotten with* bio_alloc, bio_get or bio_clone_*. The last put of a bio will free it.
212  Return ret
Caller
NameDescribe
blkdev_zone_mgmt_ioctlBLKRESETZONE, BLKOPENZONE, BLKCLOSEZONE and BLKFINISHZONE ioctl processing.* Called from blkdev_ioctl.