summaryrefslogtreecommitdiff
path: root/fs/crypto/inline_crypt.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-03-02 06:18:10 -0800
committerEric Biggers <ebiggers@kernel.org>2026-03-09 13:31:50 -0700
commita18b1ab81654b06e7ff402e5d0b85249e9504bcb (patch)
tree6be2dc1391be0592e88f2de8c6273522d6c907db /fs/crypto/inline_crypt.c
parent588e7c048d7d2bfcbe7776ee0888ee248adf01d1 (diff)
fscrypt: move fscrypt_set_bio_crypt_ctx_bh to buffer.c
fscrypt_set_bio_crypt_ctx_bh is only used by submit_bh_wbc now. Move it there and merge bh_get_inode_and_lblk_num into it. Note that this does not add ifdefs for fscrypt as the compiler will optimize away the dead code if it is not built in. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20260302141922.370070-6-hch@lst.de Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'fs/crypto/inline_crypt.c')
-rw-r--r--fs/crypto/inline_crypt.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/fs/crypto/inline_crypt.c b/fs/crypto/inline_crypt.c
index 0da53956a9b1..702d13d138aa 100644
--- a/fs/crypto/inline_crypt.c
+++ b/fs/crypto/inline_crypt.c
@@ -314,51 +314,6 @@ void fscrypt_set_bio_crypt_ctx(struct bio *bio, const struct inode *inode,
}
EXPORT_SYMBOL_GPL(fscrypt_set_bio_crypt_ctx);
-/* Extract the inode and logical block number from a buffer_head. */
-static bool bh_get_inode_and_lblk_num(const struct buffer_head *bh,
- const struct inode **inode_ret,
- u64 *lblk_num_ret)
-{
- struct folio *folio = bh->b_folio;
- const struct address_space *mapping;
- const struct inode *inode;
-
- /*
- * The ext4 journal (jbd2) can submit a buffer_head it directly created
- * for a non-pagecache page. fscrypt doesn't care about these.
- */
- mapping = folio_mapping(folio);
- if (!mapping)
- return false;
- inode = mapping->host;
-
- *inode_ret = inode;
- *lblk_num_ret = (folio_pos(folio) + bh_offset(bh)) >> inode->i_blkbits;
- return true;
-}
-
-/**
- * fscrypt_set_bio_crypt_ctx_bh() - prepare a file contents bio for inline
- * crypto
- * @bio: a bio which will eventually be submitted to the file
- * @first_bh: the first buffer_head for which I/O will be submitted
- * @gfp_mask: memory allocation flags
- *
- * Same as fscrypt_set_bio_crypt_ctx(), except this takes a buffer_head instead
- * of an inode and block number directly.
- */
-void fscrypt_set_bio_crypt_ctx_bh(struct bio *bio,
- const struct buffer_head *first_bh,
- gfp_t gfp_mask)
-{
- const struct inode *inode;
- u64 first_lblk;
-
- if (bh_get_inode_and_lblk_num(first_bh, &inode, &first_lblk))
- fscrypt_set_bio_crypt_ctx(bio, inode, first_lblk, gfp_mask);
-}
-EXPORT_SYMBOL_GPL(fscrypt_set_bio_crypt_ctx_bh);
-
/**
* fscrypt_mergeable_bio() - test whether data can be added to a bio
* @bio: the bio being built up