f2fs: add no compress extensions support
RFC PATCH 1/1 f2fs: add no compress extensions support
When we create a directory with enable compression, all file write into directory will try to compress.But sometimes we may know, new file cannot meet compression ratio requirements.
We need a nocompress extension to skip those files to avoid unnecessary compress page test.
--- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/namei.c | 12 +++++++++++- fs/f2fs/super.c | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-)
fs/f2fs/f2fs.h +2 -0
@@ -150,8 +150,10 @@ struct f2fs_mount_info {unsigned char compress_level;/* compress level */ bool compress_chksum;/* compressed data chksum */ unsigned char compress_ext_cnt;/* extension count */ +unsigned char nocompress_ext_cnt;/* nocompress extension count */ int compress_mode;/* compression mode */ unsigned char extensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/* extensions */ +unsigned char noextensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/* extensions */ };#define F2FS_FEATURE_ENCRYPT 0x0001
fs/f2fs/namei.c +11 -1
@@ -280,15 +280,25 @@ static void set_compress_inode(struct f2fs_sb_info *sbi, struct inode *inode, {__u8 (*extlist)[F2FS_EXTENSION_LEN ] = sbi->raw_super->extension_list;unsigned char (*ext)[F2FS_EXTENSION_LEN ]; +unsigned char (*noext)[F2FS_EXTENSION_LEN ];unsigned int ext_cnt =F2FS_OPTION (sbi).compress_ext_cnt; +unsigned int noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt;int i, cold_count, hot_count;if (!f2fs_sb_has_compression (sbi) || -is_inode_flag_set (inode,FI_COMPRESSED_FILE ) ||F2FS_I (inode)->i_flags &F2FS_NOCOMP_FL || !f2fs_may_compress (inode))return ; +if (is_inode_flag_set (inode,FI_COMPRESSED_FILE )) { + noext =F2FS_OPTION (sbi).noextensions; +for (i =0 ; i < noext_cnt; i++) { +if (is_extension_exist (name, noext[i])) +f2fs_disable_compressed_file (inode); + } +return ; + } +down_read (&sbi->sb_lock); cold_count =le32_to_cpu (sbi->raw_super->extension_count);
fs/f2fs/super.c +33 -2
@@ -153,6 +153,7 @@ enum { Opt_atgc, Opt_gc_merge, Opt_nogc_merge, + Opt_nocompress_extension, Opt_err, };
@@ -227,6 +228,7 @@ static match_table_t f2fs_tokens = { {Opt_atgc, "atgc"}, {Opt_gc_merge, "gc_merge"}, {Opt_nogc_merge, "nogc_merge"}, + {Opt_nocompress_extension, "nocompress_extension=%s"}, {Opt_err, NULL}, };
@@ -546,7 +548,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)substring_t args[MAX_OPT_ARGS ];#ifdef CONFIG_F2FS_FS_COMPRESSION unsigned char (*ext)[F2FS_EXTENSION_LEN ]; -int ext_cnt; +unsigned char (*noext)[F2FS_EXTENSION_LEN ]; +int ext_cnt, noext_cnt;#endif char *p, *name;int arg =0 ;
@@ -1049,6 +1052,30 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)F2FS_OPTION (sbi).compress_ext_cnt++;kfree (name);break ; +case Opt_nocompress_extension: +if (!f2fs_sb_has_compression (sbi)) { +f2fs_info (sbi,"Image doesn't support compression" ); +break ; + } + name =match_strdup (&args[0 ]); +if (!name) +return -ENOMEM ; + + noext =F2FS_OPTION (sbi).noextensions; + noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt; + +if (strlen (name) >=F2FS_EXTENSION_LEN || + noext_cnt >=COMPRESS_EXT_NUM ) { +f2fs_err (sbi, +"invalid extension length/number" ); +kfree (name); +return -EINVAL ; + } + +strcpy (noext[noext_cnt], name); +F2FS_OPTION (sbi).nocompress_ext_cnt++; +kfree (name); +break ;case Opt_compress_chksum:F2FS_OPTION (sbi).compress_chksum = true;break ;
@@ -1072,6 +1099,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)case Opt_compress_extension:case Opt_compress_chksum:case Opt_compress_mode: +case Opt_nocompress_extension:f2fs_info (sbi,"compression options not supported" );break ;#endif
@@ -1664,7 +1692,10 @@ static inline void f2fs_show_compress_options(struct seq_file *seq,seq_printf (seq,",compress_extension=%s" ,F2FS_OPTION (sbi).extensions[i]); } - +for (i =0 ; i <F2FS_OPTION (sbi).nocompress_ext_cnt; i++) { +seq_printf (seq,",nocompress_extension=%s" , +F2FS_OPTION (sbi).noextensions[i]); + }if (F2FS_OPTION (sbi).compress_chksum)seq_puts (seq,",compress_chksum" );
--
2.29.0
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hi Fengnan,
Quoted 5 lines · Fengnan Chang
When we create a directory with enable compression, all file write into directory will try to compress.But sometimes we may know, new file cannot meet compression ratio requirements.
We need a nocompress extension to skip those files to avoid unnecessary compress page test.
Could you please elaborate your detail usage scenario? something like in which directory, what kind of specified extension do you want to disable?
It's a bit complicated for below cases:compress_extension = "abc" and nocompress_extension = "abc" or compress_extension = "*" and nocompress_extension = "abc" or compress_extension = "abc" and nocompress_extension = "*"
Thanks,
Quoted 140 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/namei.c | 12 +++++++++++- fs/f2fs/super.c | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-)fs/f2fs/f2fs.h +2
-0@@ -150,8 +150,10 @@ struct f2fs_mount_info {unsigned char compress_level;/* compress level */ bool compress_chksum;/* compressed data chksum */ unsigned char compress_ext_cnt;/* extension count */ +unsigned char nocompress_ext_cnt;/* nocompress extension count */ int compress_mode;/* compression mode */ unsigned char extensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/* extensions */ +unsigned char noextensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/* extensions */ };#define F2FS_FEATURE_ENCRYPT 0x0001fs/f2fs/namei.c +11
-1@@ -280,15 +280,25 @@ static void set_compress_inode(struct f2fs_sb_info *sbi, struct inode *inode, {__u8 (*extlist)[F2FS_EXTENSION_LEN ] = sbi->raw_super->extension_list;unsigned char (*ext)[F2FS_EXTENSION_LEN ]; +unsigned char (*noext)[F2FS_EXTENSION_LEN ];unsigned int ext_cnt =F2FS_OPTION (sbi).compress_ext_cnt; +unsigned int noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt;int i, cold_count, hot_count;if (!f2fs_sb_has_compression (sbi) || -is_inode_flag_set (inode,FI_COMPRESSED_FILE ) ||F2FS_I (inode)->i_flags &F2FS_NOCOMP_FL || !f2fs_may_compress (inode))return ; +if (is_inode_flag_set (inode,FI_COMPRESSED_FILE )) { + noext =F2FS_OPTION (sbi).noextensions; +for (i =0 ; i < noext_cnt; i++) { +if (is_extension_exist (name, noext[i])) +f2fs_disable_compressed_file (inode); + } +return ; + } +down_read (&sbi->sb_lock); cold_count =le32_to_cpu (sbi->raw_super->extension_count);fs/f2fs/super.c +33
-3@@ -153,6 +153,7 @@ enum { Opt_atgc, Opt_gc_merge, Opt_nogc_merge, + Opt_nocompress_extension, Opt_err, };@@ -227,6 +228,7 @@ static match_table_t f2fs_tokens = { {Opt_atgc, "atgc"}, {Opt_gc_merge, "gc_merge"}, {Opt_nogc_merge, "nogc_merge"}, + {Opt_nocompress_extension, "nocompress_extension=%s"}, {Opt_err, NULL}, };@@ -546,7 +548,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)substring_t args[MAX_OPT_ARGS ];#ifdef CONFIG_F2FS_FS_COMPRESSION unsigned char (*ext)[F2FS_EXTENSION_LEN ]; -int ext_cnt; +unsigned char (*noext)[F2FS_EXTENSION_LEN ]; +int ext_cnt, noext_cnt;#endif char *p, *name;int arg =0 ;@@ -1049,6 +1052,30 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)F2FS_OPTION (sbi).compress_ext_cnt++;kfree (name);break ; +case Opt_nocompress_extension: +if (!f2fs_sb_has_compression (sbi)) { +f2fs_info (sbi,"Image doesn't support compression" ); +break ; + } + name =match_strdup (&args[0 ]); +if (!name) +return -ENOMEM ; + + noext =F2FS_OPTION (sbi).noextensions; + noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt; + +if (strlen (name) >=F2FS_EXTENSION_LEN || + noext_cnt >=COMPRESS_EXT_NUM ) { +f2fs_err (sbi, +"invalid extension length/number" ); +kfree (name); +return -EINVAL ; + } + +strcpy (noext[noext_cnt], name); +F2FS_OPTION (sbi).nocompress_ext_cnt++; +kfree (name); +break ;case Opt_compress_chksum:F2FS_OPTION (sbi).compress_chksum = true;break ;@@ -1072,6 +1099,7 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)case Opt_compress_extension:case Opt_compress_chksum:case Opt_compress_mode: +case Opt_nocompress_extension:f2fs_info (sbi,"compression options not supported" );break ;#endif @@ -1664,7 +1692,10 @@ static inline void f2fs_show_compress_options(struct seq_file *seq,seq_printf (seq,",compress_extension=%s" ,F2FS_OPTION (sbi).extensions[i]); } - +for (i =0 ; i <F2FS_OPTION (sbi).nocompress_ext_cnt; i++) { +seq_printf (seq,",nocompress_extension=%s" , +F2FS_OPTION (sbi).noextensions[i]); + }if (F2FS_OPTION (sbi).compress_chksum)seq_puts (seq,",compress_chksum" ); --2.29.0
Quoted 6 lines
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
For example, when we enables compression of the entire mounted directory, and the mounted directory used by applications, the applications may write some
files that have been compressed, such as tar files and zip files, we want avoid duplicate compressions for these.
As for the complex, ambiguous cases you point out, we might add some legitimacy checks.
-----邮件原件-----
发件人: Chao Yu <[email protected]>
发送时间: 2021年4月15日 9:32
收件人: Fengnan Chang <[email protected]>
抄送: [email protected]; [email protected]; [email protected]
主题: Re: [f2fs-dev] [RFC PATCH] f2fs: add no compress extensions support
Hi Fengnan,
Quoted 5 lines · Fengnan Chang
When we create a directory with enable compression, all file write into directory will try to compress.But sometimes we may know, new file cannot meet compression ratio requirements.
We need a nocompress extension to skip those files to avoid unnecessary compress page test.
Could you please elaborate your detail usage scenario? something like in which directory, what kind of specified extension do you want to disable?
It's a bit complicated for below cases:compress_extension = "abc" and nocompress_extension = "abc" or compress_extension = "*" and nocompress_extension = "abc" or compress_extension = "abc" and nocompress_extension = "*"
Thanks,
Quoted 13 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/namei.c | 12 +++++++++++- fs/f2fs/super.c | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-)fs/f2fs/f2fs.h index renamed from fs/f2fs/f2fs.h +0
-0
87d734f5589d..3d5d28a2568f100644
fs/f2fs/f2fs.h struct f2fs_mount_info { · line 153
Quoted 4 lines
fs/f2fs/f2fs.h +1
-0@@ -150,8 +150,10 @@ struct f2fs_mount_info {unsigned char compress_level;/* compress level */ bool compress_chksum;/* compressed data chksum */ unsigned char compress_ext_cnt;/* extension count */ +unsigned char nocompress_ext_cnt;/* nocompress
extension count */
fs/f2fs/f2fs.h struct f2fs_mount_info { · line 155
Quoted 2 lines
fs/f2fs/f2fs.h +0
-0int compress_mode;/* compression mode */ unsigned char extensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/*
extensions */
fs/f2fs/namei.c static void set_compress_inode(struct f2fs_sb_info
Quoted 11 lines
fs/f2fs/f2fs.h +2
-0+unsigned char noextensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/* +extensions */ };#define F2FS_FEATURE_ENCRYPT 0x0001fs/f2fs/namei.c index renamed from fs/f2fs/namei.c +0
-0
405d85dbf9f1..09b76a7f048a100644fs/f2fs/namei.c +0
-0@@ -280,15 +280,25 @@ static void set_compress_inode(struct f2fs_sb_info
*sbi, struct inode *inode,
fs/f2fs/namei.c static void set_compress_inode(struct f2fs_sb_info · line 281
Quoted 2 lines
fs/f2fs/namei.c +0
-0{ __u8 (*extlist)[F2FS_EXTENSION_LEN] =
sbi->raw_super->extension_list;
fs/f2fs/super.c static int parse_options(struct super_block *sb, char
Quoted 45 lines
fs/f2fs/namei.c +11
-1unsigned char (*ext)[F2FS_EXTENSION_LEN ]; +unsigned char (*noext)[F2FS_EXTENSION_LEN ];unsigned int ext_cnt =F2FS_OPTION (sbi).compress_ext_cnt; +unsigned int noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt;int i, cold_count, hot_count;if (!f2fs_sb_has_compression (sbi) || -is_inode_flag_set (inode,FI_COMPRESSED_FILE ) ||F2FS_I (inode)->i_flags &F2FS_NOCOMP_FL || !f2fs_may_compress (inode))return ; +if (is_inode_flag_set (inode,FI_COMPRESSED_FILE )) { + noext =F2FS_OPTION (sbi).noextensions; +for (i =0 ; i < noext_cnt; i++) { +if (is_extension_exist (name, noext[i])) +f2fs_disable_compressed_file (inode); + } +return ; + } +down_read (&sbi->sb_lock); cold_count =le32_to_cpu (sbi->raw_super->extension_count);fs/f2fs/super.c index renamed from fs/f2fs/super.c +0
-0
5020152aa8fc..b5a9ba8ea869100644fs/f2fs/super.c +2
-0@@ -153,6 +153,7 @@ enum { Opt_atgc, Opt_gc_merge, Opt_nogc_merge, + Opt_nocompress_extension, Opt_err, };@@ -227,6 +228,7 @@ static match_table_t f2fs_tokens = { {Opt_atgc, "atgc"}, {Opt_gc_merge, "gc_merge"}, {Opt_nogc_merge, "nogc_merge"}, + {Opt_nocompress_extension, "nocompress_extension=%s"}, {Opt_err, NULL}, };@@ -546,7 +548,8 @@ static int parse_options(struct super_block *sb, char
*options, bool is_remount)
fs/f2fs/super.c static int parse_options(struct super_block *sb,
Quoted 10 lines
fs/f2fs/super.c +2
-1substring_t args[MAX_OPT_ARGS ];#ifdef CONFIG_F2FS_FS_COMPRESSION unsigned char (*ext)[F2FS_EXTENSION_LEN ]; -int ext_cnt; +unsigned char (*noext)[F2FS_EXTENSION_LEN ]; +int ext_cnt, noext_cnt;#endif char *p, *name;int arg =0 ;@@ -1049,6 +1052,30 @@ static int parse_options(struct super_block *sb,
char *options, bool is_remount)
fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount)
Quoted 6 lines
fs/f2fs/super.c +3
-0F2FS_OPTION (sbi).compress_ext_cnt++;kfree (name);break ; +case Opt_nocompress_extension: +if (!f2fs_sb_has_compression (sbi)) { + f2fs_info(sbi, "Image doesn't support
compression");
fs/f2fs/super.c static int parse_options(struct super_block *sb,
Quoted 25 lines
fs/f2fs/super.c +21
-0+break ; + } + name =match_strdup (&args[0 ]); +if (!name) +return -ENOMEM ; + + noext =F2FS_OPTION (sbi).noextensions; + noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt; + +if (strlen (name) >=F2FS_EXTENSION_LEN || + noext_cnt >=COMPRESS_EXT_NUM ) { +f2fs_err (sbi, +"invalid extension length/number" ); +kfree (name); +return -EINVAL ; + } + +strcpy (noext[noext_cnt], name); +F2FS_OPTION (sbi).nocompress_ext_cnt++; +kfree (name); +break ;case Opt_compress_chksum:F2FS_OPTION (sbi).compress_chksum = true;break ;@@ -1072,6 +1099,7 @@ static int parse_options(struct super_block *sb,
char *options, bool is_remount)
fs/f2fs/super.c static inline void
Quoted 8 lines
fs/f2fs/super.c +1
-0case Opt_compress_extension:case Opt_compress_chksum:case Opt_compress_mode: +case Opt_nocompress_extension:f2fs_info (sbi,"compression options not supported" );break ;#endif @@ -1664,7 +1692,10 @@ static inline void
f2fs_show_compress_options(struct seq_file *seq,
Quoted 16 lines
fs/f2fs/super.c +4
-2seq_printf (seq,",compress_extension=%s" ,F2FS_OPTION (sbi).extensions[i]); } - +for (i =0 ; i <F2FS_OPTION (sbi).nocompress_ext_cnt; i++) { +seq_printf (seq,",nocompress_extension=%s" , +F2FS_OPTION (sbi).noextensions[i]); + }if (F2FS_OPTION (sbi).compress_chksum)seq_puts (seq,",compress_chksum" ); --2.29.0
Quoted 6 lines
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
.
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 5 lines · On 2021/4/15 9:56, [email protected] wrote:
For example, when we enables compression of the entire mounted directory, and the mounted directory used by applications, the applications may write some
files that have been compressed, such as tar files and zip files, we want avoid duplicate compressions for these.
Yes, except that, another concern is we should figure out the access model of file, in order to avoid read/write amplification after compression.
So, in your case, how do you plan to handle file which has bad compression or has random access model, but the file has no extension name?
Quoted 3 lines
As for the complex, ambiguous cases you point out, we might add some legitimacy checks.
I'm not against this patch, but could you please consider more about semantics conflict in between existed compress options and the new one?
Thanks,
Quoted 179 lines
-----邮件原件-----
发件人: Chao Yu <[email protected]>
发送时间: 2021年4月15日 9:32
收件人: Fengnan Chang <[email protected]>
抄送: [email protected]; [email protected]; [email protected]
主题: Re: [f2fs-dev] [RFC PATCH] f2fs: add no compress extensions supportHi Fengnan,
Quoted 5 lines · Fengnan Chang
When we create a directory with enable compression, all file write into directory will try to compress.But sometimes we may know, new file cannot meet compression ratio requirements.
We need a nocompress extension to skip those files to avoid unnecessary compress page test.Could you please elaborate your detail usage scenario? something like in which directory, what kind of specified extension do you want to disable?
It's a bit complicated for below cases:
compress_extension= "abc" andnocompress_extension= "abc" orcompress_extension= "*" andnocompress_extension= "abc" orcompress_extension= "abc" andnocompress_extension= "*"Thanks,
Quoted 13 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/f2fs.h | 2 ++ fs/f2fs/namei.c | 12 +++++++++++- fs/f2fs/super.c | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-)fs/f2fs/f2fs.h index renamed from fs/f2fs/f2fs.h +0
-0
87d734f5589d..3d5d28a2568f100644fs/f2fs/f2fs.h struct f2fs_mount_info { · line 153
Quoted 4 lines
fs/f2fs/f2fs.h +1
-0@@ -150,8 +150,10 @@ struct f2fs_mount_info {unsigned char compress_level;/* compress level */ bool compress_chksum;/* compressed data chksum */ unsigned char compress_ext_cnt;/* extension count */ +unsigned char nocompress_ext_cnt;/* nocompress extension count */
fs/f2fs/f2fs.h struct f2fs_mount_info { · line 155
Quoted 2 lines
fs/f2fs/f2fs.h +0
-0int compress_mode;/* compression mode */ unsigned char extensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/* extensions */
fs/f2fs/namei.c static void set_compress_inode(struct f2fs_sb_info
Quoted 11 lines
fs/f2fs/f2fs.h +2
-0+unsigned char noextensions[COMPRESS_EXT_NUM ][F2FS_EXTENSION_LEN ];/* +extensions */ };#define F2FS_FEATURE_ENCRYPT 0x0001fs/f2fs/namei.c index renamed from fs/f2fs/namei.c +0
-0
405d85dbf9f1..09b76a7f048a100644fs/f2fs/namei.c +0
-0@@ -280,15 +280,25 @@ static void set_compress_inode(struct f2fs_sb_info*sbi, struct inode *inode,
fs/f2fs/namei.c static void set_compress_inode(struct f2fs_sb_info · line 281
Quoted 2 lines
fs/f2fs/namei.c +0
-0{ __u8 (*extlist)[F2FS_EXTENSION_LEN] =
sbi->raw_super->extension_list;fs/f2fs/super.c static int parse_options(struct super_block *sb, char
Quoted 45 lines
fs/f2fs/namei.c +11
-1unsigned char (*ext)[F2FS_EXTENSION_LEN ]; +unsigned char (*noext)[F2FS_EXTENSION_LEN ];unsigned int ext_cnt =F2FS_OPTION (sbi).compress_ext_cnt; +unsigned int noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt;int i, cold_count, hot_count;if (!f2fs_sb_has_compression (sbi) || -is_inode_flag_set (inode,FI_COMPRESSED_FILE ) ||F2FS_I (inode)->i_flags &F2FS_NOCOMP_FL || !f2fs_may_compress (inode))return ; +if (is_inode_flag_set (inode,FI_COMPRESSED_FILE )) { + noext =F2FS_OPTION (sbi).noextensions; +for (i =0 ; i < noext_cnt; i++) { +if (is_extension_exist (name, noext[i])) +f2fs_disable_compressed_file (inode); + } +return ; + } +down_read (&sbi->sb_lock); cold_count =le32_to_cpu (sbi->raw_super->extension_count);fs/f2fs/super.c index renamed from fs/f2fs/super.c +0
-0
5020152aa8fc..b5a9ba8ea869100644fs/f2fs/super.c +2
-0@@ -153,6 +153,7 @@ enum { Opt_atgc, Opt_gc_merge, Opt_nogc_merge, + Opt_nocompress_extension, Opt_err, };@@ -227,6 +228,7 @@ static match_table_t f2fs_tokens = { {Opt_atgc, "atgc"}, {Opt_gc_merge, "gc_merge"}, {Opt_nogc_merge, "nogc_merge"}, + {Opt_nocompress_extension, "nocompress_extension=%s"}, {Opt_err, NULL}, };@@ -546,7 +548,8 @@ static int parse_options(struct super_block *sb, char*options, bool
is_remount)fs/f2fs/super.c static int parse_options(struct super_block *sb,
Quoted 10 lines
fs/f2fs/super.c +2
-1substring_t args[MAX_OPT_ARGS ];#ifdef CONFIG_F2FS_FS_COMPRESSION unsigned char (*ext)[F2FS_EXTENSION_LEN ]; -int ext_cnt; +unsigned char (*noext)[F2FS_EXTENSION_LEN ]; +int ext_cnt, noext_cnt;#endif char *p, *name;int arg =0 ;@@ -1049,6 +1052,30 @@ static int parse_options(struct super_block *sb,char *options, bool
is_remount)fs/f2fs/super.c static int parse_options(struct super_block *sb, char *options, bool is_remount)
Quoted 6 lines
fs/f2fs/super.c +3
-0F2FS_OPTION (sbi).compress_ext_cnt++;kfree (name);break ; +case Opt_nocompress_extension: +if (!f2fs_sb_has_compression (sbi)) { + f2fs_info(sbi, "Image doesn't supportcompression");
fs/f2fs/super.c static int parse_options(struct super_block *sb,
Quoted 25 lines
fs/f2fs/super.c +21
-0+break ; + } + name =match_strdup (&args[0 ]); +if (!name) +return -ENOMEM ; + + noext =F2FS_OPTION (sbi).noextensions; + noext_cnt =F2FS_OPTION (sbi).nocompress_ext_cnt; + +if (strlen (name) >=F2FS_EXTENSION_LEN || + noext_cnt >=COMPRESS_EXT_NUM ) { +f2fs_err (sbi, +"invalid extension length/number" ); +kfree (name); +return -EINVAL ; + } + +strcpy (noext[noext_cnt], name); +F2FS_OPTION (sbi).nocompress_ext_cnt++; +kfree (name); +break ;case Opt_compress_chksum:F2FS_OPTION (sbi).compress_chksum = true;break ;@@ -1072,6 +1099,7 @@ static int parse_options(struct super_block *sb,char *options, bool
is_remount)fs/f2fs/super.c static inline void
Quoted 8 lines
fs/f2fs/super.c +1
-0case Opt_compress_extension:case Opt_compress_chksum:case Opt_compress_mode: +case Opt_nocompress_extension:f2fs_info (sbi,"compression options not supported" );break ;#endif @@ -1664,7 +1692,10 @@ static inline voidf2fs_show_compress_options(struct
seq_file*seq,Quoted 16 lines
fs/f2fs/super.c +4
-2seq_printf (seq,",compress_extension=%s" ,F2FS_OPTION (sbi).extensions[i]); } - +for (i =0 ; i <F2FS_OPTION (sbi).nocompress_ext_cnt; i++) { +seq_printf (seq,",nocompress_extension=%s" , +F2FS_OPTION (sbi).noextensions[i]); + }if (F2FS_OPTION (sbi).compress_chksum)seq_puts (seq,",compress_chksum" ); --2.29.0
Quoted 10 lines
Quoted 6 lines
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
..
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
[f2fs-dev] =?y?q?Re=3A=20=5Bf2fs-dev=5D=20=E7=AD=94=E5=A4=8D=3A=20=20=5BRFC=20PATCH=5D=20f2fs=3A=20add=20no=20compress=20extensions=20support?=
In this patch, we cannot handle files without extensions. At the moment there is just a rough idea,test a portion of the data to decide whether to compress it before performing a full compression. It may need more test. Any other suggestions?
In my consider, the non-compress flag has a higher priority than the compressed flag.
1. the same extension name cannot not appear in both compress and non-compress extension at the same time, check this in mount process.
2. If the compress extension specifies all files, the types specified by the non-compress extension will be treated as special cases and will not be compressed.
3. If the non-compress extension specifies all files, should not specifies any compress extension, check in mount process too.
Any other suggestions?
Thanks.
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerQuoted 6 lines · Fengnan Chang
In this patch, we cannot handle files without extensions. At the moment there is just a rough idea,test a portion of the data to decide whether to compress it before performing a full compression. It may need more test. Any other suggestions?
In my consider, the non-compress flag has a higher priority than the compressed flag.
1. the same extension name cannot not appear in both compress and non-compress extension at the same time, check this in mount process.
2. If the compress extension specifies all files, the types specified by the non-compress extension will be treated as special cases and will not be compressed.
3. If the non-compress extension specifies all files, should not specifies any compress extension, check in mount process too.
Do we need to support * for non-compress?
Quoted 2 lines
Any other suggestions?
So, what could the priority for all the below combinations?
E.g., comp_extention, no_comp_extention, dir_flag, comp_file_flag, no_comp_file_flag.
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
It seems that we don't need to support * for non-compress.
For now, if one file match comp_extention, the dir flag not work, but we can still use comp_file_flag and no_comp_file_flag. So the priority is:dir_flag < comp_extention < comp_file_flag, no_comp_file_flag.
after add no_comp_extention flag, the priority should be:dir_flag < comp_extention < no_comp_extention < comp_file_flag, no_comp_file_flag.
-----邮件原件-----
发件人: Jaegeuk Kim <[email protected]>
发送时间: 2021年4月20日 0:23
收件人: Fengnan Chang <[email protected]>
抄送: [email protected]; [email protected]; [email protected]
主题: Re: [f2fs-dev] 答复: [RFC PATCH] f2fs: add no compress extensions support
Quoted 5 lines · Fengnan Chang
In this patch, we cannot handle files without extensions. At the moment there is just a rough idea,test a portion of the data to decide whether to compress it before performing a full compression. It may need more test. Any other suggestions?
Quoted 9 lines
In my consider, the non-compress flag has a higher priority than the compressed flag.
1. the same extension name cannot not appear in both compress and non-compress extension at the same time, check this in mount process.
2. If the compress extension specifies all files, the types specified by the non-compress extension will be treated as special cases and will not be compressed.
3. If the non-compress extension specifies all files, should not specifies any compress extension, check in mount process too.
Do we need to support * for non-compress?
Quoted 2 lines
Any other suggestions?
So, what could the priority for all the below combinations?
E.g., comp_extention, no_comp_extention, dir_flag, comp_file_flag, no_comp_file_flag.
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
If there are no further comments, I will issue a formal patch later.
-----邮件原件-----
发件人: [email protected] <[email protected]>
发送时间: 2021年4月20日 10:08
收件人: 'Jaegeuk Kim' <[email protected]>; 'Fengnan Chang' <[email protected]> 抄送: [email protected]; [email protected]
主题: 答复: [f2fs-dev] 答复: [RFC PATCH] f2fs: add no compress extensions support
It seems that we don't need to support * for non-compress.
For now, if one file match comp_extention, the dir flag not work, but we can still use comp_file_flag and no_comp_file_flag. So the priority is:dir_flag < comp_extention < comp_file_flag, no_comp_file_flag.
after add no_comp_extention flag, the priority should be:dir_flag < comp_extention < no_comp_extention < comp_file_flag, no_comp_file_flag.
-----邮件原件-----
发件人: Jaegeuk Kim <[email protected]>
发送时间: 2021年4月20日 0:23
收件人: Fengnan Chang <[email protected]>
抄送: [email protected]; [email protected]; [email protected] 主题: Re: [f2fs-dev] 答复: [RFC PATCH] f2fs: add no compress extensions support
Quoted 5 lines · Fengnan Chang
In this patch, we cannot handle files without extensions. At the moment there is just a rough idea,test a portion of the data to decide whether to compress it before performing a full compression. It may need more test. Any other suggestions?
Quoted 9 lines
In my consider, the non-compress flag has a higher priority than the compressed flag.
1. the same extension name cannot not appear in both compress and non-compress extension at the same time, check this in mount process.
2. If the compress extension specifies all files, the types specified by the non-compress extension will be treated as special cases and will not be compressed.
3. If the non-compress extension specifies all files, should not specifies any compress extension, check in mount process too.
Do we need to support * for non-compress?
Quoted 2 lines
Any other suggestions?
So, what could the priority for all the below combinations?
E.g., comp_extention, no_comp_extention, dir_flag, comp_file_flag, no_comp_file_flag.
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel