Skip to contentSkip to conversation

f2fs: allow to set compression for inlined file

PATCH In review Jaegeuk Kim 2 participants 7 messages Oct 24, 2022 – Oct 27, 2022 F2FS file system

lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: allow to set compression for inlined file

The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.

Fixes 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion")
---
 fs/f2fs/file.c | 3 +++
 1 file changed, 3 insertions(+)
fs/f2fs/file.c +3 -0
index 1c4004c9245f..304fe08edc61 100644
@@ -1915,6 +1915,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
 			if (!f2fs_disable_compressed_file(inode))
 				return -EINVAL;
 		} else {
+			/* try to convert inline_data to support compression */
+			f2fs_convert_inline_inode(inode);
+
 			if (!f2fs_may_compress(inode))
 				return -EINVAL;
 			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
Signature · 8 lines
2.38.0.135.g90850a2211-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer
#1 lore raw
Quoted 14 lines · Jaegeuk Kim

The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.

Fixes 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion")
---
  fs/f2fs/file.c | 3 +++
  1 file changed, 3 insertions(+)
fs/f2fs/file.c +0 -0
index 1c4004c9245f..304fe08edc61 100644

fs/f2fs/file.c static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) · line 1919

Quoted 5 lines
fs/f2fs/file.c +2 -0
@@ -1915,6 +1915,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
  			if (!f2fs_disable_compressed_file(inode))
  				return -EINVAL;
  		} else {
+			/* try to convert inline_data to support compression */
+			f2fs_convert_inline_inode(inode);

It needs to check return value of f2fs_convert_inline_inode()?

Thanks,

fs/f2fs/file.c static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) · line 1923

Quoted 4 lines
fs/f2fs/file.c +1 -0
+
  			if (!f2fs_may_compress(inode))
  				return -EINVAL;
  			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author maintainer
#2 lore raw
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim

The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.

Fixes 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion")
---
  fs/f2fs/file.c | 3 +++
  1 file changed, 3 insertions(+)
Quoted 12 lines

fs/f2fs/file.c static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) · line 1919

Quoted 10 lines
fs/f2fs/file.c +2 -0
index 1c4004c9245f..304fe08edc61 100644
@@ -1915,6 +1915,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
  			if (!f2fs_disable_compressed_file(inode))
  				return -EINVAL;
  		} else {
+			/* try to convert inline_data to support compression */
+			f2fs_convert_inline_inode(inode);

It needs to check return value of f2fs_convert_inline_inode()?

I intended to catch that in the below checks?

Quoted 7 lines

Thanks,

Quoted 4 lines
fs/f2fs/file.c +1 -0
+
  			if (!f2fs_may_compress(inode))
  				return -EINVAL;
  			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
maintainer
#3 lore raw
Quoted 24 lines · Jaegeuk Kim
Quoted 10 lines · Chao Yu
Quoted 9 lines · Jaegeuk Kim

The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.

Fixes 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion")
---
   fs/f2fs/file.c | 3 +++
   1 file changed, 3 insertions(+)
Quoted 12 lines

fs/f2fs/file.c static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) · line 1919

Quoted 10 lines
fs/f2fs/file.c +2 -0
index 1c4004c9245f..304fe08edc61 100644
@@ -1915,6 +1915,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
   			if (!f2fs_disable_compressed_file(inode))
   				return -EINVAL;
   		} else {
+			/* try to convert inline_data to support compression */
+			f2fs_convert_inline_inode(inode);

It needs to check return value of f2fs_convert_inline_inode()?

Quoted 1 line

I intended to catch that in the below checks?

But it may hide the real error number, e.g. -ENOMEM returned from f2fs_convert_inline_inode()?

Thanks,

Quoted 8 lines
Quoted 8 lines

Thanks,

Quoted 4 lines
fs/f2fs/file.c +1 -0
+
   			if (!f2fs_may_compress(inode))
   				return -EINVAL;
   			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
author maintainer
#4 lore raw
Quoted 25 lines · Chao Yu
Quoted 24 lines · Jaegeuk Kim
Quoted 22 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim

The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.

Fixes 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion")
---
   fs/f2fs/file.c | 3 +++
   1 file changed, 3 insertions(+)
fs/f2fs/file.c +0 -0
index 1c4004c9245f..304fe08edc61 100644

fs/f2fs/file.c static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask) · line 1919

Quoted 5 lines
fs/f2fs/file.c +2 -0
@@ -1915,6 +1915,9 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
   			if (!f2fs_disable_compressed_file(inode))
   				return -EINVAL;
   		} else {
+			/* try to convert inline_data to support compression */
+			f2fs_convert_inline_inode(inode);

It needs to check return value of f2fs_convert_inline_inode()?

Quoted 4 lines
Quoted 1 line

I intended to catch that in the below checks?

But it may hide the real error number, e.g. -ENOMEM returned from f2fs_convert_inline_inode()?

Fair enough. Let me send v2.

Quoted 11 lines

Thanks,

Quoted 8 lines
Quoted 8 lines

Thanks,

Quoted 4 lines
fs/f2fs/file.c +1 -0
+
   			if (!f2fs_may_compress(inode))
   				return -EINVAL;
   			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
author maintainer
#5 lore raw
In reply to Jaegeuk Kim

The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.

Fixes 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion")

---
Change log from v1:
- add returning an error

 fs/f2fs/file.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/f2fs/file.c +4 -0
index 1c4004c9245f..8cd52b0965b1 100644
@@ -1915,6 +1915,10 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)
 			if (!f2fs_disable_compressed_file(inode))
 				return -EINVAL;
 		} else {
+			/* try to convert inline_data to support compression */
+			int err = f2fs_convert_inline_inode(inode);
+			if (err)
+				return err;
 			if (!f2fs_may_compress(inode))
 				return -EINVAL;
 			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))
Signature · 1 line
2.38.0.135.g90850a2211-goog
maintainer Reviewed-by
#6 lore raw
Quoted 5 lines · Jaegeuk Kim

The below commit disallows to set compression on empty created file which has a inline_data. Let's fix it.

Fixes 7165841d578e ("f2fs: fix to check inline_data during compressed inode conversion")

Thanks,