[PATCH 2/4] dm: Process .io_hints for drivers not having underlying devices

From: Kirill Tkhai
Date: Mon Mar 28 2022 - 07:18:51 EST


This makes dm_calculate_queue_limits() sets the hints also for drivers,
which do not have underlying devices.
This is useful for dm-qcow2 driver, that wants to have incomming requests
are likely splitted by QCOW2 cluster size alignment.

Signed-off-by: Kirill Tkhai <kirill.tkhai@xxxxxxxxxx>
---
drivers/md/dm-table.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index e43096cfe9e2..aa2e85bef6e7 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1660,8 +1660,11 @@ int dm_calculate_queue_limits(struct dm_table *table,

ti = dm_table_get_target(table, i);

- if (!ti->type->iterate_devices)
+ if (!ti->type->iterate_devices) {
+ if (ti->type->io_hints)
+ ti->type->io_hints(ti, &ti_limits);
goto combine_limits;
+ }

/*
* Combine queue limits of all the devices this target uses.