Re: [f2fs-dev] [PATCH 4/6] f2fs: avoid unnecessary fscrypt_finalize_bounce_page()
Chao Yu via Linux-f2fs-devel <[email protected]>
| Newsgroups | net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> >> --- >> 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 >> [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