f2fs: compress tmp files given extension
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: compress tmp files given extension
Let's compress tmp files for the given extension list.
--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/namei.c +1 -1
@@ -161,7 +161,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true)) {set_compress_context (inode);return ; }
Signature · 1 line
2.41.0.rc0.172.g3f132b7071-goog
Chao Yu
maintainerQuoted 1 line · Jaegeuk Kim
Let's compress tmp files for the given extension list.
Could you please check below commit? IIRC, it was introduce to avoid compressing file which has unpredictable tmp file, e.g. foo.sox.
Could you please describe the case you encounter?
commit 4a67d9b07ac8dce7f1034e0d887f2f4ee00fe118
Author: Chao Yu <[email protected]> Date: Tue May 18 17:54:58 2021 +0800
f2fs: compress: fix to disallow temp extension
This patch restricts to configure compress extension as format of:
[filename + '.' + extension]
rather than:
[filename + '.' + extension + (optional: '.' + temp extension)]
in order to avoid to enable compression incorrectly:
1. compress_extension=so
2. touch file.soa
3. touch file.so.tmp
Thanks,
Quoted 11 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +0
-0
fs/f2fs/namei.c static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, · line 167
Quoted 8 lines
fs/f2fs/namei.c +1
-1@@ -161,7 +161,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true)) {set_compress_context (inode);return ; }
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerQuoted 7 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim
Let's compress tmp files for the given extension list.
Could you please check below commit? IIRC, it was introduce to avoid compressing file which has unpredictable tmp file, e.g. foo.sox.
Could you please describe the case you encounter?
I don't know what I need to describe more tho, looking at how to compress abc.so.tmp and abc.so, given compress_extension=so.
So, your concern is somehow abc.soa? If so, we need to fix is_extension_exist. Will check what's going on here.
Quoted 41 lines
commit
4a67d9b07ac8dce7f1034e0d887f2f4ee00fe118Author: Chao Yu <[email protected]> Date: Tue May 18 17:54:58 2021 +0800f2fs: compress: fix to disallow temp extension
This patch restricts to configure compress extension as format of:
[filename + '.' + extension]
rather than:
[filename + '.' + extension + (optional: '.' + temp extension)]
in order to avoid to enable compression incorrectly:
1. compress_extension=so
2. touch file.soa
3. touch file.so.tmpThanks,
Quoted 18 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +1
-1@@ -161,7 +161,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true)) {set_compress_context (inode);return ; }
Chao Yu
maintainerQuoted 10 lines · Jaegeuk Kim
Quoted 7 lines · Chao Yu
Quoted 1 line · Jaegeuk Kim
Let's compress tmp files for the given extension list.
Could you please check below commit? IIRC, it was introduce to avoid compressing file which has unpredictable tmp file, e.g. foo.sox.
Could you please describe the case you encounter?
I don't know what I need to describe more tho, looking at how to compress
Oh, I just like to know which case you want to cover: foo.so.tmp or foo.sotmp.
Quoted 1 line
abc.so.tmp and abc.so, given compress_extension=so.
Copied.
Quoted 2 lines
So, your concern is somehow abc.soa? If so, we need to fix
is_extension_exist.
Yes, is_extension_exist(, true) accepts optional '.' while parsing file extension.
[filename + '.' + extension + (optional: '.' + temp extension)]
It is used to support parsing common prefix for cold file's extension, we can add a parameter for is_extension_exist() to disable prefix parsing for compress file extension?
const char *media_ext_lists[] = {
/* common prefix */
"mp", // Covers mp3, mp4, mpeg, mpg
"wm", // Covers wma, wmb, wmv
"og", // Covers oga, ogg, ogm, ogv
"jp", // Covers jpg, jpeg, jp2...
}
Thanks,
Quoted 43 lines
Will check what's going on here.
Quoted 41 lines
commit
4a67d9b07ac8dce7f1034e0d887f2f4ee00fe118Author: Chao Yu <[email protected]> Date: Tue May 18 17:54:58 2021 +0800f2fs: compress: fix to disallow temp extension
This patch restricts to configure compress extension as format of:
[filename + '.' + extension]
rather than:
[filename + '.' + extension + (optional: '.' + temp extension)]
in order to avoid to enable compression incorrectly:
1. compress_extension=so
2. touch file.soa
3. touch file.so.tmpThanks,
Quoted 18 lines
Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/namei.c +1
-1@@ -161,7 +161,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true)) {set_compress_context (inode);return ; }
Jaegeuk Kim
maintainerLet's compress tmp files for the given extension list.
This patch does not change the previous behavior, but allow the cases as below.
Extention example: "ext"
- abc.ext : allow
- abc.ext.abc : allow
- abc.extm : not allow
---
Change log from v1:
- refactor to allow abc.ext.dontcare only
fs/f2fs/namei.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
fs/f2fs/namei.c +11 -7
@@ -23,7 +23,7 @@#include <trace/events/f2fs.h> static inline bool is_extension_exist (const unsigned char *s,const char *sub, -bool tmp_ext) +bool tmp_ext,bool tmp_dot) {size_t slen =strlen (s);size_t sublen =strlen (sub);
@@ -49,8 +49,12 @@ static inline bool is_extension_exist(const unsigned char *s, const char *sub,for (i =1 ; i < slen - sublen; i++) {if (s[i] !='.' )continue ; -if (!strncasecmp (s + i +1 , sub, sublen)) -return true; +if (!strncasecmp (s + i +1 , sub, sublen)) { +if (!tmp_dot) +return true; +if (i == slen - sublen -1 || s[i +1 + sublen] =='.' ) +return true; + } }return false;
@@ -148,7 +152,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, cold_count =le32_to_cpu (sbi->raw_super->extension_count); hot_count = sbi->raw_super->hot_ext_count;for (i = cold_count; i < cold_count + hot_count; i++) -if (is_extension_exist (name, extlist[i], false)) +if (is_extension_exist (name, extlist[i], false, false))break ;f2fs_up_read (&sbi->sb_lock);if (i < (cold_count + hot_count))
@@ -156,12 +160,12 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Don't compress unallowed extension. */ for (i =0 ; i < noext_cnt; i++) -if (is_extension_exist (name, noext[i], false)) +if (is_extension_exist (name, noext[i], false, false))return ;/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true, true)) {set_compress_context (inode);return ; }
@@ -189,7 +193,7 @@ static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, 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)) +if (is_extension_exist (name, extlist[i], true, false))break ;f2fs_up_read (&sbi->sb_lock);
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
Chao Yu
maintainerQuoted 33 lines · Jaegeuk Kim
Let's compress tmp files for the given extension list.
This patch does not change the previous behavior, but allow the cases as below.
Extention example: "ext"
- abc.ext : allow
- abc.ext.abc : allow
- abc.extm : not allowSigned-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- refactor to allow abc.ext.dontcare onlyfs/f2fs/namei.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)fs/f2fs/namei.c +1
-1@@ -23,7 +23,7 @@#include <trace/events/f2fs.h> static inline bool is_extension_exist (const unsigned char *s,const char *sub, -bool tmp_ext) +bool tmp_ext,bool tmp_dot) {size_t slen =strlen (s);size_t sublen =strlen (sub);
fs/f2fs/namei.c static inline bool is_extension_exist(const unsigned char *s, const char *sub, · line 55
Quoted 9 lines
fs/f2fs/namei.c +4
-2@@ -49,8 +49,12 @@ static inline bool is_extension_exist(const unsigned char *s, const char *sub,for (i =1 ; i < slen - sublen; i++) {if (s[i] !='.' )continue ; -if (!strncasecmp (s + i +1 , sub, sublen)) -return true; +if (!strncasecmp (s + i +1 , sub, sublen)) { +if (!tmp_dot) +return true; +if (i == slen - sublen -1 || s[i +1 + sublen] =='.' )
Do you mean?
if (i == slen - sublen - 1 && s[i + 1 + sublen] == '.')
fs/f2fs/namei.c static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, · line 155
Quoted 11 lines
fs/f2fs/namei.c +3
-1+return true; + } }return false;@@ -148,7 +152,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, cold_count =le32_to_cpu (sbi->raw_super->extension_count); hot_count = sbi->raw_super->hot_ext_count;for (i = cold_count; i < cold_count + hot_count; i++) -if (is_extension_exist (name, extlist[i], false)) +if (is_extension_exist (name, extlist[i], false, false))
Parameters should be consistent w/ the one in set_file_temperature()?
if (is_extension_exist(name, extlist[i], true, false))
fs/f2fs/namei.c static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, · line 163
Quoted 9 lines
fs/f2fs/namei.c +1
-1break ;f2fs_up_read (&sbi->sb_lock);if (i < (cold_count + hot_count))@@ -156,12 +160,12 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Don't compress unallowed extension. */ for (i =0 ; i < noext_cnt; i++) -if (is_extension_exist (name, noext[i], false)) +if (is_extension_exist (name, noext[i], false, false))
is_extension_exist(name, noext[i], true, true) ?
Thanks,
Quoted 10 lines
fs/f2fs/namei.c +1
-1return ;/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true, true)) {set_compress_context (inode);return ; }
fs/f2fs/namei.c static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, · line 199
Quoted 8 lines
fs/f2fs/namei.c +1
-1@@ -189,7 +193,7 @@ static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, 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)) +if (is_extension_exist (name, extlist[i], true, false))break ;f2fs_up_read (&sbi->sb_lock);
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerQuoted 45 lines · Chao Yu
Quoted 32 lines · Jaegeuk Kim
Let's compress tmp files for the given extension list.
This patch does not change the previous behavior, but allow the cases as below.
Extention example: "ext"
- abc.ext : allow
- abc.ext.abc : allow
- abc.extm : not allowSigned-off-by Jaegeuk Kim <[email protected]>---
Change log from v1:
- refactor to allow abc.ext.dontcare onlyfs/f2fs/namei.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)fs/f2fs/namei.c +1
-1@@ -23,7 +23,7 @@#include <trace/events/f2fs.h> static inline bool is_extension_exist (const unsigned char *s,const char *sub, -bool tmp_ext) +bool tmp_ext,bool tmp_dot) {size_t slen =strlen (s);size_t sublen =strlen (sub);fs/f2fs/namei.c static inline bool is_extension_exist(const unsigned char *s, const char *sub, · line 55
Quoted 9 lines
fs/f2fs/namei.c +4
-2@@ -49,8 +49,12 @@ static inline bool is_extension_exist(const unsigned char *s, const char *sub,for (i =1 ; i < slen - sublen; i++) {if (s[i] !='.' )continue ; -if (!strncasecmp (s + i +1 , sub, sublen)) -return true; +if (!strncasecmp (s + i +1 , sub, sublen)) { +if (!tmp_dot) +return true; +if (i == slen - sublen -1 || s[i +1 + sublen] =='.' )Do you mean?
Quoted 1 line
if (i == slen - sublen - 1 && s[i + 1 + sublen] == '.')
I don't think so.
Quoted 29 lines
fs/f2fs/namei.c static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, · line 155
Quoted 11 lines
fs/f2fs/namei.c +3
-1+return true; + } }return false;@@ -148,7 +152,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, cold_count =le32_to_cpu (sbi->raw_super->extension_count); hot_count = sbi->raw_super->hot_ext_count;for (i = cold_count; i < cold_count + hot_count; i++) -if (is_extension_exist (name, extlist[i], false)) +if (is_extension_exist (name, extlist[i], false, false))Parameters should be consistent w/ the one in
set_file_temperature()?if (
is_extension_exist(name, extlist[i], true, false))fs/f2fs/namei.c static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, · line 162
Quoted 8 lines
fs/f2fs/namei.c +1
-1break ;f2fs_up_read (&sbi->sb_lock);if (i < (cold_count + hot_count))@@ -156,12 +160,12 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Don't compress unallowed extension. */ for (i =0 ; i < noext_cnt; i++) -if (is_extension_exist (name, noext[i], false)) +if (is_extension_exist (name, noext[i], false, false))
is_extension_exist(name, noext[i], true, true)?Thanks,
Quoted 16 lines
Quoted 9 lines
fs/f2fs/namei.c +1
-1return ;/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true, true)) {set_compress_context (inode);return ; }fs/f2fs/namei.c static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, · line 198
Quoted 7 lines
fs/f2fs/namei.c +1
-1@@ -189,7 +193,7 @@ static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, 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)) +if (is_extension_exist (name, extlist[i], true, false))break ;f2fs_up_read (&sbi->sb_lock);
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerLet's compress tmp files for the given extension list.
This patch does not change the previous behavior, but allow the cases as below.
Extention example: "ext"
- abc.ext : allow
- abc.ext.abc : allow
- abc.extm : not allow
---
Change log from v2:
- fix parameters
Change log from v1:
- refactor to allow abc.ext.dontcare only
fs/f2fs/namei.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
fs/f2fs/namei.c +11 -7
@@ -23,7 +23,7 @@#include <trace/events/f2fs.h> static inline bool is_extension_exist (const unsigned char *s,const char *sub, -bool tmp_ext) +bool tmp_ext,bool tmp_dot) {size_t slen =strlen (s);size_t sublen =strlen (sub);
@@ -49,8 +49,12 @@ static inline bool is_extension_exist(const unsigned char *s, const char *sub,for (i =1 ; i < slen - sublen; i++) {if (s[i] !='.' )continue ; -if (!strncasecmp (s + i +1 , sub, sublen)) -return true; +if (!strncasecmp (s + i +1 , sub, sublen)) { +if (!tmp_dot) +return true; +if (i == slen - sublen -1 || s[i +1 + sublen] =='.' ) +return true; + } }return false;
@@ -148,7 +152,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, cold_count =le32_to_cpu (sbi->raw_super->extension_count); hot_count = sbi->raw_super->hot_ext_count;for (i = cold_count; i < cold_count + hot_count; i++) -if (is_extension_exist (name, extlist[i], false)) +if (is_extension_exist (name, extlist[i], true, false))break ;f2fs_up_read (&sbi->sb_lock);if (i < (cold_count + hot_count))
@@ -156,12 +160,12 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Don't compress unallowed extension. */ for (i =0 ; i < noext_cnt; i++) -if (is_extension_exist (name, noext[i], false)) +if (is_extension_exist (name, noext[i], true, false))return ;/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true, true)) {set_compress_context (inode);return ; }
@@ -189,7 +193,7 @@ static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, 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)) +if (is_extension_exist (name, extlist[i], true, false))break ;f2fs_up_read (&sbi->sb_lock);
Signature · 8 lines
2.41.0.162.gfafddb0af9-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 59 lines · Jaegeuk Kim
Let's compress tmp files for the given extension list.
This patch does not change the previous behavior, but allow the cases as below.
Extention example: "ext"
- abc.ext : allow
- abc.ext.abc : allow
- abc.extm : not allowSigned-off-by Jaegeuk Kim <[email protected]>---
Change log from v2:
- fix parametersChange log from v1:
- refactor to allow abc.ext.dontcare onlyfs/f2fs/namei.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)fs/f2fs/namei.c +8
-4@@ -23,7 +23,7 @@#include <trace/events/f2fs.h> static inline bool is_extension_exist (const unsigned char *s,const char *sub, -bool tmp_ext) +bool tmp_ext,bool tmp_dot) {size_t slen =strlen (s);size_t sublen =strlen (sub);@@ -49,8 +49,12 @@ static inline bool is_extension_exist(const unsigned char *s, const char *sub,for (i =1 ; i < slen - sublen; i++) {if (s[i] !='.' )continue ; -if (!strncasecmp (s + i +1 , sub, sublen)) -return true; +if (!strncasecmp (s + i +1 , sub, sublen)) { +if (!tmp_dot) +return true; +if (i == slen - sublen -1 || s[i +1 + sublen] =='.' ) +return true; + } }return false;@@ -148,7 +152,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, cold_count =le32_to_cpu (sbi->raw_super->extension_count); hot_count = sbi->raw_super->hot_ext_count;for (i = cold_count; i < cold_count + hot_count; i++) -if (is_extension_exist (name, extlist[i], false)) +if (is_extension_exist (name, extlist[i], true, false))break ;f2fs_up_read (&sbi->sb_lock);if (i < (cold_count + hot_count))
fs/f2fs/namei.c static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, · line 163
Quoted 5 lines
fs/f2fs/namei.c +1
-1@@ -156,12 +160,12 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Don't compress unallowed extension. */ for (i =0 ; i < noext_cnt; i++) -if (is_extension_exist (name, noext[i], false)) +if (is_extension_exist (name, noext[i], true, false))
is_extension_exist(name, ext[i], true, true) ?
Thanks,
Quoted 18 lines
fs/f2fs/namei.c +2
-2return ;/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_extension_exist (name, ext[i], true, true)) {set_compress_context (inode);return ; }@@ -189,7 +193,7 @@ static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, 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)) +if (is_extension_exist (name, extlist[i], true, false))break ;f2fs_up_read (&sbi->sb_lock);
Jaegeuk Kim
maintainerLet's compress tmp files for the given extension list.
This patch does not change the previous behavior, but allow the cases as below.
Extention example: "ext"
- abc.ext : allow
- abc.ext.abc : allow
- abc.extm : not allow
---
Change log from v3:
- split temparature and compress extensions
Change log from v2:
- fix parameters
Change log from v1:
- refactor to allow abc.ext.dontcare only
fs/f2fs/namei.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
fs/f2fs/namei.c +21 -7
@@ -23,7 +23,7 @@#include <trace/events/f2fs.h> static inline bool is_extension_exist (const unsigned char *s,const char *sub, -bool tmp_ext) +bool tmp_ext,bool tmp_dot) {size_t slen =strlen (s);size_t sublen =strlen (sub);
@@ -49,13 +49,27 @@ static inline bool is_extension_exist(const unsigned char *s, const char *sub,for (i =1 ; i < slen - sublen; i++) {if (s[i] !='.' )continue ; -if (!strncasecmp (s + i +1 , sub, sublen)) -return true; +if (!strncasecmp (s + i +1 , sub, sublen)) { +if (!tmp_dot) +return true; +if (i == slen - sublen -1 || s[i +1 + sublen] =='.' ) +return true; + } }return false; } +static inline bool is_temperature_extension (const unsigned char *s,const char *sub) +{ +return is_extension_exist (s, sub, true, false); +} + +static inline bool is_compress_extension (const unsigned char *s,const char *sub) +{ +return is_extension_exist (s, sub, true, true); +} +int f2fs_update_extension_list (struct f2fs_sb_info *sbi,const char *name,bool hot,bool set) {
@@ -148,7 +162,7 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir, cold_count =le32_to_cpu (sbi->raw_super->extension_count); hot_count = sbi->raw_super->hot_ext_count;for (i = cold_count; i < cold_count + hot_count; i++) -if (is_extension_exist (name, extlist[i], false)) +if (is_temperature_extension (name, extlist[i]))break ;f2fs_up_read (&sbi->sb_lock);if (i < (cold_count + hot_count))
@@ -156,12 +170,12 @@ static void set_compress_new_inode(struct f2fs_sb_info *sbi, struct inode *dir,/* Don't compress unallowed extension. */ for (i =0 ; i < noext_cnt; i++) -if (is_extension_exist (name, noext[i], false)) +if (is_compress_extension (name, noext[i]))return ;/* Compress wanting extension. */ for (i =0 ; i < ext_cnt; i++) { -if (is_extension_exist (name, ext[i], false)) { +if (is_compress_extension (name, ext[i])) {set_compress_context (inode);return ; }
@@ -189,7 +203,7 @@ static void set_file_temperature(struct f2fs_sb_info *sbi, struct inode *inode, 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)) +if (is_temperature_extension (name, extlist[i]))break ;f2fs_up_read (&sbi->sb_lock);
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
Quoted 11 lines · Jaegeuk Kim
Let's compress tmp files for the given extension list.
This patch does not change the previous behavior, but allow the cases as below.
Extention example: "ext"
- abc.ext : allow
- abc.ext.abc : allow
- abc.extm : not allowSigned-off-by Jaegeuk Kim <[email protected]>
Thanks,