summaryrefslogtreecommitdiff
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-04-14 12:07:27 -0400
committerMike Snitzer <snitzer@kernel.org>2023-04-14 12:07:27 -0400
commit13f6facf3faeed34ca381aef4c9b153c7aed3972 (patch)
tree5b178e7ae69f1c9b7c10e91fa20c1acfaee0631a /drivers/md/dm.c
parent3664ff82dae1ef9f14f7763d3dd30565e7ef9e14 (diff)
dm: allow targets to require splitting WRITE_ZEROES and SECURE_ERASE
Introduce max_write_zeroes_granularity and max_secure_erase_granularity flags in the dm_target struct. If a target sets these then DM core will split IO of these operation types accordingly (in terms of max_write_zeroes_sectors and max_secure_erase_sectors respectively). Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 20c6b72a0245..244ebb8c316b 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1614,21 +1614,23 @@ static blk_status_t __process_abnormal_io(struct clone_info *ci,
{
unsigned int num_bios = 0;
unsigned int max_granularity = 0;
+ struct queue_limits *limits = dm_get_queue_limits(ti->table->md);
switch (bio_op(ci->bio)) {
case REQ_OP_DISCARD:
num_bios = ti->num_discard_bios;
- if (ti->max_discard_granularity) {
- struct queue_limits *limits =
- dm_get_queue_limits(ti->table->md);
+ if (ti->max_discard_granularity)
max_granularity = limits->max_discard_sectors;
- }
break;
case REQ_OP_SECURE_ERASE:
num_bios = ti->num_secure_erase_bios;
+ if (ti->max_secure_erase_granularity)
+ max_granularity = limits->max_secure_erase_sectors;
break;
case REQ_OP_WRITE_ZEROES:
num_bios = ti->num_write_zeroes_bios;
+ if (ti->max_write_zeroes_granularity)
+ max_granularity = limits->max_write_zeroes_sectors;
break;
default:
break;