Skip to contentSkip to conversation

master - cache: improve activation with -real

PATCH Zdenek Kabelac 1 participant 1 message Dec 18, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=69434c2eca5bb7667d73916a28d03b8c687aea32
Commit:        69434c2eca5bb7667d73916a28d03b8c687aea32
Parent:        954c59779d35436a6d2f28482ec1ed6dc128844c
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sun Dec 18 15:05:31 2016 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Sun Dec 18 19:30:50 2016 +0100

cache: improve activation with -real

When cache volume may be converted from normal to -real layer LV we need to improve logic for call cache_check.

With this patch, we register call for cache_check only when metadata LV is not yet present in active table slot (should match initial table load).
This avoids unwanted checking when cache would become layer device online.

---
 WHATS_NEW                  |    1 +
 lib/activate/dev_manager.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index 6ab2b19..74638fd 100644
@@ -1,5 +1,6 @@
 Version 2.02.169 - 
 =====================================
+  Support cache volume activation with -real layer.
   Improve search of lock-holder for external origin and thin-pool.
   Support status checking of cache volume used in layer.
   Avoid shifting by one number of blocks when clearing dirty cache volume.
lib/activate/dev_manager.c +4 -0
index 8245454..520a0a1 100644
@@ -2901,6 +2901,10 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
 		return_0;
 
 	if (lv_is_cache(lv) &&
+	    /* Register callback only for layer activation or non-layered cache LV */
+	    (layer || !lv_layer(lv)) &&
+	    /* Register callback when metadata LV is NOT already active */
+	    !_cached_dm_info(dm->mem, dtree, first_seg(first_seg(lv)->pool_lv)->metadata_lv, NULL) &&
 	    !_pool_register_callback(dm, dnode, lv))
 		return_0;