fscrypt,f2fs: introduce fscrypt_finalize_bounce_folio() for cleanup
Chao Yu
maintainerPATCH 1/1 fscrypt,f2fs: introduce fscrypt_finalize_bounce_folio() for cleanup
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.
---
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(-)
fs/f2fs/data.c +1 -6
@@ -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)) {
include/linux/fscrypt.h +11 -0
@@ -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 */
Signature · 1 line
2.49.0
Eric Biggers
maintainerQuoted 5 lines · Chao Yu
As part of the linux kernel's migration to folio-based APIs, introduce
fscrypt_finalize_bounce_folio()as the folio equivalent offscrypt_finalize_bounce_page(), and clean up f2fs codes with this new helper.
Quoted 8 lines
Suggested-by Matthew Wilcox <[email protected]>Cc Eric Biggers <[email protected]>Signed-off-by Chao Yu <[email protected]>---
Is it worth to introduce
fscrypt_finalize_bounce_folio(), then try to do clean inf2fs_write_end_bio()first, and then replacefscrypt_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
Chao Yu
maintainerQuoted 15 lines · Eric Biggers
Quoted 5 lines · Chao Yu
As part of the linux kernel's migration to folio-based APIs, introduce
fscrypt_finalize_bounce_folio()as the folio equivalent offscrypt_finalize_bounce_page(), and clean up f2fs codes with this new helper.Quoted 8 lines
Suggested-by Matthew Wilcox <[email protected]>Cc Eric Biggers <[email protected]>Signed-off-by Chao Yu <[email protected]>---
Is it worth to introduce
fscrypt_finalize_bounce_folio(), then try to do clean inf2fs_write_end_bio()first, and then replacefscrypt_finalize_bounce_page()later?
Quoted 6 lines
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.
Good, I see your patchset removing those codes, let's ignore current patch.
Thanks,
Quoted 2 lines
- Eric