diff options
author | Mike Snitzer <snitzer@kernel.org> | 2022-07-05 14:00:36 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2022-07-07 11:49:33 -0400 |
commit | 2aec377a29250b942f14d3c16d49783da3e9df11 (patch) | |
tree | 6deeee9da1656b677617f7de3ef954e2f2d257cf /drivers/md/dm-table.c | |
parent | 8b211aaccb915bbf4f4a68f1910c4de701df393b (diff) |
dm table: remove dm_table_get_num_targets() wrapper
More efficient and readable to just access table->num_targets directly.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 3f29b1113294..b4af34041a6f 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -593,7 +593,7 @@ static int validate_hardware_logical_block_alignment(struct dm_table *table, /* * Check each entry in the table in turn. */ - for (i = 0; i < dm_table_get_num_targets(table); i++) { + for (i = 0; i < table->num_targets; i++) { ti = dm_table_get_target(table, i); blk_set_stacking_limits(&ti_limits); @@ -832,7 +832,7 @@ static bool dm_table_supports_dax(struct dm_table *t, unsigned i; /* Ensure that all targets support DAX. */ - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (!ti->type->direct_access) @@ -987,7 +987,7 @@ struct dm_target *dm_table_get_wildcard_target(struct dm_table *t) struct dm_target *ti; unsigned i; - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (dm_target_is_wildcard(ti->type)) return ti; @@ -1127,7 +1127,7 @@ static struct gendisk * dm_table_get_integrity_disk(struct dm_table *t) struct gendisk *prev_disk = NULL, *template_disk = NULL; unsigned i; - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { struct dm_target *ti = dm_table_get_target(t, i); if (!dm_target_passes_integrity(ti->type)) goto no_integrity; @@ -1248,7 +1248,7 @@ static int dm_keyslot_evict(struct blk_crypto_profile *profile, t = dm_get_live_table(md, &srcu_idx); if (!t) return 0; - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (!ti->type->iterate_devices) continue; @@ -1318,7 +1318,7 @@ static int dm_table_construct_crypto_profile(struct dm_table *t) memset(profile->modes_supported, 0xFF, sizeof(profile->modes_supported)); - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (!dm_target_passes_crypto(ti->type)) { @@ -1540,7 +1540,7 @@ static bool dm_table_any_dev_attr(struct dm_table *t, struct dm_target *ti; unsigned int i; - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (ti->type->iterate_devices && @@ -1566,7 +1566,7 @@ static bool dm_table_supports_poll(struct dm_table *t) struct dm_target *ti; unsigned i = 0; - while (i < dm_table_get_num_targets(t)) { + while (i < t->num_targets) { ti = dm_table_get_target(t, i++); if (!ti->type->iterate_devices || @@ -1588,7 +1588,7 @@ bool dm_table_has_no_data_devices(struct dm_table *table) struct dm_target *ti; unsigned i, num_devices; - for (i = 0; i < dm_table_get_num_targets(table); i++) { + for (i = 0; i < table->num_targets; i++) { ti = dm_table_get_target(table, i); if (!ti->type->iterate_devices) @@ -1625,7 +1625,7 @@ static bool dm_table_supports_zoned_model(struct dm_table *t, struct dm_target *ti; unsigned i; - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (dm_target_supports_zoned_hm(ti->type)) { @@ -1699,7 +1699,7 @@ int dm_calculate_queue_limits(struct dm_table *table, blk_set_stacking_limits(limits); - for (i = 0; i < dm_table_get_num_targets(table); i++) { + for (i = 0; i < table->num_targets; i++) { blk_set_stacking_limits(&ti_limits); ti = dm_table_get_target(table, i); @@ -1819,7 +1819,7 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned long flush) * so we need to use iterate_devices here, which targets * supporting flushes must provide. */ - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (!ti->num_flush_bios) @@ -1877,7 +1877,7 @@ static bool dm_table_supports_write_zeroes(struct dm_table *t) struct dm_target *ti; unsigned i = 0; - while (i < dm_table_get_num_targets(t)) { + while (i < t->num_targets) { ti = dm_table_get_target(t, i++); if (!ti->num_write_zeroes_bios) @@ -1904,7 +1904,7 @@ static bool dm_table_supports_nowait(struct dm_table *t) struct dm_target *ti; unsigned i = 0; - while (i < dm_table_get_num_targets(t)) { + while (i < t->num_targets) { ti = dm_table_get_target(t, i++); if (!dm_target_supports_nowait(ti->type)) @@ -1929,7 +1929,7 @@ static bool dm_table_supports_discards(struct dm_table *t) struct dm_target *ti; unsigned i; - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (!ti->num_discard_bios) @@ -1961,7 +1961,7 @@ static bool dm_table_supports_secure_erase(struct dm_table *t) struct dm_target *ti; unsigned int i; - for (i = 0; i < dm_table_get_num_targets(t); i++) { + for (i = 0; i < t->num_targets; i++) { ti = dm_table_get_target(t, i); if (!ti->num_secure_erase_bios) @@ -2092,11 +2092,6 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, return 0; } -unsigned int dm_table_get_num_targets(struct dm_table *t) -{ - return t->num_targets; -} - struct list_head *dm_table_get_devices(struct dm_table *t) { return &t->devices; |