From f083b09b7819c785db4f82a81f68da3bccfb04bf Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Sat, 6 Feb 2016 18:38:46 -0500 Subject: dm: set DM_TARGET_WILDCARD feature on "error" target The DM_TARGET_WILDCARD feature indicates that the "error" target may replace any target; even immutable targets. This feature will be useful to preserve the ability to replace the "multipath" target even once it is formally converted over to having the DM_TARGET_IMMUTABLE feature. Also, implicit in the DM_TARGET_WILDCARD feature flag being set is that .map, .map_rq, .clone_and_map_rq and .release_clone_rq are all defined in the target_type. Signed-off-by: Mike Snitzer --- drivers/md/dm-table.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/md/dm-table.c') diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 061152a43730..a49e62b8611f 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -920,6 +920,20 @@ struct target_type *dm_table_get_immutable_target_type(struct dm_table *t) return t->immutable_target_type; } +struct dm_target *dm_table_get_wildcard_target(struct dm_table *t) +{ + struct dm_target *uninitialized_var(ti); + unsigned i = 0; + + while (i < dm_table_get_num_targets(t)) { + ti = dm_table_get_target(t, i++); + if (dm_target_is_wildcard(ti->type)) + return ti; + } + + return NULL; +} + bool dm_table_request_based(struct dm_table *t) { return __table_type_request_based(dm_table_get_type(t)); -- cgit v1.2.3