Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71776d0c authored by Eric Biggers's avatar Eric Biggers Committed by Gerrit - the friendly Code Review server
Browse files

ANDROID: dm table: propagate inline encryption flag to dm devices



If all targets in a device-mapper table support inline encryption, mark
the mapped device as supporting inline encryption.  This will allow
filesystems such as ext4 to tell whether the hardware supports inline
encryption even in the case where there is an intervening dm device.

Change-Id: I596829f6c5a39fb0d5bedfac9f18828ae27444cb
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarShivaprasad Hongal <shongal@codeaurora.org>
Signed-off-by: default avatarNeeraj Soni <neersoni@codeaurora.org>
parent 3440aa4e
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1495,6 +1495,16 @@ static int queue_supports_sg_merge(struct dm_target *ti, struct dm_dev *dev,
	return q && !test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
}

static int queue_supports_inline_encryption(struct dm_target *ti,
					    struct dm_dev *dev,
					    sector_t start, sector_t len,
					    void *data)
{
	struct request_queue *q = bdev_get_queue(dev->bdev);

	return q && blk_queue_inlinecrypt(q);
}

static bool dm_table_all_devices_attribute(struct dm_table *t,
					   iterate_devices_callout_fn func)
{
@@ -1615,6 +1625,11 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
	else
		queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);

	if (dm_table_all_devices_attribute(t, queue_supports_inline_encryption))
		queue_flag_set_unlocked(QUEUE_FLAG_INLINECRYPT, q);
	else
		queue_flag_clear_unlocked(QUEUE_FLAG_INLINECRYPT, q);

	dm_table_verify_integrity(t);

	/*