[PATCH 1/7] block: Add block level changes for inline encryption
From: Ladvine D Almeida
Date: Mon May 28 2018 - 08:30:46 EST
This patch introduces new variable under bio structure to
facilitate inline encryption. This variable is used to
associate I/O requests to crypto information.
Signed-off-by: Ladvine D Almeida <ladvine@xxxxxxxxxxxx>
---
block/Kconfig | 13 +++++++++++++
block/bio.c | 6 ++++++
include/linux/blk_types.h | 3 +++
3 files changed, 22 insertions(+)
diff --git a/block/Kconfig b/block/Kconfig
index 28ec557..a48ecec 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -128,6 +128,19 @@ config BLK_DEV_THROTTLING_LOW
Note, this is an experimental interface and could be changed someday.
+config BLK_DEV_INLINE_ENCRYPTION
+ bool "Enable support for block device inline encryption"
+ default n
+ help
+ Enable block devices for Inline Encryption support.
+
+ This option is required to support the inline encryption capability
+ of the block device driver, including UFS Host Controller driver.
+ When the Inline Encryption feature is enabled in the block device
+ drivers, this option will be automatically enabled.
+
+ If unsure, say N.
+
config BLK_CMDLINE_PARSER
bool "Block device command line partition parser"
default n
diff --git a/block/bio.c b/block/bio.c
index 0a4df92..91aecf5 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -606,6 +606,9 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
bio->bi_write_hint = bio_src->bi_write_hint;
bio->bi_iter = bio_src->bi_iter;
bio->bi_io_vec = bio_src->bi_io_vec;
+#ifdef CONFIG_BLK_DEV_INLINE_ENCRYPTION
+ bio->bi_ie_private = bio_src->bi_ie_private;
+#endif
bio_clone_blkcg_association(bio, bio_src);
}
@@ -690,6 +693,9 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
bio->bi_write_hint = bio_src->bi_write_hint;
bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector;
bio->bi_iter.bi_size = bio_src->bi_iter.bi_size;
+#ifdef CONFIG_BLK_DEV_INLINE_ENCRYPTION
+ bio->bi_ie_private = bio_src->bi_ie_private;
+#endif
switch (bio_op(bio)) {
case REQ_OP_DISCARD:
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 4cb970c..11df096 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -183,6 +183,9 @@ struct bio {
void *bi_cg_private;
struct bio_issue bi_issue;
#endif
+#ifdef CONFIG_BLK_DEV_INLINE_ENCRYPTION
+ void *bi_ie_private;
+#endif
#endif
union {
#if defined(CONFIG_BLK_DEV_INTEGRITY)
--
2.7.4