Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based device capability checks"), fix NO_SG_MERGE capability check and invert logic of the corresponding iterate_devices_callout_fn so that all devices' NO_SG_MERGE capabilities are properly checked.
Signed-off-by: Jeffle Xu jefflexu@linux.alibaba.com Fixes: 200612ec33e5 ("dm table: propagate QUEUE_FLAG_NO_SG_MERGE") --- drivers/md/dm-table.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 6fe720e2c6ba..a40c51459ef5 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1723,12 +1723,12 @@ static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev, return q && !blk_queue_add_random(q); }
-static int queue_supports_sg_merge(struct dm_target *ti, struct dm_dev *dev, - sector_t start, sector_t len, void *data) +static int queue_no_sg_merge(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 && !test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags); + return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags); }
static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev, @@ -1868,10 +1868,10 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, if (!dm_table_supports_write_zeroes(t)) q->limits.max_write_zeroes_sectors = 0;
- if (dm_table_all_devices_attribute(t, queue_supports_sg_merge)) - queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q); - else + if (dm_table_any_dev_attr(t, queue_no_sg_merge)) queue_flag_set_unlocked(QUEUE_FLAG_NO_SG_MERGE, q); + else + queue_flag_clear_unlocked(QUEUE_FLAG_NO_SG_MERGE, q);
dm_table_verify_integrity(t);