sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget&/translations/zh_CN/filesystems/zonefsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/zh_TW/filesystems/zonefsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/it_IT/filesystems/zonefsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/ja_JP/filesystems/zonefsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/ko_KR/filesystems/zonefsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/sp_SP/filesystems/zonefsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh@/var/lib/git/docbuild/linux/Documentation/filesystems/zonefs.rsthKubhsection)}(hhh](htitle)}(h0ZoneFS - Zone filesystem for Zoned block devicesh]h0ZoneFS - Zone filesystem for Zoned block devices}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Introductionh]h Introduction}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXzonefs is a very simple file system exposing each zone of a zoned block device as a file. Unlike a regular POSIX-compliant file system with native zoned block device support (e.g. f2fs), zonefs does not hide the sequential write constraint of zoned block devices to the user. Files representing sequential write zones of the device must be written sequentially starting from the end of the file (append only writes).h]hXzonefs is a very simple file system exposing each zone of a zoned block device as a file. Unlike a regular POSIX-compliant file system with native zoned block device support (e.g. f2fs), zonefs does not hide the sequential write constraint of zoned block devices to the user. Files representing sequential write zones of the device must be written sequentially starting from the end of the file (append only writes).}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXzAs such, zonefs is in essence closer to a raw block device access interface than to a full-featured POSIX file system. The goal of zonefs is to simplify the implementation of zoned block device support in applications by replacing raw block device file accesses with a richer file API, avoiding relying on direct block device file ioctls which may be more obscure to developers. One example of this approach is the implementation of LSM (log-structured merge) tree structures (such as used in RocksDB and LevelDB) on zoned block devices by allowing SSTables to be stored in a zone file similarly to a regular file system rather than as a range of sectors of the entire disk. The introduction of the higher level construct "one file is one zone" can help reducing the amount of changes needed in the application as well as introducing support for different application programming languages.h]hX~As such, zonefs is in essence closer to a raw block device access interface than to a full-featured POSIX file system. The goal of zonefs is to simplify the implementation of zoned block device support in applications by replacing raw block device file accesses with a richer file API, avoiding relying on direct block device file ioctls which may be more obscure to developers. One example of this approach is the implementation of LSM (log-structured merge) tree structures (such as used in RocksDB and LevelDB) on zoned block devices by allowing SSTables to be stored in a zone file similarly to a regular file system rather than as a range of sectors of the entire disk. The introduction of the higher level construct “one file is one zone” can help reducing the amount of changes needed in the application as well as introducing support for different application programming languages.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hZoned block devicesh]hZoned block devices}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hZoned storage devices belong to a class of storage devices with an address space that is divided into zones. A zone is a group of consecutive LBAs and all zones are contiguous (there are no LBA gaps). Zones may have different types.h]hZoned storage devices belong to a class of storage devices with an address space that is divided into zones. A zone is a group of consecutive LBAs and all zones are contiguous (there are no LBA gaps). Zones may have different types.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hhhhubh bullet_list)}(hhh](h list_item)}(hConventional zones: there are no access constraints to LBAs belonging to conventional zones. Any read or write access can be executed, similarly to a regular block device.h]h)}(hConventional zones: there are no access constraints to LBAs belonging to conventional zones. Any read or write access can be executed, similarly to a regular block device.h]hConventional zones: there are no access constraints to LBAs belonging to conventional zones. Any read or write access can be executed, similarly to a regular block device.}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hXSequential zones: these zones accept random reads but must be written sequentially. Each sequential zone has a write pointer maintained by the device that keeps track of the mandatory start LBA position of the next write to the device. As a result of this write constraint, LBAs in a sequential zone cannot be overwritten. Sequential zones must first be erased using a special command (zone reset) before rewriting. h]h)}(hXSequential zones: these zones accept random reads but must be written sequentially. Each sequential zone has a write pointer maintained by the device that keeps track of the mandatory start LBA position of the next write to the device. As a result of this write constraint, LBAs in a sequential zone cannot be overwritten. Sequential zones must first be erased using a special command (zone reset) before rewriting.h]hXSequential zones: these zones accept random reads but must be written sequentially. Each sequential zone has a write pointer maintained by the device that keeps track of the mandatory start LBA position of the next write to the device. As a result of this write constraint, LBAs in a sequential zone cannot be overwritten. Sequential zones must first be erased using a special command (zone reset) before rewriting.}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hj6ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet*uh1jhhhK%hhhhubh)}(hXZoned storage devices can be implemented using various recording and media technologies. The most common form of zoned storage today uses the SCSI Zoned Block Commands (ZBC) and Zoned ATA Commands (ZAC) interfaces on Shingled Magnetic Recording (SMR) HDDs.h]hXZoned storage devices can be implemented using various recording and media technologies. The most common form of zoned storage today uses the SCSI Zoned Block Commands (ZBC) and Zoned ATA Commands (ZAC) interfaces on Shingled Magnetic Recording (SMR) HDDs.}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hhhhubh)}(hX4Solid State Disks (SSD) storage devices can also implement a zoned interface to, for instance, reduce internal write amplification due to garbage collection. The NVMe Zoned NameSpace (ZNS) is a technical proposal of the NVMe standard committee aiming at adding a zoned storage interface to the NVMe protocol.h]hX4Solid State Disks (SSD) storage devices can also implement a zoned interface to, for instance, reduce internal write amplification due to garbage collection. The NVMe Zoned NameSpace (ZNS) is a technical proposal of the NVMe standard committee aiming at adding a zoned storage interface to the NVMe protocol.}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hhhhubeh}(h]zoned-block-devicesah ]h"]zoned block devicesah$]h&]uh1hhhhhhhhKubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hZonefs Overviewh]hZonefs Overview}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK:ubh)}(hX:Zonefs exposes the zones of a zoned block device as files. The files representing zones are grouped by zone type, which are themselves represented by sub-directories. This file structure is built entirely using zone information provided by the device and so does not require any complex on-disk metadata structure.h]hX:Zonefs exposes the zones of a zoned block device as files. The files representing zones are grouped by zone type, which are themselves represented by sub-directories. This file structure is built entirely using zone information provided by the device and so does not require any complex on-disk metadata structure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK * explicit-openh]hIzonefs defines several mount options: * errors= * explicit-open}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hjhhubh)}(hhh](h)}(h"errors=" optionh]h“errors=” option}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM:ubh)}(hThe "errors=" option mount option allows the user to specify zonefs behavior in response to I/O errors, inode size inconsistencies or zone condition changes. The defined behaviors are as follow:h]hThe “errors=” option mount option allows the user to specify zonefs behavior in response to I/O errors, inode size inconsistencies or zone condition changes. The defined behaviors are as follow:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hjhhubj)}(hhh](j)}(hremount-ro (default)h]h)}(hjh]hremount-ro (default)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM@hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hzone-roh]h)}(hjh]hzone-ro}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h zone-offlineh]h)}(hjh]h zone-offline}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMBhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hrepair h]h)}(hrepairh]hrepair}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMChjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jTjUuh1jhhhM@hjhhubh)}(hXThe run-time I/O error actions defined for each behavior are detailed in the previous section. Mount time I/O errors will cause the mount operation to fail. The handling of read-only zones also differs between mount-time and run-time. If a read-only zone is found at mount time, the zone is always treated in the same manner as offline zones, that is, all accesses are disabled and the zone file size set to 0. This is necessary as the write pointer of read-only zones is defined as invalib by the ZBC and ZAC standards, making it impossible to discover the amount of data that has been written to the zone. In the case of a read-only zone discovered at run-time, as indicated in the previous section. The size of the zone file is left unchanged from its last updated value.h]hXThe run-time I/O error actions defined for each behavior are detailed in the previous section. Mount time I/O errors will cause the mount operation to fail. The handling of read-only zones also differs between mount-time and run-time. If a read-only zone is found at mount time, the zone is always treated in the same manner as offline zones, that is, all accesses are disabled and the zone file size set to 0. This is necessary as the write pointer of read-only zones is defined as invalib by the ZBC and ZAC standards, making it impossible to discover the amount of data that has been written to the zone. In the case of a read-only zone discovered at run-time, as indicated in the previous section. The size of the zone file is left unchanged from its last updated value.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMEhjhhubeh}(h]errors-behavior-optionah ]h"]"errors=" optionah$]h&]uh1hhjhhhhhM:ubh)}(hhh](h)}(h"explicit-open" optionh]h“explicit-open” option}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjGhhhhhMQubh)}(hXA zoned block device (e.g. an NVMe Zoned Namespace device) may have limits on the number of zones that can be active, that is, zones that are in the implicit open, explicit open or closed conditions. This potential limitation translates into a risk for applications to see write IO errors due to this limit being exceeded if the zone of a file is not already active when a write request is issued by the user.h]hXA zoned block device (e.g. an NVMe Zoned Namespace device) may have limits on the number of zones that can be active, that is, zones that are in the implicit open, explicit open or closed conditions. This potential limitation translates into a risk for applications to see write IO errors due to this limit being exceeded if the zone of a file is not already active when a write request is issued by the user.}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMShjGhhubh)}(hXTo avoid these potential errors, the "explicit-open" mount option forces zones to be made active using an open zone command when a file is opened for writing for the first time. If the zone open command succeeds, the application is then guaranteed that write requests can be processed. Conversely, the "explicit-open" mount option will result in a zone close command being issued to the device on the last close() of a zone file if the zone is not full nor empty.h]hXTo avoid these potential errors, the “explicit-open” mount option forces zones to be made active using an open zone command when a file is opened for writing for the first time. If the zone open command succeeds, the application is then guaranteed that write requests can be processed. Conversely, the “explicit-open” mount option will result in a zone close command being issued to the device on the last close() of a zone file if the zone is not full nor empty.}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMZhjGhhubeh}(h]explicit-open-optionah ]h"]"explicit-open" optionah$]h&]uh1hhjhhhhhMQubeh}(h] mount-optionsah ]h"] mount optionsah$]h&]uh1hhjhhhhhM3ubh)}(hhh](h)}(hRuntime sysfs attributesh]hRuntime sysfs attributes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMcubh)}(hzonefs defines several sysfs attributes for mounted devices. All attributes are user readable and can be found in the directory /sys/fs/zonefs//, where is the name of the mounted zoned block device.h]hzonefs defines several sysfs attributes for mounted devices. All attributes are user readable and can be found in the directory /sys/fs/zonefs//, where is the name of the mounted zoned block device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMehjhhubh)}(h&The attributes defined are as follows.h]h&The attributes defined are as follows.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMihjhhubj)}(hhh](j)}(hX**max_wro_seq_files**: This attribute reports the maximum number of sequential zone files that can be open for writing. This number corresponds to the maximum number of explicitly or implicitly open zones that the device supports. A value of 0 means that the device has no limit and that any zone (any file) can be open for writing and written at any time, regardless of the state of other zones. When the *explicit-open* mount option is used, zonefs will fail any open() system call requesting to open a sequential zone file for writing when the number of sequential zone files already open for writing has reached the *max_wro_seq_files* limit.h]h)}(hX**max_wro_seq_files**: This attribute reports the maximum number of sequential zone files that can be open for writing. This number corresponds to the maximum number of explicitly or implicitly open zones that the device supports. A value of 0 means that the device has no limit and that any zone (any file) can be open for writing and written at any time, regardless of the state of other zones. When the *explicit-open* mount option is used, zonefs will fail any open() system call requesting to open a sequential zone file for writing when the number of sequential zone files already open for writing has reached the *max_wro_seq_files* limit.h](hstrong)}(h**max_wro_seq_files**h]hmax_wro_seq_files}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhX: This attribute reports the maximum number of sequential zone files that can be open for writing. This number corresponds to the maximum number of explicitly or implicitly open zones that the device supports. A value of 0 means that the device has no limit and that any zone (any file) can be open for writing and written at any time, regardless of the state of other zones. When the }(hjhhhNhNubhemphasis)}(h*explicit-open*h]h explicit-open}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh mount option is used, zonefs will fail any open() system call requesting to open a sequential zone file for writing when the number of sequential zone files already open for writing has reached the }(hjhhhNhNubj)}(h*max_wro_seq_files*h]hmax_wro_seq_files}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh limit.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMkhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hX**nr_wro_seq_files**: This attribute reports the current number of sequential zone files open for writing. When the "explicit-open" mount option is used, this number can never exceed *max_wro_seq_files*. If the *explicit-open* mount option is not used, the reported number can be greater than *max_wro_seq_files*. In such case, it is the responsibility of the application to not write simultaneously more than *max_wro_seq_files* sequential zone files. Failure to do so can result in write errors.h]h)}(hX**nr_wro_seq_files**: This attribute reports the current number of sequential zone files open for writing. When the "explicit-open" mount option is used, this number can never exceed *max_wro_seq_files*. If the *explicit-open* mount option is not used, the reported number can be greater than *max_wro_seq_files*. In such case, it is the responsibility of the application to not write simultaneously more than *max_wro_seq_files* sequential zone files. Failure to do so can result in write errors.h](j)}(h**nr_wro_seq_files**h]hnr_wro_seq_files}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh: This attribute reports the current number of sequential zone files open for writing. When the “explicit-open” mount option is used, this number can never exceed }(hjhhhNhNubj)}(h*max_wro_seq_files*h]hmax_wro_seq_files}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh . If the }(hjhhhNhNubj)}(h*explicit-open*h]h explicit-open}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhC mount option is not used, the reported number can be greater than }(hjhhhNhNubj)}(h*max_wro_seq_files*h]hmax_wro_seq_files}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhc. In such case, it is the responsibility of the application to not write simultaneously more than }(hjhhhNhNubj)}(h*max_wro_seq_files*h]hmax_wro_seq_files}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhE sequential zone files. Failure to do so can result in write errors.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMthjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hX**max_active_seq_files**: This attribute reports the maximum number of sequential zone files that are in an active state, that is, sequential zone files that are partially written (not empty nor full) or that have a zone that is explicitly open (which happens only if the *explicit-open* mount option is used). This number is always equal to the maximum number of active zones that the device supports. A value of 0 means that the mounted device has no limit on the number of sequential zone files that can be active.h]h)}(hX**max_active_seq_files**: This attribute reports the maximum number of sequential zone files that are in an active state, that is, sequential zone files that are partially written (not empty nor full) or that have a zone that is explicitly open (which happens only if the *explicit-open* mount option is used). This number is always equal to the maximum number of active zones that the device supports. A value of 0 means that the mounted device has no limit on the number of sequential zone files that can be active.h](j)}(h**max_active_seq_files**h]hmax_active_seq_files}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjtubh: This attribute reports the maximum number of sequential zone files that are in an active state, that is, sequential zone files that are partially written (not empty nor full) or that have a zone that is explicitly open (which happens only if the }(hjthhhNhNubj)}(h*explicit-open*h]h explicit-open}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjtubh mount option is used). This number is always equal to the maximum number of active zones that the device supports. A value of 0 means that the mounted device has no limit on the number of sequential zone files that can be active.}(hjthhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM{hjpubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hX+**nr_active_seq_files**: This attributes reports the current number of sequential zone files that are active. If *max_active_seq_files* is not 0, then the value of *nr_active_seq_files* can never exceed the value of *nr_active_seq_files*, regardless of the use of the *explicit-open* mount option. h]h)}(hX***nr_active_seq_files**: This attributes reports the current number of sequential zone files that are active. If *max_active_seq_files* is not 0, then the value of *nr_active_seq_files* can never exceed the value of *nr_active_seq_files*, regardless of the use of the *explicit-open* mount option.h](j)}(h**nr_active_seq_files**h]hnr_active_seq_files}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh[: This attributes reports the current number of sequential zone files that are active. If }(hjhhhNhNubj)}(h*max_active_seq_files*h]hmax_active_seq_files}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is not 0, then the value of }(hjhhhNhNubj)}(h*nr_active_seq_files*h]hnr_active_seq_files}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh can never exceed the value of }(hjhhhNhNubj)}(h*nr_active_seq_files*h]hnr_active_seq_files}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh, regardless of the use of the }(hjhhhNhNubj)}(h*explicit-open*h]h explicit-open}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh mount option.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jTjUuh1jhhhMkhjhhubeh}(h]runtime-sysfs-attributesah ]h"]runtime sysfs attributesah$]h&]uh1hhjhhhhhMcubeh}(h]zonefs-overviewah ]h"]zonefs overviewah$]h&]uh1hhhhhhhhK:ubh)}(hhh](h)}(hZonefs User Space Toolsh]hZonefs User Space Tools}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj,hhhhhMubh)}(hqThe mkzonefs tool is used to format zoned block devices for use with zonefs. This tool is available on Github at:h]hqThe mkzonefs tool is used to format zoned block devices for use with zonefs. This tool is available on Github at:}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj,hhubh)}(h-https://github.com/damien-lemoal/zonefs-toolsh]h reference)}(hjMh]h-https://github.com/damien-lemoal/zonefs-tools}(hjQhhhNhNubah}(h]h ]h"]h$]h&]refurijMuh1jOhjKubah}(h]h ]h"]h$]h&]uh1hhhhMhj,hhubh)}(hzonefs-tools also includes a test suite which can be run against any zoned block device, including null_blk block device created with zoned mode.h]hzonefs-tools also includes a test suite which can be run against any zoned block device, including null_blk block device created with zoned mode.}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj,hhubh)}(hhh](h)}(hExamplesh]hExamples}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjshhhhhMubh)}(h}The following formats a 15TB host-managed SMR HDD with 256 MB zones with the conventional zones aggregation feature enabled::h]h|The following formats a 15TB host-managed SMR HDD with 256 MB zones with the conventional zones aggregation feature enabled:h%}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(h# mkzonefs -o aggr_cnv /dev/sdX # mount -t zonefs /dev/sdX /mnt # ls -l /mnt/ total 0 dr-xr-xr-x 2 root root 1 Nov 25 13:23 cnv dr-xr-xr-x 2 root root 55356 Nov 25 13:23 seqh]h# mkzonefs -o aggr_cnv /dev/sdX # mount -t zonefs /dev/sdX /mnt # ls -l /mnt/ total 0 dr-xr-xr-x 2 root root 1 Nov 25 13:23 cnv dr-xr-xr-x 2 root root 55356 Nov 25 13:23 seq}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(hThe size of the zone files sub-directories indicate the number of files existing for each type of zones. In this example, there is only one conventional zone file (all conventional zones are aggregated under a single file)::h]hThe size of the zone files sub-directories indicate the number of files existing for each type of zones. In this example, there is only one conventional zone file (all conventional zones are aggregated under a single file):}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(hS# ls -l /mnt/cnv total 137101312 -rw-r----- 1 root root 140391743488 Nov 25 13:23 0h]hS# ls -l /mnt/cnv total 137101312 -rw-r----- 1 root root 140391743488 Nov 25 13:23 0}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(hFThis aggregated conventional zone file can be used as a regular file::h]hEThis aggregated conventional zone file can be used as a regular file:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(h7# mkfs.ext4 /mnt/cnv/0 # mount -o loop /mnt/cnv/0 /datah]h7# mkfs.ext4 /mnt/cnv/0 # mount -o loop /mnt/cnv/0 /data}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(hcThe "seq" sub-directory grouping files for sequential write zones has in this example 55356 zones::h]hfThe “seq” sub-directory grouping files for sequential write zones has in this example 55356 zones:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(h# ls -lv /mnt/seq total 14511243264 -rw-r----- 1 root root 0 Nov 25 13:23 0 -rw-r----- 1 root root 0 Nov 25 13:23 1 -rw-r----- 1 root root 0 Nov 25 13:23 2 ... -rw-r----- 1 root root 0 Nov 25 13:23 55354 -rw-r----- 1 root root 0 Nov 25 13:23 55355h]h# ls -lv /mnt/seq total 14511243264 -rw-r----- 1 root root 0 Nov 25 13:23 0 -rw-r----- 1 root root 0 Nov 25 13:23 1 -rw-r----- 1 root root 0 Nov 25 13:23 2 ... -rw-r----- 1 root root 0 Nov 25 13:23 55354 -rw-r----- 1 root root 0 Nov 25 13:23 55355}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(hFor sequential write zone files, the file size changes as data is appended at the end of the file, similarly to any regular file system::h]hFor sequential write zone files, the file size changes as data is appended at the end of the file, similarly to any regular file system:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(h# dd if=/dev/zero of=/mnt/seq/0 bs=4096 count=1 conv=notrunc oflag=direct 1+0 records in 1+0 records out 4096 bytes (4.1 kB, 4.0 KiB) copied, 0.00044121 s, 9.3 MB/s # ls -l /mnt/seq/0 -rw-r----- 1 root root 4096 Nov 25 13:23 /mnt/seq/0h]h# dd if=/dev/zero of=/mnt/seq/0 bs=4096 count=1 conv=notrunc oflag=direct 1+0 records in 1+0 records out 4096 bytes (4.1 kB, 4.0 KiB) copied, 0.00044121 s, 9.3 MB/s # ls -l /mnt/seq/0 -rw-r----- 1 root root 4096 Nov 25 13:23 /mnt/seq/0}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(h\The written file can be truncated to the zone size, preventing any further write operation::h]h[The written file can be truncated to the zone size, preventing any further write operation:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(hn# truncate -s 268435456 /mnt/seq/0 # ls -l /mnt/seq/0 -rw-r----- 1 root root 268435456 Nov 25 13:49 /mnt/seq/0h]hn# truncate -s 268435456 /mnt/seq/0 # ls -l /mnt/seq/0 -rw-r----- 1 root root 268435456 Nov 25 13:49 /mnt/seq/0}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(hgTruncation to 0 size allows freeing the file zone storage space and restart append-writes to the file::h]hfTruncation to 0 size allows freeing the file zone storage space and restart append-writes to the file:}(hj, hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(h^# truncate -s 0 /mnt/seq/0 # ls -l /mnt/seq/0 -rw-r----- 1 root root 0 Nov 25 13:49 /mnt/seq/0h]h^# truncate -s 0 /mnt/seq/0 # ls -l /mnt/seq/0 -rw-r----- 1 root root 0 Nov 25 13:49 /mnt/seq/0}hj: sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(hSince files are statically mapped to zones on the disk, the number of blocks of a file as reported by stat() and fstat() indicates the capacity of the file zone::h]hSince files are statically mapped to zones on the disk, the number of blocks of a file as reported by stat() and fstat() indicates the capacity of the file zone:}(hjH hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubj)}(hXs# stat /mnt/seq/0 File: /mnt/seq/0 Size: 0 Blocks: 524288 IO Block: 4096 regular empty file Device: 870h/2160d Inode: 50431 Links: 1 Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-11-25 13:23:57.048971997 +0900 Modify: 2019-11-25 13:52:25.553805765 +0900 Change: 2019-11-25 13:52:25.553805765 +0900 Birth: -h]hXs# stat /mnt/seq/0 File: /mnt/seq/0 Size: 0 Blocks: 524288 IO Block: 4096 regular empty file Device: 870h/2160d Inode: 50431 Links: 1 Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-11-25 13:23:57.048971997 +0900 Modify: 2019-11-25 13:52:25.553805765 +0900 Change: 2019-11-25 13:52:25.553805765 +0900 Birth: -}hjV sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjshhubh)}(hX@The number of blocks of the file ("Blocks") in units of 512B blocks gives the maximum file size of 524288 * 512 B = 256 MB, corresponding to the device zone capacity in this example. Of note is that the "IO block" field always indicates the minimum I/O size for writes and corresponds to the device physical sector size.h]hXHThe number of blocks of the file (“Blocks”) in units of 512B blocks gives the maximum file size of 524288 * 512 B = 256 MB, corresponding to the device zone capacity in this example. Of note is that the “IO block” field always indicates the minimum I/O size for writes and corresponds to the device physical sector size.}(hjd hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjshhubeh}(h]examplesah ]h"]examplesah$]h&]uh1hhj,hhhhhMubeh}(h]zonefs-user-space-toolsah ]h"]zonefs user space toolsah$]h&]uh1hhhhhhhhMubeh}(h].zonefs-zone-filesystem-for-zoned-block-devicesah ]h"]0zonefs - zone filesystem for zoned block devicesah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j j jj|jwjtj)j&jjj2j/jjjjjjjjjjjj~jDjAjyjvj!jj j| jw jt u nametypes}(j jjwj)jj2jjjjjjjDjyj!j jw uh}(j hj|hjthj&jjjj/jjj5jjjjjjjjj~jjAjjvjGjjj| j,jt jsu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.