Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Helper function to check the validity of zones of a zoned block device.

Proto:static int blk_revalidate_zone_cb(struct blk_zone *zone, unsigned int idx, void *data)

Type:int

Parameter:

TypeParameterName
struct blk_zone *zone
unsigned intidx
void *data
356  args = data
357  disk = disk
358  q = queue
359  capacity = get_capacity(disk)
365  If Zone start sector == 0 Then
367  pr_warn("%s: Invalid zoned device with non power of two zone size (%llu)\n", name of major driver , Zone length in number of sectors )
369  Return -ENODEV
372  zone_sectors = Zone length in number of sectors
373  nr_zones = capacity + Zone length in number of sectors - 1 >> log2 - log base 2 of 32-bit or a 64-bit unsigned value*@n: parameter* constant-capable log of base 2 calculation* - this can be used to initialise global variables from constant data, hence* the massive ternary operator construction* selects the (Zone length in number of sectors )
374  Else if Zone start sector + zone_sectors < capacity Then
376  pr_warn("%s: Invalid zoned device with non constant zone size\n", name of major driver )
378  Return -ENODEV
380  Else
382  pr_warn("%s: Invalid zoned device with larger last zone size\n", name of major driver )
384  Return -ENODEV
389  If Zone start sector != sector Then
390  pr_warn("%s: Zone gap at sectors %llu..%llu\n", name of major driver , sector, Zone start sector )
392  Return -ENODEV
398  If Not conv_zones_bitmap Then
405  Break
406  Case Zone type == BLK_ZONE_TYPE_SEQWRITE_REQ
408  If Not seq_zones_wlock Then
414  Break
415  Default
416  pr_warn("%s: Invalid zone type 0x%x at sectors %llu\n", name of major driver , (int)Zone type , Zone start sector )
418  Return -ENODEV
421  sector += Zone length in number of sectors
422  Return 0