summaryrefslogtreecommitdiffstats
path: root/fs/zonefs/zonefs.h
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>2022-11-24 19:43:30 +0900
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>2023-01-23 09:25:51 +0900
commit34422914dc00b291d1c47dbdabe93b154c2f2b25 (patch)
treecfdee6d1827c4ae351743d38e4086457958fd96b /fs/zonefs/zonefs.h
parent46a9c526eef7fb68a00321e2a9591ce5276ae92b (diff)
downloadlinux-34422914dc00b291d1c47dbdabe93b154c2f2b25.tar.gz
linux-34422914dc00b291d1c47dbdabe93b154c2f2b25.tar.bz2
linux-34422914dc00b291d1c47dbdabe93b154c2f2b25.zip
zonefs: Reduce struct zonefs_inode_info size
Instead of using the i_ztype field in struct zonefs_inode_info to indicate the zone type of an inode, introduce the new inode flag ZONEFS_ZONE_CNV to be set in the i_flags field of struct zonefs_inode_info to identify conventional zones. If this flag is not set, the zone of an inode is considered to be a sequential zone. The helpers zonefs_zone_is_cnv(), zonefs_zone_is_seq(), zonefs_inode_is_cnv() and zonefs_inode_is_seq() are introduced to simplify testing the zone type of a struct zonefs_inode_info and of a struct inode. Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Diffstat (limited to 'fs/zonefs/zonefs.h')
-rw-r--r--fs/zonefs/zonefs.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/fs/zonefs/zonefs.h b/fs/zonefs/zonefs.h
index 439096445ee5..1a225f74015a 100644
--- a/fs/zonefs/zonefs.h
+++ b/fs/zonefs/zonefs.h
@@ -44,6 +44,7 @@ static inline enum zonefs_ztype zonefs_zone_type(struct blk_zone *zone)
#define ZONEFS_ZONE_ACTIVE (1U << 2)
#define ZONEFS_ZONE_OFFLINE (1U << 3)
#define ZONEFS_ZONE_READONLY (1U << 4)
+#define ZONEFS_ZONE_CNV (1U << 31)
/*
* In-memory inode data.
@@ -51,9 +52,6 @@ static inline enum zonefs_ztype zonefs_zone_type(struct blk_zone *zone)
struct zonefs_inode_info {
struct inode i_vnode;
- /* File zone type */
- enum zonefs_ztype i_ztype;
-
/* File zone start sector (512B unit) */
sector_t i_zsector;
@@ -91,6 +89,26 @@ static inline struct zonefs_inode_info *ZONEFS_I(struct inode *inode)
return container_of(inode, struct zonefs_inode_info, i_vnode);
}
+static inline bool zonefs_zone_is_cnv(struct zonefs_inode_info *zi)
+{
+ return zi->i_flags & ZONEFS_ZONE_CNV;
+}
+
+static inline bool zonefs_zone_is_seq(struct zonefs_inode_info *zi)
+{
+ return !zonefs_zone_is_cnv(zi);
+}
+
+static inline bool zonefs_inode_is_cnv(struct inode *inode)
+{
+ return zonefs_zone_is_cnv(ZONEFS_I(inode));
+}
+
+static inline bool zonefs_inode_is_seq(struct inode *inode)
+{
+ return zonefs_zone_is_seq(ZONEFS_I(inode));
+}
+
/*
* On-disk super block (block 0).
*/