From: Jaegeuk Kim <jaegeuk@kernel.org> To: Sheng Yong <shengyong@oppo.com> Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] f2fs: move set_file_temperature into f2fs_new_inode Date: Mon, 14 Nov 2022 14:40:58 -0800 [thread overview] Message-ID: <Y3LD+s0SOf3ka5if@google.com> (raw) In-Reply-To: <20221111100830.953733-2-shengyong@oppo.com> Since the file name has already passed to f2fs_new_inode(), let's move set_file_temperature() into f2fs_new_inode(). Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/namei.c | 62 +++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 43b721d8e491..88e406bb6780 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -173,6 +173,32 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, } } +/* + * Set file's temperature for hot/cold data separation + */ +static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, + const unsigned char *name) +{ + __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; + int i, cold_count, hot_count; + + f2fs_down_read(&sbi->sb_lock); + cold_count = le32_to_cpu(sbi->raw_super->extension_count); + hot_count = sbi->raw_super->hot_ext_count; + for (i = 0; i < cold_count + hot_count; i++) + if (is_extension_exist(name, extlist[i], true)) + break; + f2fs_up_read(&sbi->sb_lock); + + if (i == cold_count + hot_count) + return; + + if (i < cold_count) + file_set_cold(inode); + else + file_set_hot(inode); +} + static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, struct inode *dir, umode_t mode, const char *name) @@ -273,6 +299,9 @@ static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode)) set_inode_flag(inode, FI_INLINE_DATA); + if (name && !test_opt(sbi, DISABLE_EXT_IDENTIFY)) + set_file_temperature(sbi, inode, name); + stat_inc_inline_xattr(inode); stat_inc_inline_inode(inode); stat_inc_inline_dir(inode); @@ -301,36 +330,6 @@ static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, return ERR_PTR(err); } -/* - * Set file's temperature for hot/cold data separation - */ -static inline void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, - const unsigned char *name) -{ - __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; - int i, cold_count, hot_count; - - f2fs_down_read(&sbi->sb_lock); - - cold_count = le32_to_cpu(sbi->raw_super->extension_count); - hot_count = sbi->raw_super->hot_ext_count; - - for (i = 0; i < cold_count + hot_count; i++) { - if (is_extension_exist(name, extlist[i], true)) - break; - } - - f2fs_up_read(&sbi->sb_lock); - - if (i == cold_count + hot_count) - return; - - if (i < cold_count) - file_set_cold(inode); - else - file_set_hot(inode); -} - static int f2fs_create(struct user_namespace *mnt_userns, struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { @@ -352,9 +351,6 @@ static int f2fs_create(struct user_namespace *mnt_userns, struct inode *dir, if (IS_ERR(inode)) return PTR_ERR(inode); - if (!test_opt(sbi, DISABLE_EXT_IDENTIFY)) - set_file_temperature(sbi, inode, dentry->d_name.name); - inode->i_op = &f2fs_file_inode_operations; inode->i_fop = &f2fs_file_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; -- 2.38.1.493.g58b659f92b-goog
WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org> To: Sheng Yong <shengyong@oppo.com> Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH v2 2/2] f2fs: move set_file_temperature into f2fs_new_inode Date: Mon, 14 Nov 2022 14:40:58 -0800 [thread overview] Message-ID: <Y3LD+s0SOf3ka5if@google.com> (raw) In-Reply-To: <20221111100830.953733-2-shengyong@oppo.com> Since the file name has already passed to f2fs_new_inode(), let's move set_file_temperature() into f2fs_new_inode(). Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/namei.c | 62 +++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 43b721d8e491..88e406bb6780 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -173,6 +173,32 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, } } +/* + * Set file's temperature for hot/cold data separation + */ +static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, + const unsigned char *name) +{ + __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; + int i, cold_count, hot_count; + + f2fs_down_read(&sbi->sb_lock); + cold_count = le32_to_cpu(sbi->raw_super->extension_count); + hot_count = sbi->raw_super->hot_ext_count; + for (i = 0; i < cold_count + hot_count; i++) + if (is_extension_exist(name, extlist[i], true)) + break; + f2fs_up_read(&sbi->sb_lock); + + if (i == cold_count + hot_count) + return; + + if (i < cold_count) + file_set_cold(inode); + else + file_set_hot(inode); +} + static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, struct inode *dir, umode_t mode, const char *name) @@ -273,6 +299,9 @@ static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode)) set_inode_flag(inode, FI_INLINE_DATA); + if (name && !test_opt(sbi, DISABLE_EXT_IDENTIFY)) + set_file_temperature(sbi, inode, name); + stat_inc_inline_xattr(inode); stat_inc_inline_inode(inode); stat_inc_inline_dir(inode); @@ -301,36 +330,6 @@ static struct inode *f2fs_new_inode(struct user_namespace *mnt_userns, return ERR_PTR(err); } -/* - * Set file's temperature for hot/cold data separation - */ -static inline void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, - const unsigned char *name) -{ - __u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list; - int i, cold_count, hot_count; - - f2fs_down_read(&sbi->sb_lock); - - cold_count = le32_to_cpu(sbi->raw_super->extension_count); - hot_count = sbi->raw_super->hot_ext_count; - - for (i = 0; i < cold_count + hot_count; i++) { - if (is_extension_exist(name, extlist[i], true)) - break; - } - - f2fs_up_read(&sbi->sb_lock); - - if (i == cold_count + hot_count) - return; - - if (i < cold_count) - file_set_cold(inode); - else - file_set_hot(inode); -} - static int f2fs_create(struct user_namespace *mnt_userns, struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { @@ -352,9 +351,6 @@ static int f2fs_create(struct user_namespace *mnt_userns, struct inode *dir, if (IS_ERR(inode)) return PTR_ERR(inode); - if (!test_opt(sbi, DISABLE_EXT_IDENTIFY)) - set_file_temperature(sbi, inode, dentry->d_name.name); - inode->i_op = &f2fs_file_inode_operations; inode->i_fop = &f2fs_file_operations; inode->i_mapping->a_ops = &f2fs_dblock_aops; -- 2.38.1.493.g58b659f92b-goog _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2022-11-14 22:41 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-11 10:08 [PATCH v2 1/2] f2fs: fix to enable compress for newly created file if extension matches Sheng Yong 2022-11-11 10:08 ` [f2fs-dev] " Sheng Yong via Linux-f2fs-devel 2022-11-11 10:08 ` [PATCH v2 2/2] f2fs: move set_file_temperature into f2fs_new_inode Sheng Yong 2022-11-11 10:08 ` [f2fs-dev] " Sheng Yong via Linux-f2fs-devel 2022-11-11 10:20 ` Chao Yu 2022-11-11 10:20 ` Chao Yu 2022-11-14 22:40 ` Jaegeuk Kim [this message] 2022-11-14 22:40 ` [f2fs-dev] " Jaegeuk Kim 2022-11-11 10:20 ` [f2fs-dev] [PATCH v2 1/2] f2fs: fix to enable compress for newly created file if extension matches Chao Yu 2022-11-11 10:20 ` Chao Yu 2022-11-12 1:27 ` Jaegeuk Kim 2022-11-12 1:27 ` [f2fs-dev] " Jaegeuk Kim 2022-11-14 1:42 ` Sheng Yong 2022-11-14 1:42 ` [f2fs-dev] " Sheng Yong via Linux-f2fs-devel 2022-11-14 16:05 ` Chao Yu 2022-11-14 16:05 ` [f2fs-dev] " Chao Yu 2022-11-14 22:39 ` Jaegeuk Kim 2022-11-14 22:39 ` [f2fs-dev] " Jaegeuk Kim 2022-11-15 0:20 ` Jaegeuk Kim 2022-11-15 0:20 ` Jaegeuk Kim 2022-11-15 1:49 ` Chao Yu 2022-11-15 1:49 ` Chao Yu 2022-11-15 16:01 ` [PATCH v3] " Sheng Yong 2022-11-15 16:01 ` [f2fs-dev] " Sheng Yong via Linux-f2fs-devel 2022-11-15 21:48 ` Jaegeuk Kim 2022-11-15 21:48 ` [f2fs-dev] " Jaegeuk Kim 2022-11-15 22:45 ` Jaegeuk Kim 2022-11-15 22:45 ` [f2fs-dev] " Jaegeuk Kim 2022-11-15 23:00 ` [PATCH v4] " Jaegeuk Kim 2022-11-15 23:00 ` [f2fs-dev] " Jaegeuk Kim 2022-11-16 2:21 ` Sheng Yong 2022-11-16 2:21 ` [f2fs-dev] " Sheng Yong via Linux-f2fs-devel 2022-11-17 1:13 ` Jaegeuk Kim 2022-11-17 1:13 ` Jaegeuk Kim 2022-11-23 21:46 ` [f2fs-dev] [PATCH v5] " Jaegeuk Kim 2022-11-23 21:46 ` Jaegeuk Kim 2022-11-24 14:27 ` Chao Yu 2022-11-24 14:27 ` Chao Yu 2022-11-17 1:12 ` [PATCH v4] " Jaegeuk Kim 2022-11-17 1:12 ` [f2fs-dev] " Jaegeuk Kim 2022-11-23 14:54 ` Chao Yu 2022-11-23 14:54 ` [f2fs-dev] " Chao Yu 2022-11-23 16:09 ` Sheng Yong 2022-11-23 16:09 ` [f2fs-dev] " Sheng Yong via Linux-f2fs-devel 2022-11-23 21:29 ` Jaegeuk Kim 2022-11-23 21:29 ` [f2fs-dev] " Jaegeuk Kim 2022-11-24 2:38 ` Chao Yu 2022-11-24 2:38 ` [f2fs-dev] " Chao Yu 2022-11-15 1:34 ` [PATCH v2 1/2] " Chao Yu 2022-11-15 1:34 ` [f2fs-dev] " Chao Yu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=Y3LD+s0SOf3ka5if@google.com \ --to=jaegeuk@kernel.org \ --cc=chao@kernel.org \ --cc=linux-f2fs-devel@lists.sourceforge.net \ --cc=linux-kernel@vger.kernel.org \ --cc=shengyong@oppo.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.