| .. | .. |
|---|
| 51 | 51 | * |
|---|
| 52 | 52 | * The Zone Condition state machine in the ZBC/ZAC standards maps the above |
|---|
| 53 | 53 | * deinitions as: |
|---|
| 54 | | - * - ZC1: Empty | BLK_ZONE_EMPTY |
|---|
| 54 | + * - ZC1: Empty | BLK_ZONE_COND_EMPTY |
|---|
| 55 | 55 | * - ZC2: Implicit Open | BLK_ZONE_COND_IMP_OPEN |
|---|
| 56 | 56 | * - ZC3: Explicit Open | BLK_ZONE_COND_EXP_OPEN |
|---|
| 57 | | - * - ZC4: Closed | BLK_ZONE_CLOSED |
|---|
| 58 | | - * - ZC5: Full | BLK_ZONE_FULL |
|---|
| 59 | | - * - ZC6: Read Only | BLK_ZONE_READONLY |
|---|
| 60 | | - * - ZC7: Offline | BLK_ZONE_OFFLINE |
|---|
| 57 | + * - ZC4: Closed | BLK_ZONE_COND_CLOSED |
|---|
| 58 | + * - ZC5: Full | BLK_ZONE_COND_FULL |
|---|
| 59 | + * - ZC6: Read Only | BLK_ZONE_COND_READONLY |
|---|
| 60 | + * - ZC7: Offline | BLK_ZONE_COND_OFFLINE |
|---|
| 61 | 61 | * |
|---|
| 62 | 62 | * Conditions 0x5 to 0xC are reserved by the current ZBC/ZAC spec and should |
|---|
| 63 | 63 | * be considered invalid. |
|---|
| .. | .. |
|---|
| 74 | 74 | }; |
|---|
| 75 | 75 | |
|---|
| 76 | 76 | /** |
|---|
| 77 | + * enum blk_zone_report_flags - Feature flags of reported zone descriptors. |
|---|
| 78 | + * |
|---|
| 79 | + * @BLK_ZONE_REP_CAPACITY: Zone descriptor has capacity field. |
|---|
| 80 | + */ |
|---|
| 81 | +enum blk_zone_report_flags { |
|---|
| 82 | + BLK_ZONE_REP_CAPACITY = (1 << 0), |
|---|
| 83 | +}; |
|---|
| 84 | + |
|---|
| 85 | +/** |
|---|
| 77 | 86 | * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl. |
|---|
| 78 | 87 | * |
|---|
| 79 | 88 | * @start: Zone start in 512 B sector units |
|---|
| .. | .. |
|---|
| 84 | 93 | * @non_seq: Flag indicating that the zone is using non-sequential resources |
|---|
| 85 | 94 | * (for host-aware zoned block devices only). |
|---|
| 86 | 95 | * @reset: Flag indicating that a zone reset is recommended. |
|---|
| 87 | | - * @reserved: Padding to 64 B to match the ZBC/ZAC defined zone descriptor size. |
|---|
| 96 | + * @resv: Padding for 8B alignment. |
|---|
| 97 | + * @capacity: Zone usable capacity in 512 B sector units |
|---|
| 98 | + * @reserved: Padding to 64 B to match the ZBC, ZAC and ZNS defined zone |
|---|
| 99 | + * descriptor size. |
|---|
| 88 | 100 | * |
|---|
| 89 | | - * start, len and wp use the regular 512 B sector unit, regardless of the |
|---|
| 90 | | - * device logical block size. The overall structure size is 64 B to match the |
|---|
| 91 | | - * ZBC/ZAC defined zone descriptor and allow support for future additional |
|---|
| 92 | | - * zone information. |
|---|
| 101 | + * start, len, capacity and wp use the regular 512 B sector unit, regardless |
|---|
| 102 | + * of the device logical block size. The overall structure size is 64 B to |
|---|
| 103 | + * match the ZBC, ZAC and ZNS defined zone descriptor and allow support for |
|---|
| 104 | + * future additional zone information. |
|---|
| 93 | 105 | */ |
|---|
| 94 | 106 | struct blk_zone { |
|---|
| 95 | 107 | __u64 start; /* Zone start sector */ |
|---|
| .. | .. |
|---|
| 99 | 111 | __u8 cond; /* Zone condition */ |
|---|
| 100 | 112 | __u8 non_seq; /* Non-sequential write resources active */ |
|---|
| 101 | 113 | __u8 reset; /* Reset write pointer recommended */ |
|---|
| 102 | | - __u8 reserved[36]; |
|---|
| 114 | + __u8 resv[4]; |
|---|
| 115 | + __u64 capacity; /* Zone capacity in number of sectors */ |
|---|
| 116 | + __u8 reserved[24]; |
|---|
| 103 | 117 | }; |
|---|
| 104 | 118 | |
|---|
| 105 | 119 | /** |
|---|
| .. | .. |
|---|
| 107 | 121 | * |
|---|
| 108 | 122 | * @sector: starting sector of report |
|---|
| 109 | 123 | * @nr_zones: IN maximum / OUT actual |
|---|
| 110 | | - * @reserved: padding to 16 byte alignment |
|---|
| 124 | + * @flags: one or more flags as defined by enum blk_zone_report_flags. |
|---|
| 111 | 125 | * @zones: Space to hold @nr_zones @zones entries on reply. |
|---|
| 112 | 126 | * |
|---|
| 113 | 127 | * The array of at most @nr_zones must follow this structure in memory. |
|---|
| .. | .. |
|---|
| 115 | 129 | struct blk_zone_report { |
|---|
| 116 | 130 | __u64 sector; |
|---|
| 117 | 131 | __u32 nr_zones; |
|---|
| 118 | | - __u8 reserved[4]; |
|---|
| 132 | + __u32 flags; |
|---|
| 119 | 133 | struct blk_zone zones[0]; |
|---|
| 120 | 134 | }; |
|---|
| 121 | 135 | |
|---|
| 122 | 136 | /** |
|---|
| 123 | | - * struct blk_zone_range - BLKRESETZONE ioctl request |
|---|
| 124 | | - * @sector: starting sector of the first zone to issue reset write pointer |
|---|
| 125 | | - * @nr_sectors: Total number of sectors of 1 or more zones to reset |
|---|
| 137 | + * struct blk_zone_range - BLKRESETZONE/BLKOPENZONE/ |
|---|
| 138 | + * BLKCLOSEZONE/BLKFINISHZONE ioctl |
|---|
| 139 | + * requests |
|---|
| 140 | + * @sector: Starting sector of the first zone to operate on. |
|---|
| 141 | + * @nr_sectors: Total number of sectors of all zones to operate on. |
|---|
| 126 | 142 | */ |
|---|
| 127 | 143 | struct blk_zone_range { |
|---|
| 128 | 144 | __u64 sector; |
|---|
| .. | .. |
|---|
| 137 | 153 | * sector specified in the report request structure. |
|---|
| 138 | 154 | * @BLKRESETZONE: Reset the write pointer of the zones in the specified |
|---|
| 139 | 155 | * sector range. The sector range must be zone aligned. |
|---|
| 156 | + * @BLKGETZONESZ: Get the device zone size in number of 512 B sectors. |
|---|
| 157 | + * @BLKGETNRZONES: Get the total number of zones of the device. |
|---|
| 158 | + * @BLKOPENZONE: Open the zones in the specified sector range. |
|---|
| 159 | + * The 512 B sector range must be zone aligned. |
|---|
| 160 | + * @BLKCLOSEZONE: Close the zones in the specified sector range. |
|---|
| 161 | + * The 512 B sector range must be zone aligned. |
|---|
| 162 | + * @BLKFINISHZONE: Mark the zones as full in the specified sector range. |
|---|
| 163 | + * The 512 B sector range must be zone aligned. |
|---|
| 140 | 164 | */ |
|---|
| 141 | 165 | #define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report) |
|---|
| 142 | 166 | #define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range) |
|---|
| 167 | +#define BLKGETZONESZ _IOR(0x12, 132, __u32) |
|---|
| 168 | +#define BLKGETNRZONES _IOR(0x12, 133, __u32) |
|---|
| 169 | +#define BLKOPENZONE _IOW(0x12, 134, struct blk_zone_range) |
|---|
| 170 | +#define BLKCLOSEZONE _IOW(0x12, 135, struct blk_zone_range) |
|---|
| 171 | +#define BLKFINISHZONE _IOW(0x12, 136, struct blk_zone_range) |
|---|
| 143 | 172 | |
|---|
| 144 | 173 | #endif /* _UAPI_BLKZONED_H */ |
|---|