diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 6a56b3d36..91fd8f928 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.138 - ===================================== + Provide dm_tree_node_add_cache_target@base compatible symbol. Support DM_CACHE_FEATURE_METADATA2, new cache metadata format 2. Improve code to handle mode mask for cache nodes. Cache status check for passthrough also require trailing space. diff --git a/libdm/.exported_symbols.Base b/libdm/.exported_symbols.Base index ee7c4f2cc..4dc5c936c 100644 --- a/libdm/.exported_symbols.Base +++ b/libdm/.exported_symbols.Base @@ -234,7 +234,6 @@ dm_tree_free dm_tree_get_cookie dm_tree_children_use_uuid dm_tree_next_child -dm_tree_node_add_cache_target dm_tree_node_add_crypt_target dm_tree_node_add_error_target dm_tree_node_add_linear_target diff --git a/libdm/.exported_symbols.DM_1_02_138 b/libdm/.exported_symbols.DM_1_02_138 index 0468294e4..21e9ad8cc 100644 --- a/libdm/.exported_symbols.DM_1_02_138 +++ b/libdm/.exported_symbols.DM_1_02_138 @@ -6,3 +6,4 @@ dm_bitset_parse_list dm_stats_bind_from_fd dm_stats_start_filemapd dm_tree_node_add_raid_target_with_params_v2 +dm_tree_node_add_cache_target diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index ea8d5efbe..832d8de36 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -4034,13 +4034,15 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode, dnode->callback_data = data; } -/* - * Backward compatible dm_tree_node_size_changed() implementations. - * - * Keep these at the end of the file to avoid adding clutter around the - * current dm_tree_node_size_changed() version. - */ #if defined(__GNUC__) +/* + * Backward compatible implementations. + * + * Keep these at the end of the file to make sure that + * no code in this file accidentally calls it. + */ + +/* Backward compatible dm_tree_node_size_changed() implementations. */ int dm_tree_node_size_changed_base(const struct dm_tree_node *dnode); DM_EXPORT_SYMBOL_BASE(dm_tree_node_size_changed); int dm_tree_node_size_changed_base(const struct dm_tree_node *dnode) @@ -4048,4 +4050,43 @@ int dm_tree_node_size_changed_base(const struct dm_tree_node *dnode) /* Base does not make difference between smaller and bigger */ return dm_tree_node_size_changed(dnode) ? 1 : 0; } + +/* + * Retain ABI compatibility after adding the DM_CACHE_FEATURE_METADATA2 + * in version 1.02.138. + * + * Binaries compiled against version 1.02.138 onwards will use + * the new function dm_tree_node_add_cache_target which detects unknown + * feature flags and returns error for them. + */ +int dm_tree_node_add_cache_target_base(struct dm_tree_node *node, + uint64_t size, + uint64_t feature_flags, /* DM_CACHE_FEATURE_* */ + const char *metadata_uuid, + const char *data_uuid, + const char *origin_uuid, + const char *policy_name, + const struct dm_config_node *policy_settings, + uint32_t data_block_size); +DM_EXPORT_SYMBOL_BASE(dm_tree_node_add_cache_target); +int dm_tree_node_add_cache_target_base(struct dm_tree_node *node, + uint64_t size, + uint64_t feature_flags, + const char *metadata_uuid, + const char *data_uuid, + const char *origin_uuid, + const char *policy_name, + const struct dm_config_node *policy_settings, + uint32_t data_block_size) +{ + /* Old version supported only these FEATURE bits, others were ignored so masked them */ + static const uint64_t _mask = + DM_CACHE_FEATURE_WRITEBACK | + DM_CACHE_FEATURE_WRITETHROUGH | + DM_CACHE_FEATURE_PASSTHROUGH; + + return dm_tree_node_add_cache_target(node, size, feature_flags & _mask, + metadata_uuid, data_uuid, origin_uuid, + policy_name, policy_settings, data_block_size); +} #endif