diff options
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index e8361b191b9b..429b50b975d5 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -52,8 +52,6 @@ struct dm_table { | |||
52 | sector_t *highs; | 52 | sector_t *highs; |
53 | struct dm_target *targets; | 53 | struct dm_target *targets; |
54 | 54 | ||
55 | unsigned barriers_supported:1; | ||
56 | |||
57 | /* | 55 | /* |
58 | * Indicates the rw permissions for the new logical | 56 | * Indicates the rw permissions for the new logical |
59 | * device. This should be a combination of FMODE_READ | 57 | * device. This should be a combination of FMODE_READ |
@@ -243,7 +241,6 @@ int dm_table_create(struct dm_table **result, fmode_t mode, | |||
243 | 241 | ||
244 | INIT_LIST_HEAD(&t->devices); | 242 | INIT_LIST_HEAD(&t->devices); |
245 | atomic_set(&t->holders, 0); | 243 | atomic_set(&t->holders, 0); |
246 | t->barriers_supported = 1; | ||
247 | 244 | ||
248 | if (!num_targets) | 245 | if (!num_targets) |
249 | num_targets = KEYS_PER_NODE; | 246 | num_targets = KEYS_PER_NODE; |
@@ -751,10 +748,6 @@ int dm_table_add_target(struct dm_table *t, const char *type, | |||
751 | /* FIXME: the plan is to combine high here and then have | 748 | /* FIXME: the plan is to combine high here and then have |
752 | * the merge fn apply the target level restrictions. */ | 749 | * the merge fn apply the target level restrictions. */ |
753 | combine_restrictions_low(&t->limits, &tgt->limits); | 750 | combine_restrictions_low(&t->limits, &tgt->limits); |
754 | |||
755 | if (!(tgt->type->features & DM_TARGET_SUPPORTS_BARRIERS)) | ||
756 | t->barriers_supported = 0; | ||
757 | |||
758 | return 0; | 751 | return 0; |
759 | 752 | ||
760 | bad: | 753 | bad: |
@@ -799,12 +792,6 @@ int dm_table_complete(struct dm_table *t) | |||
799 | 792 | ||
800 | check_for_valid_limits(&t->limits); | 793 | check_for_valid_limits(&t->limits); |
801 | 794 | ||
802 | /* | ||
803 | * We only support barriers if there is exactly one underlying device. | ||
804 | */ | ||
805 | if (!list_is_singular(&t->devices)) | ||
806 | t->barriers_supported = 0; | ||
807 | |||
808 | /* how many indexes will the btree have ? */ | 795 | /* how many indexes will the btree have ? */ |
809 | leaf_nodes = dm_div_up(t->num_targets, KEYS_PER_NODE); | 796 | leaf_nodes = dm_div_up(t->num_targets, KEYS_PER_NODE); |
810 | t->depth = 1 + int_log(leaf_nodes, CHILDREN_PER_NODE); | 797 | t->depth = 1 + int_log(leaf_nodes, CHILDREN_PER_NODE); |
@@ -879,6 +866,45 @@ struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector) | |||
879 | return &t->targets[(KEYS_PER_NODE * n) + k]; | 866 | return &t->targets[(KEYS_PER_NODE * n) + k]; |
880 | } | 867 | } |
881 | 868 | ||
869 | /* | ||
870 | * Set the integrity profile for this device if all devices used have | ||
871 | * matching profiles. | ||
872 | */ | ||
873 | static void dm_table_set_integrity(struct dm_table *t) | ||
874 | { | ||
875 | struct list_head *devices = dm_table_get_devices(t); | ||
876 | struct dm_dev_internal *prev = NULL, *dd = NULL; | ||
877 | |||
878 | if (!blk_get_integrity(dm_disk(t->md))) | ||
879 | return; | ||
880 | |||
881 | list_for_each_entry(dd, devices, list) { | ||
882 | if (prev && | ||
883 | blk_integrity_compare(prev->dm_dev.bdev->bd_disk, | ||
884 | dd->dm_dev.bdev->bd_disk) < 0) { | ||
885 | DMWARN("%s: integrity not set: %s and %s mismatch", | ||
886 | dm_device_name(t->md), | ||
887 | prev->dm_dev.bdev->bd_disk->disk_name, | ||
888 | dd->dm_dev.bdev->bd_disk->disk_name); | ||
889 | goto no_integrity; | ||
890 | } | ||
891 | prev = dd; | ||
892 | } | ||
893 | |||
894 | if (!prev || !bdev_get_integrity(prev->dm_dev.bdev)) | ||
895 | goto no_integrity; | ||
896 | |||
897 | blk_integrity_register(dm_disk(t->md), | ||
898 | bdev_get_integrity(prev->dm_dev.bdev)); | ||
899 | |||
900 | return; | ||
901 | |||
902 | no_integrity: | ||
903 | blk_integrity_register(dm_disk(t->md), NULL); | ||
904 | |||
905 | return; | ||
906 | } | ||
907 | |||
882 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q) | 908 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q) |
883 | { | 909 | { |
884 | /* | 910 | /* |
@@ -899,6 +925,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q) | |||
899 | else | 925 | else |
900 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, q); | 926 | queue_flag_set_unlocked(QUEUE_FLAG_CLUSTER, q); |
901 | 927 | ||
928 | dm_table_set_integrity(t); | ||
902 | } | 929 | } |
903 | 930 | ||
904 | unsigned int dm_table_get_num_targets(struct dm_table *t) | 931 | unsigned int dm_table_get_num_targets(struct dm_table *t) |
@@ -1019,12 +1046,6 @@ struct mapped_device *dm_table_get_md(struct dm_table *t) | |||
1019 | return t->md; | 1046 | return t->md; |
1020 | } | 1047 | } |
1021 | 1048 | ||
1022 | int dm_table_barrier_ok(struct dm_table *t) | ||
1023 | { | ||
1024 | return t->barriers_supported; | ||
1025 | } | ||
1026 | EXPORT_SYMBOL(dm_table_barrier_ok); | ||
1027 | |||
1028 | EXPORT_SYMBOL(dm_vcalloc); | 1049 | EXPORT_SYMBOL(dm_vcalloc); |
1029 | EXPORT_SYMBOL(dm_get_device); | 1050 | EXPORT_SYMBOL(dm_get_device); |
1030 | EXPORT_SYMBOL(dm_put_device); | 1051 | EXPORT_SYMBOL(dm_put_device); |