* Re: [PATCH v2] f2fs: compress tmp files given extension
@ 2023-06-13 22:14 ` Jaegeuk Kim
0 siblings, 0 replies; 22+ messages in thread
From: Jaegeuk Kim @ 2023-06-13 22:14 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel
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 allow
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
Change log from v1:
- refactor to allow abc.ext.dontcare only
fs/f2fs/namei.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..49573ef4115d 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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);
--
2.41.0.162.gfafddb0af9-goog
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v2] f2fs: compress tmp files given extension
2023-06-13 22:14 ` Jaegeuk Kim
@ 2023-06-20 15:14 ` Chao Yu
-1 siblings, 0 replies; 22+ messages in thread
From: Chao Yu @ 2023-06-20 15:14 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On 2023/6/14 6:14, Jaegeuk Kim wrote:
> 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 allow
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>
> Change log from v1:
> - refactor to allow abc.ext.dontcare only
>
> fs/f2fs/namei.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 3e35eb7dbb8f..49573ef4115d 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -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] == '.')
Do you mean?
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))
Parameters should be consistent w/ the one in set_file_temperature()?
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], false, false))
is_extension_exist(name, noext[i], true, true) ?
Thanks,
> 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);
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v2] f2fs: compress tmp files given extension
@ 2023-06-20 15:14 ` Chao Yu
0 siblings, 0 replies; 22+ messages in thread
From: Chao Yu @ 2023-06-20 15:14 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On 2023/6/14 6:14, Jaegeuk Kim wrote:
> 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 allow
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>
> Change log from v1:
> - refactor to allow abc.ext.dontcare only
>
> fs/f2fs/namei.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 3e35eb7dbb8f..49573ef4115d 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -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] == '.')
Do you mean?
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))
Parameters should be consistent w/ the one in set_file_temperature()?
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], false, false))
is_extension_exist(name, noext[i], true, true) ?
Thanks,
> 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);
>
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v2] f2fs: compress tmp files given extension
2023-06-20 15:14 ` Chao Yu
@ 2023-06-22 7:10 ` Jaegeuk Kim
-1 siblings, 0 replies; 22+ messages in thread
From: Jaegeuk Kim @ 2023-06-22 7:10 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
On 06/20, Chao Yu wrote:
> On 2023/6/14 6:14, Jaegeuk Kim wrote:
> > 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 allow
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >
> > Change log from v1:
> > - refactor to allow abc.ext.dontcare only
> >
> > fs/f2fs/namei.c | 18 +++++++++++-------
> > 1 file changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> > index 3e35eb7dbb8f..49573ef4115d 100644
> > --- a/fs/f2fs/namei.c
> > +++ b/fs/f2fs/namei.c
> > @@ -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] == '.')
>
> Do you mean?
>
> if (i == slen - sublen - 1 && s[i + 1 + sublen] == '.')
I don't think so.
>
> > + 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))
>
> > 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))
>
> is_extension_exist(name, noext[i], true, true) ?
>
> Thanks,
>
> > 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);
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v2] f2fs: compress tmp files given extension
@ 2023-06-22 7:10 ` Jaegeuk Kim
0 siblings, 0 replies; 22+ messages in thread
From: Jaegeuk Kim @ 2023-06-22 7:10 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
On 06/20, Chao Yu wrote:
> On 2023/6/14 6:14, Jaegeuk Kim wrote:
> > 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 allow
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >
> > Change log from v1:
> > - refactor to allow abc.ext.dontcare only
> >
> > fs/f2fs/namei.c | 18 +++++++++++-------
> > 1 file changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> > index 3e35eb7dbb8f..49573ef4115d 100644
> > --- a/fs/f2fs/namei.c
> > +++ b/fs/f2fs/namei.c
> > @@ -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] == '.')
>
> Do you mean?
>
> if (i == slen - sublen - 1 && s[i + 1 + sublen] == '.')
I don't think so.
>
> > + 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))
>
> > 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))
>
> is_extension_exist(name, noext[i], true, true) ?
>
> Thanks,
>
> > 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);
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [f2fs-dev] [PATCH v3] f2fs: compress tmp files given extension
2023-06-13 22:14 ` Jaegeuk Kim
@ 2023-06-22 7:12 ` Jaegeuk Kim
-1 siblings, 0 replies; 22+ messages in thread
From: Jaegeuk Kim @ 2023-06-22 7:12 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel
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 allow
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
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(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..80806ce1289f 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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);
--
2.41.0.162.gfafddb0af9-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v3] f2fs: compress tmp files given extension
@ 2023-06-22 7:12 ` Jaegeuk Kim
0 siblings, 0 replies; 22+ messages in thread
From: Jaegeuk Kim @ 2023-06-22 7:12 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel
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 allow
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
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(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..80806ce1289f 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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);
--
2.41.0.162.gfafddb0af9-goog
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v3] f2fs: compress tmp files given extension
2023-06-22 7:12 ` Jaegeuk Kim
@ 2023-06-23 1:41 ` Chao Yu
-1 siblings, 0 replies; 22+ messages in thread
From: Chao Yu @ 2023-06-23 1:41 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On 2023/6/22 15:12, Jaegeuk Kim wrote:
> 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 allow
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> 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(-)
>
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 3e35eb7dbb8f..80806ce1289f 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -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))
is_extension_exist(name, ext[i], true, true) ?
Thanks,
> 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);
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v3] f2fs: compress tmp files given extension
@ 2023-06-23 1:41 ` Chao Yu
0 siblings, 0 replies; 22+ messages in thread
From: Chao Yu @ 2023-06-23 1:41 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On 2023/6/22 15:12, Jaegeuk Kim wrote:
> 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 allow
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> 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(-)
>
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 3e35eb7dbb8f..80806ce1289f 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -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))
is_extension_exist(name, ext[i], true, true) ?
Thanks,
> 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);
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [f2fs-dev] [PATCH v4] f2fs: compress tmp files given extension
2023-06-22 7:12 ` Jaegeuk Kim
@ 2023-06-23 19:15 ` Jaegeuk Kim
-1 siblings, 0 replies; 22+ messages in thread
From: Jaegeuk Kim @ 2023-06-23 19:15 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel
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 allow
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
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(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..ff89de115272 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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);
--
2.41.0.162.gfafddb0af9-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v4] f2fs: compress tmp files given extension
@ 2023-06-23 19:15 ` Jaegeuk Kim
0 siblings, 0 replies; 22+ messages in thread
From: Jaegeuk Kim @ 2023-06-23 19:15 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel
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 allow
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
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(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..ff89de115272 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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);
--
2.41.0.162.gfafddb0af9-goog
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [f2fs-dev] [PATCH v4] f2fs: compress tmp files given extension
2023-06-23 19:15 ` Jaegeuk Kim
@ 2023-06-25 2:49 ` Chao Yu
-1 siblings, 0 replies; 22+ messages in thread
From: Chao Yu @ 2023-06-25 2:49 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On 2023/6/24 3:15, Jaegeuk Kim wrote:
> 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 allow
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [f2fs-dev] [PATCH v4] f2fs: compress tmp files given extension
@ 2023-06-25 2:49 ` Chao Yu
0 siblings, 0 replies; 22+ messages in thread
From: Chao Yu @ 2023-06-25 2:49 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel
On 2023/6/24 3:15, Jaegeuk Kim wrote:
> 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 allow
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 22+ messages in thread