aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index cde3b49b2a91..350cf0451456 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -880,13 +880,17 @@ void dm_table_set_type(struct dm_table *t, enum dm_queue_mode type)
880} 880}
881EXPORT_SYMBOL_GPL(dm_table_set_type); 881EXPORT_SYMBOL_GPL(dm_table_set_type);
882 882
883/* validate the dax capability of the target device span */
883static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, 884static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
884 sector_t start, sector_t len, void *data) 885 sector_t start, sector_t len, void *data)
885{ 886{
886 return bdev_dax_supported(dev->bdev, PAGE_SIZE); 887 int blocksize = *(int *) data;
888
889 return generic_fsdax_supported(dev->dax_dev, dev->bdev, blocksize,
890 start, len);
887} 891}
888 892
889static bool dm_table_supports_dax(struct dm_table *t) 893bool dm_table_supports_dax(struct dm_table *t, int blocksize)
890{ 894{
891 struct dm_target *ti; 895 struct dm_target *ti;
892 unsigned i; 896 unsigned i;
@@ -899,7 +903,8 @@ static bool dm_table_supports_dax(struct dm_table *t)
899 return false; 903 return false;
900 904
901 if (!ti->type->iterate_devices || 905 if (!ti->type->iterate_devices ||
902 !ti->type->iterate_devices(ti, device_supports_dax, NULL)) 906 !ti->type->iterate_devices(ti, device_supports_dax,
907 &blocksize))
903 return false; 908 return false;
904 } 909 }
905 910
@@ -979,7 +984,7 @@ static int dm_table_determine_type(struct dm_table *t)
979verify_bio_based: 984verify_bio_based:
980 /* We must use this table as bio-based */ 985 /* We must use this table as bio-based */
981 t->type = DM_TYPE_BIO_BASED; 986 t->type = DM_TYPE_BIO_BASED;
982 if (dm_table_supports_dax(t) || 987 if (dm_table_supports_dax(t, PAGE_SIZE) ||
983 (list_empty(devices) && live_md_type == DM_TYPE_DAX_BIO_BASED)) { 988 (list_empty(devices) && live_md_type == DM_TYPE_DAX_BIO_BASED)) {
984 t->type = DM_TYPE_DAX_BIO_BASED; 989 t->type = DM_TYPE_DAX_BIO_BASED;
985 } else { 990 } else {
@@ -1905,7 +1910,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1905 } 1910 }
1906 blk_queue_write_cache(q, wc, fua); 1911 blk_queue_write_cache(q, wc, fua);
1907 1912
1908 if (dm_table_supports_dax(t)) 1913 if (dm_table_supports_dax(t, PAGE_SIZE))
1909 blk_queue_flag_set(QUEUE_FLAG_DAX, q); 1914 blk_queue_flag_set(QUEUE_FLAG_DAX, q);
1910 else 1915 else
1911 blk_queue_flag_clear(QUEUE_FLAG_DAX, q); 1916 blk_queue_flag_clear(QUEUE_FLAG_DAX, q);