summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorDenis Semakin <d.semakin@omprussia.ru>2018-03-13 13:23:45 +0400
committerMike Snitzer <snitzer@redhat.com>2018-04-03 15:04:21 -0400
commit00716545c894fc464e00612809d9cb836b180c99 (patch)
tree7492fc26be641c58a49b4c81ab707f60a597f629 /drivers/md/dm.c
parent0519c71e8d461ac3ef9a555bb7339243c9128d37 (diff)
downloadlinux-00716545c894fc464e00612809d9cb836b180c99.tar.bz2
dm: add support for secure erase forwarding
Set QUEUE_FLAG_SECERASE in DM device's queue_flags if a DM table's data devices support secure erase. Also, add support for secure erase to both the linear and striped targets. Signed-off-by: Denis Semakin <d.semakin@omprussia.ru> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 038c7572fdd4..3b3cbd1a1659 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1414,6 +1414,11 @@ static unsigned get_num_discard_bios(struct dm_target *ti)
return ti->num_discard_bios;
}
+static unsigned get_num_secure_erase_bios(struct dm_target *ti)
+{
+ return ti->num_secure_erase_bios;
+}
+
static unsigned get_num_write_same_bios(struct dm_target *ti)
{
return ti->num_write_same_bios;
@@ -1467,6 +1472,11 @@ static int __send_discard(struct clone_info *ci, struct dm_target *ti)
is_split_required_for_discard);
}
+static int __send_secure_erase(struct clone_info *ci, struct dm_target *ti)
+{
+ return __send_changing_extent_only(ci, ti, get_num_secure_erase_bios, NULL);
+}
+
static int __send_write_same(struct clone_info *ci, struct dm_target *ti)
{
return __send_changing_extent_only(ci, ti, get_num_write_same_bios, NULL);
@@ -1484,6 +1494,8 @@ static bool __process_abnormal_io(struct clone_info *ci, struct dm_target *ti,
if (bio_op(bio) == REQ_OP_DISCARD)
*result = __send_discard(ci, ti);
+ else if (bio_op(bio) == REQ_OP_SECURE_ERASE)
+ *result = __send_secure_erase(ci, ti);
else if (bio_op(bio) == REQ_OP_WRITE_SAME)
*result = __send_write_same(ci, ti);
else if (bio_op(bio) == REQ_OP_WRITE_ZEROES)