History

block: Implement support for zoned block devices

Implement zoned block device zone information reporting and reset. Zone information are reported as struct blk_zone. This implementation does not differentiate between host-aware and host-managed device models and is valid for both. Two functions are provided: blkdev_report_zones for discovering the zone configuration of a zoned block device, and blkdev_reset_zones for resetting the write pointer of sequential zones. The helper function blk_queue_zone_size and bdev_zone_size are also provided for, as the name suggest, obtaining the zone size (in 512B sectors) of the zones of the device. Signed-off-by: Hannes Reinecke <hare@suse.de> [Damien: * Removed the zone cache * Implement report zones operation based on earlier proposal by Shaun Tancheff <shaun.tancheff@seagate.com>] Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Shaun Tancheff <shaun.tancheff@seagate.com> Tested-by: Shaun Tancheff <shaun.tancheff@seagate.com> Signed-off-by: Jens Axboe <axboe@fb.com>

Hannes Reinecke committed 10 years ago

Commit 6a0cb1b1 parent 2d253446 files · +401 −0Browse files

Showing the changes to include/uapi (2 of 6 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/Kbuild +1 −0
  2. include/uapi/linux/blkzoned.h +103 −0
include/uapi/linux/Kbuild+1−0
@@ -70,6 +70,7 @@ header-y += bfs_fs.h · 69 unmodified lines
70header-y += binfmts.h70header-y += binfmts.h
71header-y += blkpg.h71header-y += blkpg.h
72header-y += blktrace_api.h72header-y += blktrace_api.h
73header-y += blkzoned.h
73header-y += bpf_common.h74header-y += bpf_common.h
74header-y += bpf_perf_event.h75header-y += bpf_perf_event.h
75header-y += bpf.h76header-y += bpf.h
include/uapi/linux/blkzoned.h+103−0
@@ -0,0 +1,103 @@
1/*
2 * Zoned block devices handling.
3 *
4 * Copyright (C) 2015 Seagate Technology PLC
5 *
6 * Written by: Shaun Tancheff <shaun.tancheff@seagate.com>
7 *
8 * Modified by: Damien Le Moal <damien.lemoal@hgst.com>
9 * Copyright (C) 2016 Western Digital
10 *
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
14 */
15#ifndef _UAPI_BLKZONED_H
16#define _UAPI_BLKZONED_H
17
18#include <linux/types.h>
19
20/**
21 * enum blk_zone_type - Types of zones allowed in a zoned device.
22 *
23 * @BLK_ZONE_TYPE_CONVENTIONAL: The zone has no write pointer and can be writen
24 * randomly. Zone reset has no effect on the zone.
25 * @BLK_ZONE_TYPE_SEQWRITE_REQ: The zone must be written sequentially
26 * @BLK_ZONE_TYPE_SEQWRITE_PREF: The zone can be written non-sequentially
27 *
28 * Any other value not defined is reserved and must be considered as invalid.
29 */
30enum blk_zone_type {
31 BLK_ZONE_TYPE_CONVENTIONAL = 0x1,
32 BLK_ZONE_TYPE_SEQWRITE_REQ = 0x2,
33 BLK_ZONE_TYPE_SEQWRITE_PREF = 0x3,
34};
35
36/**
37 * enum blk_zone_cond - Condition [state] of a zone in a zoned device.
38 *
39 * @BLK_ZONE_COND_NOT_WP: The zone has no write pointer, it is conventional.
40 * @BLK_ZONE_COND_EMPTY: The zone is empty.
41 * @BLK_ZONE_COND_IMP_OPEN: The zone is open, but not explicitly opened.
42 * @BLK_ZONE_COND_EXP_OPEN: The zones was explicitly opened by an
43 * OPEN ZONE command.
44 * @BLK_ZONE_COND_CLOSED: The zone was [explicitly] closed after writing.
45 * @BLK_ZONE_COND_FULL: The zone is marked as full, possibly by a zone
46 * FINISH ZONE command.
47 * @BLK_ZONE_COND_READONLY: The zone is read-only.
48 * @BLK_ZONE_COND_OFFLINE: The zone is offline (sectors cannot be read/written).
49 *
50 * The Zone Condition state machine in the ZBC/ZAC standards maps the above
51 * deinitions as:
52 * - ZC1: Empty | BLK_ZONE_EMPTY
53 * - ZC2: Implicit Open | BLK_ZONE_COND_IMP_OPEN
54 * - ZC3: Explicit Open | BLK_ZONE_COND_EXP_OPEN
55 * - ZC4: Closed | BLK_ZONE_CLOSED
56 * - ZC5: Full | BLK_ZONE_FULL
57 * - ZC6: Read Only | BLK_ZONE_READONLY
58 * - ZC7: Offline | BLK_ZONE_OFFLINE
59 *
60 * Conditions 0x5 to 0xC are reserved by the current ZBC/ZAC spec and should
61 * be considered invalid.
62 */
63enum blk_zone_cond {
64 BLK_ZONE_COND_NOT_WP = 0x0,
65 BLK_ZONE_COND_EMPTY = 0x1,
66 BLK_ZONE_COND_IMP_OPEN = 0x2,
67 BLK_ZONE_COND_EXP_OPEN = 0x3,
68 BLK_ZONE_COND_CLOSED = 0x4,
69 BLK_ZONE_COND_READONLY = 0xD,
70 BLK_ZONE_COND_FULL = 0xE,
71 BLK_ZONE_COND_OFFLINE = 0xF,
72};
73
74/**
75 * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
76 *
77 * @start: Zone start in 512 B sector units
78 * @len: Zone length in 512 B sector units
79 * @wp: Zone write pointer location in 512 B sector units
80 * @type: see enum blk_zone_type for possible values
81 * @cond: see enum blk_zone_cond for possible values
82 * @non_seq: Flag indicating that the zone is using non-sequential resources
83 * (for host-aware zoned block devices only).
84 * @reset: Flag indicating that a zone reset is recommended.
85 * @reserved: Padding to 64 B to match the ZBC/ZAC defined zone descriptor size.
86 *
87 * start, len and wp use the regular 512 B sector unit, regardless of the
88 * device logical block size. The overall structure size is 64 B to match the
89 * ZBC/ZAC defined zone descriptor and allow support for future additional
90 * zone information.
91 */
92struct blk_zone {
93 __u64 start; /* Zone start sector */
94 __u64 len; /* Zone length in number of sectors */
95 __u64 wp; /* Zone write pointer position */
96 __u8 type; /* Zone type */
97 __u8 cond; /* Zone condition */
98 __u8 non_seq; /* Non-sequential write resources active */
99 __u8 reset; /* Reset write pointer recommended */
100 __u8 reserved[36];
101};
102
103#endif /* _UAPI_BLKZONED_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t