diff mbox series

[5.4.y,2/4] dm table: fix partial completion iterate_devices based device capability checks

Message ID 20210305065722.73504-3-jefflexu@linux.alibaba.com
State New
Headers show
Series None | expand

Commit Message

Jingbo Xu March 5, 2021, 6:57 a.m. UTC
Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based
device capability checks"), fix partial completion capability check and
invert logic of the corresponding iterate_devices_callout_fn so that all
devices' partial completion capabilities are properly checked.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Fixes: 22c11858e800 ("dm: introduce DM_TYPE_NVME_BIO_BASED")
---
 drivers/md/dm-table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index bf704d238662..c470e174e686 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1748,18 +1748,18 @@  static int device_is_not_random(struct dm_target *ti, struct dm_dev *dev,
 	return q && !blk_queue_add_random(q);
 }
 
-static int device_no_partial_completion(struct dm_target *ti, struct dm_dev *dev,
+static int device_is_partial_completion(struct dm_target *ti, struct dm_dev *dev,
 					sector_t start, sector_t len, void *data)
 {
 	char b[BDEVNAME_SIZE];
 
 	/* For now, NVMe devices are the only devices of this class */
-	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) == 0);
+	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) != 0);
 }
 
 static bool dm_table_does_not_support_partial_completion(struct dm_table *t)
 {
-	return dm_table_all_devices_attribute(t, device_no_partial_completion);
+	return !dm_table_any_dev_attr(t, device_is_partial_completion);
 }
 
 static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,