* [f2fs-dev] [PATCH] fscrypt, f2fs: introduce fscrypt_finalize_bounce_folio() for cleanup
@ 2026-06-22 1:15 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-06-22 1:15 UTC (permalink / raw)
To: linux-fscrypt, linux-f2fs-devel
Cc: Eric Biggers, jaegeuk, linux-kernel, Matthew Wilcox
As part of the linux kernel's migration to folio-based APIs, introduce
fscrypt_finalize_bounce_folio() as the folio equivalent of
fscrypt_finalize_bounce_page(), and clean up f2fs codes with this new
helper.
Suggested-by: Matthew Wilcox <willy@infradead.org>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
---
Is it worth to introduce fscrypt_finalize_bounce_folio(), then try to
do clean in f2fs_write_end_bio() first, and then replace
fscrypt_finalize_bounce_page() later?
fs/f2fs/data.c | 7 +------
include/linux/fscrypt.h | 11 +++++++++++
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index ac1cf4de3d62..e0fca6c60e34 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -362,12 +362,7 @@ static void f2fs_write_end_bio(struct bio *bio)
struct folio *folio = fi.folio;
enum count_type type;
- if (fscrypt_is_bounce_folio(folio)) {
- struct folio *io_folio = folio;
-
- folio = fscrypt_pagecache_folio(io_folio);
- fscrypt_free_bounce_page(&io_folio->page);
- }
+ fscrypt_finalize_bounce_folio(&folio);
#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_is_compressed_page(folio)) {
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h
index 54712ec61ffb..20b59b021c94 100644
--- a/include/linux/fscrypt.h
+++ b/include/linux/fscrypt.h
@@ -1132,4 +1132,15 @@ static inline void fscrypt_finalize_bounce_page(struct page **pagep)
}
}
+/* If *foliop is a bounce folio, free it and set *foliop to the pagecache folio */
+static inline void fscrypt_finalize_bounce_folio(struct folio **foliop)
+{
+ struct folio *folio = *foliop;
+
+ if (fscrypt_is_bounce_folio(folio)) {
+ *foliop = fscrypt_pagecache_folio(folio);
+ fscrypt_free_bounce_page(&folio->page);
+ }
+}
+
#endif /* _LINUX_FSCRYPT_H */
--
2.49.0
_______________________________________________
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] 4+ messages in thread* [PATCH] fscrypt,f2fs: introduce fscrypt_finalize_bounce_folio() for cleanup
@ 2026-06-22 1:15 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2026-06-22 1:15 UTC (permalink / raw)
To: linux-fscrypt, linux-f2fs-devel
Cc: linux-kernel, jaegeuk, Chao Yu, Matthew Wilcox, Eric Biggers
As part of the linux kernel's migration to folio-based APIs, introduce
fscrypt_finalize_bounce_folio() as the folio equivalent of
fscrypt_finalize_bounce_page(), and clean up f2fs codes with this new
helper.
Suggested-by: Matthew Wilcox <willy@infradead.org>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
---
Is it worth to introduce fscrypt_finalize_bounce_folio(), then try to
do clean in f2fs_write_end_bio() first, and then replace
fscrypt_finalize_bounce_page() later?
fs/f2fs/data.c | 7 +------
include/linux/fscrypt.h | 11 +++++++++++
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index ac1cf4de3d62..e0fca6c60e34 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -362,12 +362,7 @@ static void f2fs_write_end_bio(struct bio *bio)
struct folio *folio = fi.folio;
enum count_type type;
- if (fscrypt_is_bounce_folio(folio)) {
- struct folio *io_folio = folio;
-
- folio = fscrypt_pagecache_folio(io_folio);
- fscrypt_free_bounce_page(&io_folio->page);
- }
+ fscrypt_finalize_bounce_folio(&folio);
#ifdef CONFIG_F2FS_FS_COMPRESSION
if (f2fs_is_compressed_page(folio)) {
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h
index 54712ec61ffb..20b59b021c94 100644
--- a/include/linux/fscrypt.h
+++ b/include/linux/fscrypt.h
@@ -1132,4 +1132,15 @@ static inline void fscrypt_finalize_bounce_page(struct page **pagep)
}
}
+/* If *foliop is a bounce folio, free it and set *foliop to the pagecache folio */
+static inline void fscrypt_finalize_bounce_folio(struct folio **foliop)
+{
+ struct folio *folio = *foliop;
+
+ if (fscrypt_is_bounce_folio(folio)) {
+ *foliop = fscrypt_pagecache_folio(folio);
+ fscrypt_free_bounce_page(&folio->page);
+ }
+}
+
#endif /* _LINUX_FSCRYPT_H */
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [f2fs-dev] [PATCH] fscrypt, f2fs: introduce fscrypt_finalize_bounce_folio() for cleanup
2026-06-22 1:15 ` [PATCH] fscrypt,f2fs: " Chao Yu
@ 2026-06-23 23:29 ` Eric Biggers
-1 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers via Linux-f2fs-devel @ 2026-06-23 23:29 UTC (permalink / raw)
To: Chao Yu
Cc: jaegeuk, linux-fscrypt, linux-kernel, Matthew Wilcox,
linux-f2fs-devel
On Mon, Jun 22, 2026 at 01:15:39AM +0000, Chao Yu wrote:
> As part of the linux kernel's migration to folio-based APIs, introduce
> fscrypt_finalize_bounce_folio() as the folio equivalent of
> fscrypt_finalize_bounce_page(), and clean up f2fs codes with this new
> helper.
>
> Suggested-by: Matthew Wilcox <willy@infradead.org>
> Cc: Eric Biggers <ebiggers@kernel.org>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>
> Is it worth to introduce fscrypt_finalize_bounce_folio(), then try to
> do clean in f2fs_write_end_bio() first, and then replace
> fscrypt_finalize_bounce_page() later?
I'm working on making ext4 and f2fs always do file contents
en/decryption using fscrypt_set_bio_crypt_ctx(), which already supports
large folios and doesn't require the filesystem to manage bounce
buffers. I don't think these minor tweaks to the other implementation
(which don't actually make it support large folios) accomplish anything
useful, and we should focus on removing it instead.
- Eric
_______________________________________________
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] 4+ messages in thread
* Re: [PATCH] fscrypt,f2fs: introduce fscrypt_finalize_bounce_folio() for cleanup
@ 2026-06-23 23:29 ` Eric Biggers
0 siblings, 0 replies; 4+ messages in thread
From: Eric Biggers @ 2026-06-23 23:29 UTC (permalink / raw)
To: Chao Yu
Cc: linux-fscrypt, linux-f2fs-devel, linux-kernel, jaegeuk,
Matthew Wilcox
On Mon, Jun 22, 2026 at 01:15:39AM +0000, Chao Yu wrote:
> As part of the linux kernel's migration to folio-based APIs, introduce
> fscrypt_finalize_bounce_folio() as the folio equivalent of
> fscrypt_finalize_bounce_page(), and clean up f2fs codes with this new
> helper.
>
> Suggested-by: Matthew Wilcox <willy@infradead.org>
> Cc: Eric Biggers <ebiggers@kernel.org>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>
> Is it worth to introduce fscrypt_finalize_bounce_folio(), then try to
> do clean in f2fs_write_end_bio() first, and then replace
> fscrypt_finalize_bounce_page() later?
I'm working on making ext4 and f2fs always do file contents
en/decryption using fscrypt_set_bio_crypt_ctx(), which already supports
large folios and doesn't require the filesystem to manage bounce
buffers. I don't think these minor tweaks to the other implementation
(which don't actually make it support large folios) accomplish anything
useful, and we should focus on removing it instead.
- Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-23 23:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 1:15 [f2fs-dev] [PATCH] fscrypt, f2fs: introduce fscrypt_finalize_bounce_folio() for cleanup Chao Yu via Linux-f2fs-devel
2026-06-22 1:15 ` [PATCH] fscrypt,f2fs: " Chao Yu
2026-06-23 23:29 ` [f2fs-dev] [PATCH] fscrypt, f2fs: " Eric Biggers via Linux-f2fs-devel
2026-06-23 23:29 ` [PATCH] fscrypt,f2fs: " Eric Biggers
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.