All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 4/6] f2fs: avoid unnecessary fscrypt_finalize_bounce_page()
Date: Tue, 16 Jun 2026 11:12:10 +0800	[thread overview]
Message-ID: <59e4eeb8-ff3e-434b-844c-08038e1883a5@kernel.org> (raw)
In-Reply-To: <ajB5K8SPT3Jq9480@google.com>

On 6/16/26 06:14, Jaegeuk Kim wrote:
> On 06/15, Chao Yu via Linux-f2fs-devel wrote:
>> fscrypt_finalize_bounce_page() should be called only if we use fs layer
>> crypto, let's avoid unnecessary fscrypt_finalize_bounce_page() in error
>> path of f2fs_write_compressed_pages().
>>
>> BTW, fscrypt_finalize_bounce_page() will check mapping of bounced page
>> before retrieving original page, so, previously it won't cause any issue
>> w/ fscrypt_finalize_bounce_page(), but still we'd better avoid coupling
>> w/ any logic inside fscrypt_finalize_bounce_page().
>>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>>  fs/f2fs/compress.c | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>> index caf522d667d6..aaa0813eabcd 100644
>> --- a/fs/f2fs/compress.c
>> +++ b/fs/f2fs/compress.c
>> @@ -1455,10 +1455,12 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
>>  out_destroy_crypt:
>>  	page_array_free(sbi, cic->rpages, cc->cluster_size);
>>  
>> -	for (--i; i >= 0; i--) {
>> -		if (!cc->cpages[i])
>> -			continue;
>> -		fscrypt_finalize_bounce_page(&cc->cpages[i]);
>> +	if (fio.encrypted) {
>> +		for (--i; i >= 0; i--) {
>> +			if (!cc->cpages[i])
>> +				continue;
>> +			fscrypt_finalize_bounce_page(&cc->cpages[i]);
>> +		}
> 
> Applied as:
> 
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1455,6 +1455,9 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
>  out_destroy_crypt:
>         page_array_free(sbi, cic->rpages, cc->cluster_size);
> 
> +       if (!fio.encrypted)
> +               goto out_put_cic;

Looks fine to me.

Thanks,

> +
>         for (--i; i >= 0; i--) {
>                 if (!cc->cpages[i])
>                         continue;
> 
> 
>>  	}
>>  out_put_cic:
>>  	kmem_cache_free(cic_entry_slab, cic);
>> -- 
>> 2.49.0
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 4/6] f2fs: avoid unnecessary fscrypt_finalize_bounce_page()
Date: Tue, 16 Jun 2026 11:12:10 +0800	[thread overview]
Message-ID: <59e4eeb8-ff3e-434b-844c-08038e1883a5@kernel.org> (raw)
In-Reply-To: <ajB5K8SPT3Jq9480@google.com>

On 6/16/26 06:14, Jaegeuk Kim wrote:
> On 06/15, Chao Yu via Linux-f2fs-devel wrote:
>> fscrypt_finalize_bounce_page() should be called only if we use fs layer
>> crypto, let's avoid unnecessary fscrypt_finalize_bounce_page() in error
>> path of f2fs_write_compressed_pages().
>>
>> BTW, fscrypt_finalize_bounce_page() will check mapping of bounced page
>> before retrieving original page, so, previously it won't cause any issue
>> w/ fscrypt_finalize_bounce_page(), but still we'd better avoid coupling
>> w/ any logic inside fscrypt_finalize_bounce_page().
>>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>>  fs/f2fs/compress.c | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>> index caf522d667d6..aaa0813eabcd 100644
>> --- a/fs/f2fs/compress.c
>> +++ b/fs/f2fs/compress.c
>> @@ -1455,10 +1455,12 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
>>  out_destroy_crypt:
>>  	page_array_free(sbi, cic->rpages, cc->cluster_size);
>>  
>> -	for (--i; i >= 0; i--) {
>> -		if (!cc->cpages[i])
>> -			continue;
>> -		fscrypt_finalize_bounce_page(&cc->cpages[i]);
>> +	if (fio.encrypted) {
>> +		for (--i; i >= 0; i--) {
>> +			if (!cc->cpages[i])
>> +				continue;
>> +			fscrypt_finalize_bounce_page(&cc->cpages[i]);
>> +		}
> 
> Applied as:
> 
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -1455,6 +1455,9 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
>  out_destroy_crypt:
>         page_array_free(sbi, cic->rpages, cc->cluster_size);
> 
> +       if (!fio.encrypted)
> +               goto out_put_cic;

Looks fine to me.

Thanks,

> +
>         for (--i; i >= 0; i--) {
>                 if (!cc->cpages[i])
>                         continue;
> 
> 
>>  	}
>>  out_put_cic:
>>  	kmem_cache_free(cic_entry_slab, cic);
>> -- 
>> 2.49.0
>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel



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

  reply	other threads:[~2026-06-16  3:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 13:08 [PATCH 1/6] f2fs: fix wrong description in printed log Chao Yu
2026-06-15 13:08 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2026-06-15 13:08 ` [PATCH 2/6] f2fs: misc cleanup in f2fs_record_stop_reason() Chao Yu
2026-06-15 13:08   ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2026-06-15 13:08 ` [PATCH 3/6] f2fs: avoid unnecessary sanity check on ckpt_valid_blocks Chao Yu
2026-06-15 13:08   ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2026-06-15 13:08 ` [PATCH 4/6] f2fs: avoid unnecessary fscrypt_finalize_bounce_page() Chao Yu
2026-06-15 13:08   ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2026-06-15 22:14   ` Jaegeuk Kim via Linux-f2fs-devel
2026-06-15 22:14     ` Jaegeuk Kim
2026-06-16  3:12     ` Chao Yu [this message]
2026-06-16  3:12       ` Chao Yu via Linux-f2fs-devel
2026-06-15 13:08 ` [PATCH 5/6] f2fs: use fscrypt_finalize_bounce_page() for cleanup Chao Yu
2026-06-15 13:08   ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2026-06-15 13:11   ` Matthew Wilcox
2026-06-15 13:11     ` Matthew Wilcox
2026-06-15 13:08 ` [PATCH 6/6] f2fs: remove unneeded f2fs_is_compressed_page() Chao Yu
2026-06-15 13:08   ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2026-06-16  2:50 ` [f2fs-dev] [PATCH 1/6] f2fs: fix wrong description in printed log patchwork-bot+f2fs--- via Linux-f2fs-devel
2026-06-16  2:50   ` patchwork-bot+f2fs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59e4eeb8-ff3e-434b-844c-08038e1883a5@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.