summaryrefslogtreecommitdiffstats
path: root/fs/crypto/bio.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-01-27 23:25:14 +0100
committerEric Biggers <ebiggers@google.com>2023-01-29 00:10:12 +0100
commit51e4e3153ebc32d3280d5d17418ae6f1a44f1ec1 (patch)
tree55d0a9d3b02a0a403034e6130829e0901e6f93fa /fs/crypto/bio.c
parentfsverity: support verifying data from large folios (diff)
downloadlinux-51e4e3153ebc32d3280d5d17418ae6f1a44f1ec1.tar.xz
linux-51e4e3153ebc32d3280d5d17418ae6f1a44f1ec1.zip
fscrypt: support decrypting data from large folios
Try to make the filesystem-level decryption functions in fs/crypto/ aware of large folios. This includes making fscrypt_decrypt_bio() support the case where the bio contains large folios, and making fscrypt_decrypt_pagecache_blocks() take a folio instead of a page. There's no way to actually test this with large folios yet, but I've tested that this doesn't cause any regressions. Note that this patch just handles *decryption*, not encryption which will be a little more difficult. Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Link: https://lore.kernel.org/r/20230127224202.355629-1-ebiggers@kernel.org
Diffstat (limited to 'fs/crypto/bio.c')
-rw-r--r--fs/crypto/bio.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
index 1b4403136d05..d57d0a020f71 100644
--- a/fs/crypto/bio.c
+++ b/fs/crypto/bio.c
@@ -30,13 +30,11 @@
*/
bool fscrypt_decrypt_bio(struct bio *bio)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
+ struct folio_iter fi;
- bio_for_each_segment_all(bv, bio, iter_all) {
- struct page *page = bv->bv_page;
- int err = fscrypt_decrypt_pagecache_blocks(page, bv->bv_len,
- bv->bv_offset);
+ bio_for_each_folio_all(fi, bio) {
+ int err = fscrypt_decrypt_pagecache_blocks(fi.folio, fi.length,
+ fi.offset);
if (err) {
bio->bi_status = errno_to_blk_status(err);