mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
dm table: allow targets to support discards internally
Permit a target to support discards regardless of whether or not all its underlying devices do. Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Alasdair G Kergon <[email protected]>
This commit is contained in:
parent
139f37f5e1
commit
4c25932701
2 changed files with 11 additions and 1 deletions
|
|
@ -1346,7 +1346,8 @@ bool dm_table_supports_discards(struct dm_table *t)
|
|||
return 0;
|
||||
|
||||
/*
|
||||
* Ensure that at least one underlying device supports discards.
|
||||
* Unless any target used by the table set discards_supported,
|
||||
* require at least one underlying device to support discards.
|
||||
* t->devices includes internal dm devices such as mirror logs
|
||||
* so we need to use iterate_devices here, which targets
|
||||
* supporting discard must provide.
|
||||
|
|
@ -1354,6 +1355,9 @@ bool dm_table_supports_discards(struct dm_table *t)
|
|||
while (i < dm_table_get_num_targets(t)) {
|
||||
ti = dm_table_get_target(t, i++);
|
||||
|
||||
if (ti->discards_supported)
|
||||
return 1;
|
||||
|
||||
if (ti->type->iterate_devices &&
|
||||
ti->type->iterate_devices(ti, device_discard_capable, NULL))
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue