hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/uapi/linux/blkzoned.h
....@@ -74,6 +74,15 @@
7474 };
7575
7676 /**
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
+/**
7786 * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
7887 *
7988 * @start: Zone start in 512 B sector units
....@@ -84,12 +93,15 @@
8493 * @non_seq: Flag indicating that the zone is using non-sequential resources
8594 * (for host-aware zoned block devices only).
8695 * @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.
88100 *
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.
93105 */
94106 struct blk_zone {
95107 __u64 start; /* Zone start sector */
....@@ -99,7 +111,9 @@
99111 __u8 cond; /* Zone condition */
100112 __u8 non_seq; /* Non-sequential write resources active */
101113 __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];
103117 };
104118
105119 /**
....@@ -107,7 +121,7 @@
107121 *
108122 * @sector: starting sector of report
109123 * @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.
111125 * @zones: Space to hold @nr_zones @zones entries on reply.
112126 *
113127 * The array of at most @nr_zones must follow this structure in memory.
....@@ -115,14 +129,16 @@
115129 struct blk_zone_report {
116130 __u64 sector;
117131 __u32 nr_zones;
118
- __u8 reserved[4];
132
+ __u32 flags;
119133 struct blk_zone zones[0];
120134 };
121135
122136 /**
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.
126142 */
127143 struct blk_zone_range {
128144 __u64 sector;
....@@ -137,8 +153,21 @@
137153 * sector specified in the report request structure.
138154 * @BLKRESETZONE: Reset the write pointer of the zones in the specified
139155 * 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.
140164 */
141165 #define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report)
142166 #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)
143172
144173 #endif /* _UAPI_BLKZONED_H */