diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2014-07-10 12:23:07 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-08-01 12:30:34 -0400 |
commit | a7ffb6a53391c2690263675f13c79a273301d2b3 (patch) | |
tree | 11a4c5f5cd92230635021bb3b5f6a8b1ed0fa8f1 /drivers/md | |
parent | 895b47d7989af3aacea16380b190b1bb8f046362 (diff) |
dm table: make dm_table_supports_discards static
The function dm_table_supports_discards is only called from
dm-table.c:dm_table_set_restrictions(). So move it above
dm_table_set_restrictions and make it static.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-table.c | 73 | ||||
-rw-r--r-- | drivers/md/dm.h | 1 |
2 files changed, 37 insertions, 37 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 5f59f1e3e5b1..3c72bf10e9dc 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -1430,6 +1430,43 @@ static bool dm_table_supports_write_same(struct dm_table *t) | |||
1430 | return true; | 1430 | return true; |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev, | ||
1434 | sector_t start, sector_t len, void *data) | ||
1435 | { | ||
1436 | struct request_queue *q = bdev_get_queue(dev->bdev); | ||
1437 | |||
1438 | return q && blk_queue_discard(q); | ||
1439 | } | ||
1440 | |||
1441 | static bool dm_table_supports_discards(struct dm_table *t) | ||
1442 | { | ||
1443 | struct dm_target *ti; | ||
1444 | unsigned i = 0; | ||
1445 | |||
1446 | /* | ||
1447 | * Unless any target used by the table set discards_supported, | ||
1448 | * require at least one underlying device to support discards. | ||
1449 | * t->devices includes internal dm devices such as mirror logs | ||
1450 | * so we need to use iterate_devices here, which targets | ||
1451 | * supporting discard selectively must provide. | ||
1452 | */ | ||
1453 | while (i < dm_table_get_num_targets(t)) { | ||
1454 | ti = dm_table_get_target(t, i++); | ||
1455 | |||
1456 | if (!ti->num_discard_bios) | ||
1457 | continue; | ||
1458 | |||
1459 | if (ti->discards_supported) | ||
1460 | return 1; | ||
1461 | |||
1462 | if (ti->type->iterate_devices && | ||
1463 | ti->type->iterate_devices(ti, device_discard_capable, NULL)) | ||
1464 | return 1; | ||
1465 | } | ||
1466 | |||
1467 | return 0; | ||
1468 | } | ||
1469 | |||
1433 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, | 1470 | void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, |
1434 | struct queue_limits *limits) | 1471 | struct queue_limits *limits) |
1435 | { | 1472 | { |
@@ -1636,39 +1673,3 @@ void dm_table_run_md_queue_async(struct dm_table *t) | |||
1636 | } | 1673 | } |
1637 | EXPORT_SYMBOL(dm_table_run_md_queue_async); | 1674 | EXPORT_SYMBOL(dm_table_run_md_queue_async); |
1638 | 1675 | ||
1639 | static int device_discard_capable(struct dm_target *ti, struct dm_dev *dev, | ||
1640 | sector_t start, sector_t len, void *data) | ||
1641 | { | ||
1642 | struct request_queue *q = bdev_get_queue(dev->bdev); | ||
1643 | |||
1644 | return q && blk_queue_discard(q); | ||
1645 | } | ||
1646 | |||
1647 | bool dm_table_supports_discards(struct dm_table *t) | ||
1648 | { | ||
1649 | struct dm_target *ti; | ||
1650 | unsigned i = 0; | ||
1651 | |||
1652 | /* | ||
1653 | * Unless any target used by the table set discards_supported, | ||
1654 | * require at least one underlying device to support discards. | ||
1655 | * t->devices includes internal dm devices such as mirror logs | ||
1656 | * so we need to use iterate_devices here, which targets | ||
1657 | * supporting discard selectively must provide. | ||
1658 | */ | ||
1659 | while (i < dm_table_get_num_targets(t)) { | ||
1660 | ti = dm_table_get_target(t, i++); | ||
1661 | |||
1662 | if (!ti->num_discard_bios) | ||
1663 | continue; | ||
1664 | |||
1665 | if (ti->discards_supported) | ||
1666 | return 1; | ||
1667 | |||
1668 | if (ti->type->iterate_devices && | ||
1669 | ti->type->iterate_devices(ti, device_discard_capable, NULL)) | ||
1670 | return 1; | ||
1671 | } | ||
1672 | |||
1673 | return 0; | ||
1674 | } | ||
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index ed76126aac54..e81d2152fa68 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
@@ -72,7 +72,6 @@ int dm_table_any_busy_target(struct dm_table *t); | |||
72 | unsigned dm_table_get_type(struct dm_table *t); | 72 | unsigned dm_table_get_type(struct dm_table *t); |
73 | struct target_type *dm_table_get_immutable_target_type(struct dm_table *t); | 73 | struct target_type *dm_table_get_immutable_target_type(struct dm_table *t); |
74 | bool dm_table_request_based(struct dm_table *t); | 74 | bool dm_table_request_based(struct dm_table *t); |
75 | bool dm_table_supports_discards(struct dm_table *t); | ||
76 | void dm_table_free_md_mempools(struct dm_table *t); | 75 | void dm_table_free_md_mempools(struct dm_table *t); |
77 | struct dm_md_mempools *dm_table_get_md_mempools(struct dm_table *t); | 76 | struct dm_md_mempools *dm_table_get_md_mempools(struct dm_table *t); |
78 | 77 | ||