[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220418063312.63181-1-changfengnan@vivo.com>
Date: Mon, 18 Apr 2022 14:33:10 +0800
From: Fengnan Chang <changfengnan@...o.com>
To: jaegeuk@...nel.org, chao@...nel.org, tytso@....edu,
adilger.kernel@...ger.ca, axboe@...nel.dk
Cc: linux-f2fs-devel@...ts.sourceforge.net, linux-ext4@...r.kernel.org,
linux-block@...r.kernel.org, Fengnan Chang <changfengnan@...o.com>
Subject: [PATCH 1/3] blk-crypto: introduce blk_crypto_supported
Introduce blk_crypto_supported, Filesystems may use this to check wheather
storage device support inline encryption.
Signed-off-by: Fengnan Chang <changfengnan@...o.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
Powered by blists - more mailing lists