[PATCH v4 01/15] fs: Rename the kernel-internal data lifetime constants

Bart Van Assche
2023-11-14T21:41:53Z

Prepare for supporting more data lifetimes by changing data lifetime
names into numeric constants.

Cc: Kanchan Joshi <joshi.k@samsung.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Christian Brauner <brauner@kernel.org>
Suggested-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
fs/f2fs/segment.c | 4 ++--
fs/inode.c | 2 +-
include/linux/fs.h | 12 ++++++------
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 727d016318f9..098a574d8d84 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3281,9 +3281,9 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
int f2fs_rw_hint_to_seg_type(enum rw_hint hint)
{
switch (hint) {
- case WRITE_LIFE_SHORT:
+ case WRITE_LIFE_2:
return CURSEG_HOT_DATA;
- case WRITE_LIFE_EXTREME:
+ case WRITE_LIFE_5:
return CURSEG_COLD_DATA;
default:
return CURSEG_WARM_DATA;
diff --git a/fs/inode.c b/fs/inode.c
index edcd8a61975f..7965d5e07012 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -175,7 +175,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
i_gid_write(inode, 0);
atomic_set(&inode->i_writecount, 0);
inode->i_size = 0;
- inode->i_write_hint = WRITE_LIFE_NOT_SET;
+ inode->i_write_hint = WRITE_LIFE_0;
inode->i_blocks = 0;
inode->i_bytes = 0;
inode->i_generation = 0;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 98b7a7a8c42e..59f9de9df0fe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -314,12 +314,12 @@ struct readahead_control;
* Stored in struct inode as u8.
*/
enum rw_hint {
- WRITE_LIFE_NOT_SET = 0,
- WRITE_LIFE_NONE = RWH_WRITE_LIFE_NONE,
- WRITE_LIFE_SHORT = RWH_WRITE_LIFE_SHORT,
- WRITE_LIFE_MEDIUM = RWH_WRITE_LIFE_MEDIUM,
- WRITE_LIFE_LONG = RWH_WRITE_LIFE_LONG,
- WRITE_LIFE_EXTREME = RWH_WRITE_LIFE_EXTREME,
+ WRITE_LIFE_0 = 0,
+ WRITE_LIFE_1 = RWH_WRITE_LIFE_NONE,
+ WRITE_LIFE_2 = RWH_WRITE_LIFE_SHORT,
+ WRITE_LIFE_3 = RWH_WRITE_LIFE_MEDIUM,
+ WRITE_LIFE_4 = RWH_WRITE_LIFE_LONG,
+ WRITE_LIFE_5 = RWH_WRITE_LIFE_EXTREME,
};

/* Match RWF_* bits to IOCB bits */