[PATCH v1 1/3] block: export blk-crypto symbols required by dm-inlinecrypt

Linlin Zhang posted 3 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v1 1/3] block: export blk-crypto symbols required by dm-inlinecrypt
Posted by Linlin Zhang 1 month, 1 week ago
From: Eric Biggers <ebiggers@google.com>

bio_crypt_set_ctx(), blk_crypto_init_key(), and
blk_crypto_start_using_key() are needed to use inline encryption; see
Documentation/block/inline-encryption.rst.  Export them so that
dm-inlinecrypt can use them.  The only reason these weren't exported
before was that inline encryption was previously used only by fs/crypto/
which is built-in code.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 block/blk-crypto.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-crypto.c b/block/blk-crypto.c
index 856d3c5b1fa0..40a99a859748 100644
--- a/block/blk-crypto.c
+++ b/block/blk-crypto.c
@@ -116,6 +116,7 @@ void bio_crypt_set_ctx(struct bio *bio, const struct blk_crypto_key *key,
 
 	bio->bi_crypt_context = bc;
 }
+EXPORT_SYMBOL_GPL(bio_crypt_set_ctx);
 
 void __bio_crypt_free_ctx(struct bio *bio)
 {
@@ -349,6 +350,7 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key,
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(blk_crypto_init_key);
 
 bool blk_crypto_config_supported_natively(struct block_device *bdev,
 					  const struct blk_crypto_config *cfg)
@@ -399,6 +401,7 @@ int blk_crypto_start_using_key(struct block_device *bdev,
 	}
 	return blk_crypto_fallback_start_using_mode(key->crypto_cfg.crypto_mode);
 }
+EXPORT_SYMBOL_GPL(blk_crypto_start_using_key);
 
 /**
  * blk_crypto_evict_key() - Evict a blk_crypto_key from a block_device
-- 
2.34.1
Re: [PATCH v1 1/3] block: export blk-crypto symbols required by dm-inlinecrypt
Posted by Jens Axboe 1 month ago
On 3/4/26 5:17 AM, Linlin Zhang wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> bio_crypt_set_ctx(), blk_crypto_init_key(), and
> blk_crypto_start_using_key() are needed to use inline encryption; see
> Documentation/block/inline-encryption.rst.  Export them so that
> dm-inlinecrypt can use them.  The only reason these weren't exported
> before was that inline encryption was previously used only by fs/crypto/
> which is built-in code.

Reviewed-by: Jens Axboe <axboe@kernel.dk>

-- 
Jens Axboe
Re: [PATCH v1 1/3] block: export blk-crypto symbols required by dm-inlinecrypt
Posted by Mikulas Patocka 1 month ago

On Mon, 9 Mar 2026, Jens Axboe wrote:

> On 3/4/26 5:17 AM, Linlin Zhang wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > bio_crypt_set_ctx(), blk_crypto_init_key(), and
> > blk_crypto_start_using_key() are needed to use inline encryption; see
> > Documentation/block/inline-encryption.rst.  Export them so that
> > dm-inlinecrypt can use them.  The only reason these weren't exported
> > before was that inline encryption was previously used only by fs/crypto/
> > which is built-in code.
> 
> Reviewed-by: Jens Axboe <axboe@kernel.dk>
> 
> -- 
> Jens Axboe

Thanks.

Mikulas
Re: [PATCH v1 1/3] block: export blk-crypto symbols required by dm-inlinecrypt
Posted by Mikulas Patocka 1 month ago
Hi Jens

Would you please ack this block layer patch, so that I can add it to the 
device mapper tree?

Mikulas


On Wed, 4 Mar 2026, Linlin Zhang wrote:

> From: Eric Biggers <ebiggers@google.com>
> 
> bio_crypt_set_ctx(), blk_crypto_init_key(), and
> blk_crypto_start_using_key() are needed to use inline encryption; see
> Documentation/block/inline-encryption.rst.  Export them so that
> dm-inlinecrypt can use them.  The only reason these weren't exported
> before was that inline encryption was previously used only by fs/crypto/
> which is built-in code.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  block/blk-crypto.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/block/blk-crypto.c b/block/blk-crypto.c
> index 856d3c5b1fa0..40a99a859748 100644
> --- a/block/blk-crypto.c
> +++ b/block/blk-crypto.c
> @@ -116,6 +116,7 @@ void bio_crypt_set_ctx(struct bio *bio, const struct blk_crypto_key *key,
>  
>  	bio->bi_crypt_context = bc;
>  }
> +EXPORT_SYMBOL_GPL(bio_crypt_set_ctx);
>  
>  void __bio_crypt_free_ctx(struct bio *bio)
>  {
> @@ -349,6 +350,7 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key,
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL_GPL(blk_crypto_init_key);
>  
>  bool blk_crypto_config_supported_natively(struct block_device *bdev,
>  					  const struct blk_crypto_config *cfg)
> @@ -399,6 +401,7 @@ int blk_crypto_start_using_key(struct block_device *bdev,
>  	}
>  	return blk_crypto_fallback_start_using_mode(key->crypto_cfg.crypto_mode);
>  }
> +EXPORT_SYMBOL_GPL(blk_crypto_start_using_key);
>  
>  /**
>   * blk_crypto_evict_key() - Evict a blk_crypto_key from a block_device
> -- 
> 2.34.1
>