Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Request based dm-crypt
dm-crypt provides bios based device mapper module. dm-crypt
operates on packets with 512 bytes size which is not effiicent
way for HW based crypto blocks. dm-req-crypt is developed to
address this. dm-req-crypt works on requests which carry upto
512KB of data for unmerged requests.

Change-Id: I479230b2f0c1ab2e2a1ddb84947ebaf0629dff8c
Signed-off-by: Dinesh K Garg <dineshg@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
  • Loading branch information
Dinesh K Garg authored and major91 committed Jul 23, 2014
1 parent a04c3b1 commit 621d482
Show file tree
Hide file tree
Showing 7 changed files with 790 additions and 4 deletions.
14 changes: 12 additions & 2 deletions block/blk-core.c
Expand Up @@ -1223,8 +1223,9 @@ void __blk_put_request(struct request_queue *q, struct request *req)

elv_completed_request(q, req);

/* this is a bio leak */
WARN_ON(req->bio != NULL);
/* this is a bio leak if the bio is not tagged with BIO_DONTFREE */
WARN_ON(req->bio && !bio_flagged(req->bio, BIO_DONTFREE));


/*
* Request may not have originated from ll_rw_blk. if not,
Expand Down Expand Up @@ -2275,6 +2276,15 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
blk_account_io_completion(req, nr_bytes);

total_bytes = bio_nbytes = 0;

/*
* Check for this if flagged, Req based dm needs to perform
* post processing, hence dont end bios or request.DM
* layer takes care.
*/
if (bio_flagged(req->bio, BIO_DONTFREE))
return false;

while ((bio = req->bio) != NULL) {
int nbytes;

Expand Down
17 changes: 17 additions & 0 deletions drivers/md/Kconfig
Expand Up @@ -241,6 +241,23 @@ config DM_CRYPT

If unsure, say N.

config DM_REQ_CRYPT
tristate "Crypt target support"
depends on BLK_DEV_DM
select XTS
select CRYPTO_XTS
---help---
This request based device-mapper target allows you to create a device that
transparently encrypts the data on it. You'll need to activate
the ciphers you're going to use in the cryptoapi configuration.
The DM REQ CRYPT operates on requests (bigger payloads) to utilize
crypto hardware better.

To compile this code as a module, choose M here: the module will
be called dm-req-crypt.

If unsure, say N.

config DM_SNAPSHOT
tristate "Snapshot target"
depends on BLK_DEV_DM
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/Makefile
Expand Up @@ -44,7 +44,7 @@ obj-$(CONFIG_DM_ZERO) += dm-zero.o
obj-$(CONFIG_DM_RAID) += dm-raid.o
obj-$(CONFIG_DM_THIN_PROVISIONING) += dm-thin-pool.o
obj-$(CONFIG_DM_VERITY) += dm-verity.o

obj-$(CONFIG_DM_REQ_CRYPT) += dm-req-crypt.o
ifeq ($(CONFIG_DM_UEVENT),y)
dm-mod-objs += dm-uevent.o
endif

0 comments on commit 621d482

Please sign in to comment.