![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 0002 /* 0003 * Zoned block devices handling. 0004 * 0005 * Copyright (C) 2015 Seagate Technology PLC 0006 * 0007 * Written by: Shaun Tancheff <shaun.tancheff@seagate.com> 0008 * 0009 * Modified by: Damien Le Moal <damien.lemoal@hgst.com> 0010 * Copyright (C) 2016 Western Digital 0011 * 0012 * This file is licensed under the terms of the GNU General Public 0013 * License version 2. This program is licensed "as is" without any 0014 * warranty of any kind, whether express or implied. 0015 */ 0016 #ifndef _UAPI_BLKZONED_H 0017 #define _UAPI_BLKZONED_H 0018 0019 #include <linux/types.h> 0020 #include <linux/ioctl.h> 0021 0022 /** 0023 * enum blk_zone_type - Types of zones allowed in a zoned device. 0024 * 0025 * @BLK_ZONE_TYPE_CONVENTIONAL: The zone has no write pointer and can be writen 0026 * randomly. Zone reset has no effect on the zone. 0027 * @BLK_ZONE_TYPE_SEQWRITE_REQ: The zone must be written sequentially 0028 * @BLK_ZONE_TYPE_SEQWRITE_PREF: The zone can be written non-sequentially 0029 * 0030 * Any other value not defined is reserved and must be considered as invalid. 0031 */ 0032 enum blk_zone_type { 0033 BLK_ZONE_TYPE_CONVENTIONAL = 0x1, 0034 BLK_ZONE_TYPE_SEQWRITE_REQ = 0x2, 0035 BLK_ZONE_TYPE_SEQWRITE_PREF = 0x3, 0036 }; 0037 0038 /** 0039 * enum blk_zone_cond - Condition [state] of a zone in a zoned device. 0040 * 0041 * @BLK_ZONE_COND_NOT_WP: The zone has no write pointer, it is conventional. 0042 * @BLK_ZONE_COND_EMPTY: The zone is empty. 0043 * @BLK_ZONE_COND_IMP_OPEN: The zone is open, but not explicitly opened. 0044 * @BLK_ZONE_COND_EXP_OPEN: The zones was explicitly opened by an 0045 * OPEN ZONE command. 0046 * @BLK_ZONE_COND_CLOSED: The zone was [explicitly] closed after writing. 0047 * @BLK_ZONE_COND_FULL: The zone is marked as full, possibly by a zone 0048 * FINISH ZONE command. 0049 * @BLK_ZONE_COND_READONLY: The zone is read-only. 0050 * @BLK_ZONE_COND_OFFLINE: The zone is offline (sectors cannot be read/written). 0051 * 0052 * The Zone Condition state machine in the ZBC/ZAC standards maps the above 0053 * deinitions as: 0054 * - ZC1: Empty | BLK_ZONE_EMPTY 0055 * - ZC2: Implicit Open | BLK_ZONE_COND_IMP_OPEN 0056 * - ZC3: Explicit Open | BLK_ZONE_COND_EXP_OPEN 0057 * - ZC4: Closed | BLK_ZONE_CLOSED 0058 * - ZC5: Full | BLK_ZONE_FULL 0059 * - ZC6: Read Only | BLK_ZONE_READONLY 0060 * - ZC7: Offline | BLK_ZONE_OFFLINE 0061 * 0062 * Conditions 0x5 to 0xC are reserved by the current ZBC/ZAC spec and should 0063 * be considered invalid. 0064 */ 0065 enum blk_zone_cond { 0066 BLK_ZONE_COND_NOT_WP = 0x0, 0067 BLK_ZONE_COND_EMPTY = 0x1, 0068 BLK_ZONE_COND_IMP_OPEN = 0x2, 0069 BLK_ZONE_COND_EXP_OPEN = 0x3, 0070 BLK_ZONE_COND_CLOSED = 0x4, 0071 BLK_ZONE_COND_READONLY = 0xD, 0072 BLK_ZONE_COND_FULL = 0xE, 0073 BLK_ZONE_COND_OFFLINE = 0xF, 0074 }; 0075 0076 /** 0077 * enum blk_zone_report_flags - Feature flags of reported zone descriptors. 0078 * 0079 * @BLK_ZONE_REP_CAPACITY: Zone descriptor has capacity field. 0080 */ 0081 enum blk_zone_report_flags { 0082 BLK_ZONE_REP_CAPACITY = (1 << 0), 0083 }; 0084 0085 /** 0086 * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl. 0087 * 0088 * @start: Zone start in 512 B sector units 0089 * @len: Zone length in 512 B sector units 0090 * @wp: Zone write pointer location in 512 B sector units 0091 * @type: see enum blk_zone_type for possible values 0092 * @cond: see enum blk_zone_cond for possible values 0093 * @non_seq: Flag indicating that the zone is using non-sequential resources 0094 * (for host-aware zoned block devices only). 0095 * @reset: Flag indicating that a zone reset is recommended. 0096 * @resv: Padding for 8B alignment. 0097 * @capacity: Zone usable capacity in 512 B sector units 0098 * @reserved: Padding to 64 B to match the ZBC, ZAC and ZNS defined zone 0099 * descriptor size. 0100 * 0101 * start, len, capacity and wp use the regular 512 B sector unit, regardless 0102 * of the device logical block size. The overall structure size is 64 B to 0103 * match the ZBC, ZAC and ZNS defined zone descriptor and allow support for 0104 * future additional zone information. 0105 */ 0106 struct blk_zone { 0107 __u64 start; /* Zone start sector */ 0108 __u64 len; /* Zone length in number of sectors */ 0109 __u64 wp; /* Zone write pointer position */ 0110 __u8 type; /* Zone type */ 0111 __u8 cond; /* Zone condition */ 0112 __u8 non_seq; /* Non-sequential write resources active */ 0113 __u8 reset; /* Reset write pointer recommended */ 0114 __u8 resv[4]; 0115 __u64 capacity; /* Zone capacity in number of sectors */ 0116 __u8 reserved[24]; 0117 }; 0118 0119 /** 0120 * struct blk_zone_report - BLKREPORTZONE ioctl request/reply 0121 * 0122 * @sector: starting sector of report 0123 * @nr_zones: IN maximum / OUT actual 0124 * @flags: one or more flags as defined by enum blk_zone_report_flags. 0125 * @zones: Space to hold @nr_zones @zones entries on reply. 0126 * 0127 * The array of at most @nr_zones must follow this structure in memory. 0128 */ 0129 struct blk_zone_report { 0130 __u64 sector; 0131 __u32 nr_zones; 0132 __u32 flags; 0133 struct blk_zone zones[]; 0134 }; 0135 0136 /** 0137 * struct blk_zone_range - BLKRESETZONE/BLKOPENZONE/ 0138 * BLKCLOSEZONE/BLKFINISHZONE ioctl 0139 * requests 0140 * @sector: Starting sector of the first zone to operate on. 0141 * @nr_sectors: Total number of sectors of all zones to operate on. 0142 */ 0143 struct blk_zone_range { 0144 __u64 sector; 0145 __u64 nr_sectors; 0146 }; 0147 0148 /** 0149 * Zoned block device ioctl's: 0150 * 0151 * @BLKREPORTZONE: Get zone information. Takes a zone report as argument. 0152 * The zone report will start from the zone containing the 0153 * sector specified in the report request structure. 0154 * @BLKRESETZONE: Reset the write pointer of the zones in the specified 0155 * sector range. The sector range must be zone aligned. 0156 * @BLKGETZONESZ: Get the device zone size in number of 512 B sectors. 0157 * @BLKGETNRZONES: Get the total number of zones of the device. 0158 * @BLKOPENZONE: Open the zones in the specified sector range. 0159 * The 512 B sector range must be zone aligned. 0160 * @BLKCLOSEZONE: Close the zones in the specified sector range. 0161 * The 512 B sector range must be zone aligned. 0162 * @BLKFINISHZONE: Mark the zones as full in the specified sector range. 0163 * The 512 B sector range must be zone aligned. 0164 */ 0165 #define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report) 0166 #define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range) 0167 #define BLKGETZONESZ _IOR(0x12, 132, __u32) 0168 #define BLKGETNRZONES _IOR(0x12, 133, __u32) 0169 #define BLKOPENZONE _IOW(0x12, 134, struct blk_zone_range) 0170 #define BLKCLOSEZONE _IOW(0x12, 135, struct blk_zone_range) 0171 #define BLKFINISHZONE _IOW(0x12, 136, struct blk_zone_range) 0172 0173 #endif /* _UAPI_BLKZONED_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |