Re: [f2fs-dev] [PATCH] f2fs: compress tmp files given extension

2023-06-12 Thread Chao Yu

On 2023/6/12 23:36, Jaegeuk Kim wrote:

On 06/12, Chao Yu wrote:

On 2023/6/7 4:36, Jaegeuk Kim wrote:

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.


abc.so.tmp and abc.so, given compress_extension=so.


Copied.



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,


Will check what's going on here.



commit 4a67d9b07ac8dce7f1034e0d887f2f4ee00fe118
Author: Chao Yu 
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,



Signed-off-by: Jaegeuk Kim 
---
   fs/f2fs/namei.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..cdc94c8e60f7 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] f2fs: compress tmp files given extension

2023-06-12 Thread Jaegeuk Kim
On 06/12, Chao Yu wrote:
> On 2023/6/7 4:36, Jaegeuk Kim wrote:
> > 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.

> 
> commit 4a67d9b07ac8dce7f1034e0d887f2f4ee00fe118
> Author: Chao Yu 
> 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,
> 
> > 
> > Signed-off-by: Jaegeuk Kim 
> > ---
> >   fs/f2fs/namei.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> > index 3e35eb7dbb8f..cdc94c8e60f7 100644
> > --- a/fs/f2fs/namei.c
> > +++ b/fs/f2fs/namei.c
> > @@ -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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH] f2fs: compress tmp files given extension

2023-06-12 Thread Chao Yu

On 2023/6/7 4:36, Jaegeuk Kim wrote:

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 
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,



Signed-off-by: Jaegeuk Kim 
---
  fs/f2fs/namei.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..cdc94c8e60f7 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] f2fs: compress tmp files given extension

2023-06-06 Thread Jaegeuk Kim
Let's compress tmp files for the given extension list.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3e35eb7dbb8f..cdc94c8e60f7 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -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;
}
-- 
2.41.0.rc0.172.g3f132b7071-goog



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel