aboutsummaryrefslogtreecommitdiff
path: root/fs/zonefs/zonefs.h
diff options
context:
space:
mode:
authorDamien Le Moal2022-11-24 19:43:30 +0900
committerGreg Kroah-Hartman2023-04-06 12:10:34 +0200
commit7558b249cb4e77b2cf58725895e05bbe0fd1a80e (patch)
tree5b31d95e50b7716c98d6e7e89621aaaeba7673bd /fs/zonefs/zonefs.h
parent3741898b169476c17ece7962e5acf415c7041265 (diff)
zonefs: Reduce struct zonefs_inode_info size
[ Upstream commit 34422914dc00b291d1c47dbdabe93b154c2f2b25 ] 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> Stable-dep-of: 88b170088ad2 ("zonefs: Fix error message in zonefs_file_dio_append()") Signed-off-by: Sasha Levin <sashal@kernel.org>
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).
*/