|
@@ -1283,6 +1283,22 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned flush)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static bool dm_table_discard_zeroes_data(struct dm_table *t)
|
|
|
+{
|
|
|
+ struct dm_target *ti;
|
|
|
+ unsigned i = 0;
|
|
|
+
|
|
|
+ /* Ensure that all targets supports discard_zeroes_data. */
|
|
|
+ while (i < dm_table_get_num_targets(t)) {
|
|
|
+ ti = dm_table_get_target(t, i++);
|
|
|
+
|
|
|
+ if (ti->discard_zeroes_data_unsupported)
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
|
|
|
struct queue_limits *limits)
|
|
|
{
|
|
@@ -1305,6 +1321,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
|
|
|
}
|
|
|
blk_queue_flush(q, flush);
|
|
|
|
|
|
+ if (!dm_table_discard_zeroes_data(t))
|
|
|
+ q->limits.discard_zeroes_data = 0;
|
|
|
+
|
|
|
dm_table_set_integrity(t);
|
|
|
|
|
|
/*
|