linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: allow to set compression for inlined file
@ 2022-10-24 23:36 Jaegeuk Kim
  2022-10-25  6:57 ` [f2fs-dev] " Chao Yu
  2022-10-26 17:06 ` [PATCH v2] " Jaegeuk Kim
  0 siblings, 2 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2022-10-24 23:36 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: 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")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 1c4004c9245f..304fe08edc61 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -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))
-- 
2.38.0.135.g90850a2211-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: allow to set compression for inlined file
  2022-10-24 23:36 [PATCH] f2fs: allow to set compression for inlined file Jaegeuk Kim
@ 2022-10-25  6:57 ` Chao Yu
  2022-10-25 17:46   ` Jaegeuk Kim
  2022-10-26 17:06 ` [PATCH v2] " Jaegeuk Kim
  1 sibling, 1 reply; 7+ messages in thread
From: Chao Yu @ 2022-10-25  6:57 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2022/10/25 7:36, Jaegeuk Kim wrote:
> 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")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   fs/f2fs/file.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 1c4004c9245f..304fe08edc61 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -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,

> +
>   			if (!f2fs_may_compress(inode))
>   				return -EINVAL;
>   			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: allow to set compression for inlined file
  2022-10-25  6:57 ` [f2fs-dev] " Chao Yu
@ 2022-10-25 17:46   ` Jaegeuk Kim
  2022-10-26  1:17     ` Chao Yu
  0 siblings, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2022-10-25 17:46 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 10/25, Chao Yu wrote:
> On 2022/10/25 7:36, Jaegeuk Kim wrote:
> > 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")
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >   fs/f2fs/file.c | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > index 1c4004c9245f..304fe08edc61 100644
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
> > @@ -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?

> 
> Thanks,
> 
> > +
> >   			if (!f2fs_may_compress(inode))
> >   				return -EINVAL;
> >   			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: allow to set compression for inlined file
  2022-10-25 17:46   ` Jaegeuk Kim
@ 2022-10-26  1:17     ` Chao Yu
  2022-10-26 17:04       ` Jaegeuk Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Yu @ 2022-10-26  1:17 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2022/10/26 1:46, Jaegeuk Kim wrote:
> On 10/25, Chao Yu wrote:
>> On 2022/10/25 7:36, Jaegeuk Kim wrote:
>>> 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")
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>    fs/f2fs/file.c | 3 +++
>>>    1 file changed, 3 insertions(+)
>>>
>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>>> index 1c4004c9245f..304fe08edc61 100644
>>> --- a/fs/f2fs/file.c
>>> +++ b/fs/f2fs/file.c
>>> @@ -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?

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

Thanks,

> 
>>
>> Thanks,
>>
>>> +
>>>    			if (!f2fs_may_compress(inode))
>>>    				return -EINVAL;
>>>    			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: allow to set compression for inlined file
  2022-10-26  1:17     ` Chao Yu
@ 2022-10-26 17:04       ` Jaegeuk Kim
  0 siblings, 0 replies; 7+ messages in thread
From: Jaegeuk Kim @ 2022-10-26 17:04 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 10/26, Chao Yu wrote:
> On 2022/10/26 1:46, Jaegeuk Kim wrote:
> > On 10/25, Chao Yu wrote:
> > > On 2022/10/25 7:36, Jaegeuk Kim wrote:
> > > > 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")
> > > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > > > ---
> > > >    fs/f2fs/file.c | 3 +++
> > > >    1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > > > index 1c4004c9245f..304fe08edc61 100644
> > > > --- a/fs/f2fs/file.c
> > > > +++ b/fs/f2fs/file.c
> > > > @@ -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?
> 
> But it may hide the real error number, e.g. -ENOMEM returned from
> f2fs_convert_inline_inode()?

Fair enough. Let me send v2.

> 
> Thanks,
> 
> > 
> > > 
> > > Thanks,
> > > 
> > > > +
> > > >    			if (!f2fs_may_compress(inode))
> > > >    				return -EINVAL;
> > > >    			if (S_ISREG(inode->i_mode) && F2FS_HAS_BLOCKS(inode))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] f2fs: allow to set compression for inlined file
  2022-10-24 23:36 [PATCH] f2fs: allow to set compression for inlined file Jaegeuk Kim
  2022-10-25  6:57 ` [f2fs-dev] " Chao Yu
@ 2022-10-26 17:06 ` Jaegeuk Kim
  2022-10-27  1:50   ` [f2fs-dev] " Chao Yu
  1 sibling, 1 reply; 7+ messages in thread
From: Jaegeuk Kim @ 2022-10-26 17:06 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel

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")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
  Change log from v1:
   - add returning an error

 fs/f2fs/file.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 1c4004c9245f..8cd52b0965b1 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -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))
-- 
2.38.0.135.g90850a2211-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [f2fs-dev] [PATCH v2] f2fs: allow to set compression for inlined file
  2022-10-26 17:06 ` [PATCH v2] " Jaegeuk Kim
@ 2022-10-27  1:50   ` Chao Yu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2022-10-27  1:50 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2022/10/27 1:06, Jaegeuk Kim wrote:
> 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")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-27  1:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 23:36 [PATCH] f2fs: allow to set compression for inlined file Jaegeuk Kim
2022-10-25  6:57 ` [f2fs-dev] " Chao Yu
2022-10-25 17:46   ` Jaegeuk Kim
2022-10-26  1:17     ` Chao Yu
2022-10-26 17:04       ` Jaegeuk Kim
2022-10-26 17:06 ` [PATCH v2] " Jaegeuk Kim
2022-10-27  1:50   ` [f2fs-dev] " Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).