/* SPDX-License-Identifier: GPL-2.0 */ /* * Simple zone file system for zoned block devices. * * Copyright (C) 2019 Western Digital Corporation or its affiliates.
*/ #ifndef __ZONEFS_H__ #define __ZONEFS_H__
/* * Maximum length of file names: this only needs to be large enough to fit * the zone group directory names and a decimal zone number for file names. * 16 characters is plenty.
*/ #define ZONEFS_NAME_MAX 16
/* * Zone types: ZONEFS_ZTYPE_SEQ is used for all sequential zone types * defined in linux/blkzoned.h, that is, BLK_ZONE_TYPE_SEQWRITE_REQ and * BLK_ZONE_TYPE_SEQWRITE_PREF.
*/ enum zonefs_ztype {
ZONEFS_ZTYPE_CNV,
ZONEFS_ZTYPE_SEQ,
ZONEFS_ZTYPE_MAX,
};
/* * In-memory per-file inode zone data.
*/ struct zonefs_zone { /* Zone state flags */ unsignedint z_flags;
/* Zone start sector (512B unit) */
sector_t z_sector;
/* Zone size (bytes) */
loff_t z_size;
/* Zone capacity (file maximum size, bytes) */
loff_t z_capacity;
/* Write pointer offset in the zone (sequential zones only, bytes) */
loff_t z_wpoffset;
/* Saved inode uid, gid and access rights */
umode_t z_mode;
kuid_t z_uid;
kgid_t z_gid;
};
/* * In memory zone group information: all zones of a group are exposed * as files, one file per zone.
*/ struct zonefs_zone_group { struct inode *g_inode; unsignedint g_nr_zones; struct zonefs_zone *g_zones;
};
/* * To serialise fully against both syscall and mmap based IO and * sequential file truncation, two locks are used. For serializing * zonefs_seq_file_truncate() against zonefs_iomap_begin(), that is, * file truncate operations against block mapping, i_truncate_mutex is * used. i_truncate_mutex also protects against concurrent accesses * and changes to the inode private data, and in particular changes to * a sequential file size on completion of direct IO writes. * Serialization of mmap read IOs with truncate and syscall IO * operations is done with invalidate_lock in addition to * i_truncate_mutex. Only zonefs_seq_file_truncate() takes both lock * (invalidate_lock first, i_truncate_mutex second).
*/ struct mutex i_truncate_mutex;
/* guarded by i_truncate_mutex */ unsignedint i_wr_refcnt;
};
/* UID/GID to use for files */
__le32 s_uid;
__le32 s_gid;
/* File permissions */
__le32 s_perm;
/* Padding to ZONEFS_SUPER_SIZE bytes */
__u8 s_reserved[3988];
} __packed;
/* * Feature flags: specified in the s_features field of the on-disk super * block struct zonefs_super and in-memory in the s_feartures field of * struct zonefs_sb_info.
*/ enum zonefs_features { /* * Aggregate contiguous conventional zones into a single file.
*/
ZONEFS_F_AGGRCNV = 1ULL << 0, /* * Use super block specified UID for files instead of default 0.
*/
ZONEFS_F_UID = 1ULL << 1, /* * Use super block specified GID for files instead of default 0.
*/
ZONEFS_F_GID = 1ULL << 2, /* * Use super block specified file permissions instead of default 640.
*/
ZONEFS_F_PERM = 1ULL << 3,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.