aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-table.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 3c72bf10e9dc..f9c6cb8dbcf8 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1386,6 +1386,14 @@ static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,
1386 return q && !blk_queue_add_random(q); 1386 return q && !blk_queue_add_random(q);
1387} 1387}
1388 1388
1389static int queue_supports_sg_merge(struct dm_target *ti, struct dm_dev *dev,
1390 sector_t start, sector_t len, void *data)
1391{
1392 struct request_queue *q = bdev_get_queue(dev->bdev);
1393
1394 return q && !test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
1395}
1396
1389static bool dm_table_all_devices_attribute(struct dm_table *t, 1397static bool dm_table_all_devices_attribute(struct dm_table *t,
1390 iterate_devices_callout_fn func) 1398 iterate_devices_callout_fn func)
1391{ 1399{
@@ -1501,6 +1509,11 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1501 if (!dm_table_supports_write_same(t)) 1509 if (!dm_table_supports_write_same(t))
1502 q->limits.max_write_same_sectors = 0; 1510 q->limits.max_write_same_sectors = 0;
1503 1511
1512 if (dm_table_all_devices_attribute(t, queue_supports_sg_merge))
1513 queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
1514 else
1515 queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
1516
1504 dm_table_set_integrity(t); 1517 dm_table_set_integrity(t);
1505 1518
1506 /* 1519 /*