Add 'target_status_compatible' method to 'struct segtype_handler'.
Version 2.02.59 -
===================================
+ Improve target type compatibility checking in _percent_run().
+ Add 'target_status_compatible' method to 'struct segtype_handler'.
Fix difference between CTR table built and expected for cluster log.
Version 2.02.58 - 14th January 2010
seg = dm_list_item(segh, struct lv_segment);
}
- /*
- * If target status doesn't have 'params' or 'type' is not in the same
- * target base class as 'target_type' (e.g. snapshot*, mirror*) skip it
- * - allows the situation when 'type' is "snapshot-merge" and
- * 'target_type' is "snapshot"
- */
- /* FIXME Do this properly - relying on target prefixes is incorrect. (E.g. snapshot-origin)*/
- if (!type || !params || strncmp(type, target_type, strlen(target_type)))
+ if (!type || !params)
continue;
if (!(segtype = get_segtype_from_string(dm->cmd, target_type)))
continue;
+ if (strcmp(type, target_type)) {
+ /* If kernel's type isn't an exact match is it compatible? */
+ if (!segtype->ops->target_status_compatible ||
+ !segtype->ops->target_status_compatible(type))
+ continue;
+ }
+
if (segtype->ops->target_percent &&
!segtype->ops->target_percent(&dm->target_state,
&percent_range, dm->mem,
struct lv_segment *seg,
struct dm_tree_node *node, uint64_t len,
uint32_t *pvmove_mirror_count);
+ int (*target_status_compatible) (const char *type);
int (*target_percent) (void **target_state,
percent_range_t *percent_range,
struct dm_pool * mem,
return 1;
}
+static int _snap_target_status_compatible(const char *type)
+{
+ return (strcmp(type, "snapshot-merge") == 0);
+}
+
#ifdef DEVMAPPER_SUPPORT
static int _snap_target_percent(void **target_state __attribute((unused)),
percent_range_t *percent_range,
.name = _snap_name,
.text_import = _snap_text_import,
.text_export = _snap_text_export,
+ .target_status_compatible = _snap_target_status_compatible,
#ifdef DEVMAPPER_SUPPORT
.target_percent = _snap_target_percent,
.target_present = _snap_target_present,