All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files
@ 2026-10-09  9:53 Joanne Chang via Linux-f2fs-devel
  2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joanne Chang via Linux-f2fs-devel @ 2026-10-09  9:53 UTC (permalink / raw)
  To: Jaegeuk Kim, Chao Yu; +Cc: Joanne Chang, linux-f2fs-devel

Commit a64a3fec11e7 ("f2fs: force out-place update for all writes on
compressed file") updated f2fs_should_update_outplace() to always
return true for compressed files. However, this function is also
called during f2fs_ioc_set_pin_file() validation, so pinning an
empty file with compression enabled now fails with -EINVAL before the
compression flag can be stripped.

Fix this by guarding the f2fs_compressed_file(inode) check with fio in
f2fs_should_update_outplace(). This preserves forced OPU for actual
compressed writes (fio != NULL), while allowing f2fs_ioc_set_pin_file()
(fio == NULL) to proceed to f2fs_disable_compressed_file(inode).

Fixes: a64a3fec11e7 ("f2fs: force out-place update for all writes on compressed file")
Assisted-by: LLM
Signed-off-by: Joanne Chang <joannechien@google.com>
---
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 2613e8821af6..1d071e7cb1c2 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3150,7 +3150,7 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
 	 * If IO comes from compressed write path and fallback to raw write,
 	 * force out‑place to prevent metadata‑data inconsistency.
 	 */
-	if (f2fs_compressed_file(inode))
+	if (fio && f2fs_compressed_file(inode))
 		return true;
 
 	/* swap file is migrating in aligned write mode */
-- 
2.56.0.170.g584c36229d-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] 6+ messages in thread

* Re: [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files
  2026-10-09  9:53 [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files Joanne Chang via Linux-f2fs-devel
@ 2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
  2026-10-12  9:27   ` Joanne Chang via Linux-f2fs-devel
  2026-10-12  9:40 ` Chao Yu via Linux-f2fs-devel
  2026-10-13 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  2 siblings, 1 reply; 6+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-10-11  8:31 UTC (permalink / raw)
  To: Joanne Chang, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 10/9/26 17:53, Joanne Chang wrote:
> Commit a64a3fec11e7 ("f2fs: force out-place update for all writes on
> compressed file") updated f2fs_should_update_outplace() to always
> return true for compressed files. However, this function is also
> called during f2fs_ioc_set_pin_file() validation, so pinning an
> empty file with compression enabled now fails with -EINVAL before the
> compression flag can be stripped.

Joanne,

Thanks for the patch.

But, I think it's as expected, we force compressed file to OPU, and pinfile
to IPU, it's conflict.

Let me know if I missed something.

Thanks,

> 
> Fix this by guarding the f2fs_compressed_file(inode) check with fio in
> f2fs_should_update_outplace(). This preserves forced OPU for actual
> compressed writes (fio != NULL), while allowing f2fs_ioc_set_pin_file()
> (fio == NULL) to proceed to f2fs_disable_compressed_file(inode).
> 
> Fixes: a64a3fec11e7 ("f2fs: force out-place update for all writes on compressed file")
> Assisted-by: LLM
> Signed-off-by: Joanne Chang <joannechien@google.com>
> ---
>   fs/f2fs/data.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 2613e8821af6..1d071e7cb1c2 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3150,7 +3150,7 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
>   	 * If IO comes from compressed write path and fallback to raw write,
>   	 * force out‑place to prevent metadata‑data inconsistency.
>   	 */
> -	if (f2fs_compressed_file(inode))
> +	if (fio && f2fs_compressed_file(inode))
>   		return true;
>   
>   	/* swap file is migrating in aligned write mode */



_______________________________________________
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] 6+ messages in thread

* Re: [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files
  2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
@ 2026-10-12  9:27   ` Joanne Chang via Linux-f2fs-devel
  2026-10-12  9:38     ` Chao Yu via Linux-f2fs-devel
  0 siblings, 1 reply; 6+ messages in thread
From: Joanne Chang via Linux-f2fs-devel @ 2026-10-12  9:27 UTC (permalink / raw)
  To: Chao Yu; +Cc: Jaegeuk Kim, linux-f2fs-devel

On Sun, Oct 11, 2026 at 4:31 PM Chao Yu <chao@kernel.org> wrote:
>
> On 10/9/26 17:53, Joanne Chang wrote:
> > Commit a64a3fec11e7 ("f2fs: force out-place update for all writes on
> > compressed file") updated f2fs_should_update_outplace() to always
> > return true for compressed files. However, this function is also
> > called during f2fs_ioc_set_pin_file() validation, so pinning an
> > empty file with compression enabled now fails with -EINVAL before the
> > compression flag can be stripped.
>
> But, I think it's as expected, we force compressed file to OPU, and pinfile
> to IPU, it's conflict.

Thank you for reviewing the patch. I understand that compressed files
cannot be pinned because compressed files need OPU.

The case I want to check is pinning a compressed file with no blocks.
f2fs_ioc_set_pin_file() only allows pinning files with no blocks, and
also calls f2fs_disable_compressed_file() to clear the compression flag,
so there is no conflict with IPU for such a file. If I understand
correctly, this is allowed on zoned devices as the
f2fs_should_update_outplace() check is skipped there.

Best regards,
Joanne


_______________________________________________
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] 6+ messages in thread

* Re: [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files
  2026-10-12  9:27   ` Joanne Chang via Linux-f2fs-devel
@ 2026-10-12  9:38     ` Chao Yu via Linux-f2fs-devel
  0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-10-12  9:38 UTC (permalink / raw)
  To: Joanne Chang; +Cc: Jaegeuk Kim, linux-f2fs-devel

On 10/12/26 17:27, Joanne Chang wrote:
> On Sun, Oct 11, 2026 at 4:31 PM Chao Yu <chao@kernel.org> wrote:
>>
>> On 10/9/26 17:53, Joanne Chang wrote:
>>> Commit a64a3fec11e7 ("f2fs: force out-place update for all writes on
>>> compressed file") updated f2fs_should_update_outplace() to always
>>> return true for compressed files. However, this function is also
>>> called during f2fs_ioc_set_pin_file() validation, so pinning an
>>> empty file with compression enabled now fails with -EINVAL before the
>>> compression flag can be stripped.
>>
>> But, I think it's as expected, we force compressed file to OPU, and pinfile
>> to IPU, it's conflict.
> 
> Thank you for reviewing the patch. I understand that compressed files
> cannot be pinned because compressed files need OPU.
> 
> The case I want to check is pinning a compressed file with no blocks.
> f2fs_ioc_set_pin_file() only allows pinning files with no blocks, and
> also calls f2fs_disable_compressed_file() to clear the compression flag,

Ah, okay, I missed to check f2fs_disable_compressed_file() logic below
f2fs_should_update_outplace(), thanks for the explanation.

Thanks,

> so there is no conflict with IPU for such a file. If I understand
> correctly, this is allowed on zoned devices as the
> f2fs_should_update_outplace() check is skipped there.
> 
> Best regards,
> Joanne



_______________________________________________
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] 6+ messages in thread

* Re: [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files
  2026-10-09  9:53 [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files Joanne Chang via Linux-f2fs-devel
  2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
@ 2026-10-12  9:40 ` Chao Yu via Linux-f2fs-devel
  2026-10-13 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  2 siblings, 0 replies; 6+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-10-12  9:40 UTC (permalink / raw)
  To: Joanne Chang, Jaegeuk Kim; +Cc: linux-f2fs-devel

On 10/9/26 17:53, Joanne Chang wrote:
> Commit a64a3fec11e7 ("f2fs: force out-place update for all writes on
> compressed file") updated f2fs_should_update_outplace() to always
> return true for compressed files. However, this function is also
> called during f2fs_ioc_set_pin_file() validation, so pinning an
> empty file with compression enabled now fails with -EINVAL before the
> compression flag can be stripped.
> 
> Fix this by guarding the f2fs_compressed_file(inode) check with fio in
> f2fs_should_update_outplace(). This preserves forced OPU for actual
> compressed writes (fio != NULL), while allowing f2fs_ioc_set_pin_file()
> (fio == NULL) to proceed to f2fs_disable_compressed_file(inode).
> 

Cc: stable@kernel.org

> Fixes: a64a3fec11e7 ("f2fs: force out-place update for all writes on compressed file")
> Assisted-by: LLM
> Signed-off-by: Joanne Chang <joannechien@google.com>

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] 6+ messages in thread

* Re: [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files
  2026-10-09  9:53 [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files Joanne Chang via Linux-f2fs-devel
  2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
  2026-10-12  9:40 ` Chao Yu via Linux-f2fs-devel
@ 2026-10-13 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+f2fs--- via Linux-f2fs-devel @ 2026-10-13 22:30 UTC (permalink / raw)
  To: Joanne Chang; +Cc: jaegeuk, linux-f2fs-devel

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Fri,  9 Oct 2026 09:53:31 +0000 you wrote:
> Commit a64a3fec11e7 ("f2fs: force out-place update for all writes on
> compressed file") updated f2fs_should_update_outplace() to always
> return true for compressed files. However, this function is also
> called during f2fs_ioc_set_pin_file() validation, so pinning an
> empty file with compression enabled now fails with -EINVAL before the
> compression flag can be stripped.
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v1] f2fs: allow pinning empty compressed files
    https://git.kernel.org/jaegeuk/f2fs/c/2eebc31ae5f5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




_______________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2026-10-13 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  9:53 [f2fs-dev] [PATCH v1] f2fs: allow pinning empty compressed files Joanne Chang via Linux-f2fs-devel
2026-10-11  8:31 ` Chao Yu via Linux-f2fs-devel
2026-10-12  9:27   ` Joanne Chang via Linux-f2fs-devel
2026-10-12  9:38     ` Chao Yu via Linux-f2fs-devel
2026-10-12  9:40 ` Chao Yu via Linux-f2fs-devel
2026-10-13 22:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.