All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] blk-crypto: introduce blk_crypto_supported
@ 2022-04-18  6:33 ` Fengnan Chang via Linux-f2fs-devel
  0 siblings, 0 replies; 20+ messages in thread
From: Fengnan Chang @ 2022-04-18  6:33 UTC (permalink / raw)
  To: jaegeuk, chao, tytso, adilger.kernel, axboe
  Cc: linux-f2fs-devel, linux-ext4, linux-block, Fengnan Chang

Introduce blk_crypto_supported, Filesystems may use this to check wheather
storage device support inline encryption.

Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
---
 block/blk-crypto.c         | 6 +++++-
 include/linux/blk-crypto.h | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/block/blk-crypto.c b/block/blk-crypto.c
index a496aaef85ba..bef0833f9621 100644
--- a/block/blk-crypto.c
+++ b/block/blk-crypto.c
@@ -363,7 +363,11 @@ bool blk_crypto_config_supported(struct request_queue *q,
 	return IS_ENABLED(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) ||
 	       __blk_crypto_cfg_supported(q->crypto_profile, cfg);
 }
-
+bool blk_crypto_supported(struct request_queue *q)
+{
+	return IS_ENABLED(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) ||
+	       q->crypto_profile;
+}
 /**
  * blk_crypto_start_using_key() - Start using a blk_crypto_key on a device
  * @key: A key to use on the device
diff --git a/include/linux/blk-crypto.h b/include/linux/blk-crypto.h
index 69b24fe92cbf..6806cef24d0f 100644
--- a/include/linux/blk-crypto.h
+++ b/include/linux/blk-crypto.h
@@ -103,6 +103,7 @@ int blk_crypto_evict_key(struct request_queue *q,
 bool blk_crypto_config_supported(struct request_queue *q,
 				 const struct blk_crypto_config *cfg);
 
+bool blk_crypto_supported(struct request_queue *q);
 #else /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 static inline bool bio_has_crypt_ctx(struct bio *bio)
@@ -110,6 +111,10 @@ static inline bool bio_has_crypt_ctx(struct bio *bio)
 	return false;
 }
 
+static inline bool blk_crypto_supported(struct request_queue *q)
+{
+	return false;
+}
 #endif /* CONFIG_BLK_INLINE_ENCRYPTION */
 
 int __bio_crypt_clone(struct bio *dst, struct bio *src, gfp_t gfp_mask);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-04-19  3:22 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18  6:33 [PATCH 1/3] blk-crypto: introduce blk_crypto_supported Fengnan Chang
2022-04-18  6:33 ` [f2fs-dev] " Fengnan Chang via Linux-f2fs-devel
2022-04-18  6:33 ` [PATCH 2/3] f2fs: notify when device not supprt inlinecrypt Fengnan Chang
2022-04-18  6:33   ` [f2fs-dev] " Fengnan Chang via Linux-f2fs-devel
2022-04-18  7:22   ` Eric Biggers
2022-04-18  7:22     ` [f2fs-dev] " Eric Biggers
2022-04-18  7:34     ` 常凤楠
2022-04-18  7:34       ` [f2fs-dev] " 常凤楠 via Linux-f2fs-devel
2022-04-18 22:27       ` Eric Biggers
2022-04-18 22:27         ` [f2fs-dev] " Eric Biggers
2022-04-18 22:43         ` Theodore Ts'o
2022-04-18 22:43           ` [f2fs-dev] " Theodore Ts'o
2022-04-19  3:14         ` 常凤楠
2022-04-19  3:14           ` [f2fs-dev] " 常凤楠 via Linux-f2fs-devel
2022-04-19  3:18           ` Eric Biggers
2022-04-19  3:18             ` [f2fs-dev] " Eric Biggers
2022-04-19  3:22             ` 常凤楠
2022-04-19  3:22               ` [f2fs-dev] " 常凤楠 via Linux-f2fs-devel
2022-04-18  6:33 ` [PATCH 3/3] ext4: " Fengnan Chang
2022-04-18  6:33   ` [f2fs-dev] " Fengnan Chang via Linux-f2fs-devel

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.