]> sourceware.org Git - lvm2.git/commitdiff
cleanup: use lv_is_used_cache_pool
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 28 Feb 2018 16:38:43 +0000 (17:38 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 28 Feb 2018 20:15:55 +0000 (21:15 +0100)
Use lv_is_used_cache_pool() to simplify the code.
Function was introduced later and this code missed to use it.

lib/metadata/lv_manip.c

index 28f00abd92937441de7e06a214051b404f441ebe..1e2cfc6d83616f04a0a2bb26e335846000953270 100644 (file)
@@ -6084,7 +6084,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
        }
 
        /* Used cache pool, COW or historical LV cannot be activated */
-       if ((!lv_is_cache_pool(lv) || dm_list_empty(&lv->segs_using_this_lv)) &&
+       if (!lv_is_used_cache_pool(lv) &&
            !lv_is_cow(lv) && !lv_is_historical(lv) &&
            !deactivate_lv(cmd, lv)) {
                /* FIXME Review and fix the snapshot error paths! */
@@ -6134,16 +6134,14 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
                }
        }
 
-       if (lv_is_cache_pool(lv)) {
+       if (lv_is_used_cache_pool(lv)) {
                /* Cache pool removal drops cache layer
                 * If the cache pool is not linked, we can simply remove it. */
-               if (!dm_list_empty(&lv->segs_using_this_lv)) {
-                       if (!(cache_seg = get_only_segment_using_this_lv(lv)))
-                               return_0;
-                       /* TODO: polling */
-                       if (!lv_cache_remove(cache_seg->lv))
-                               return_0;
-               }
+               if (!(cache_seg = get_only_segment_using_this_lv(lv)))
+                       return_0;
+               /* TODO: polling */
+               if (!lv_cache_remove(cache_seg->lv))
+                       return_0;
        }
 
        visible = lv_is_visible(lv);
This page took 0.043568 seconds and 5 git commands to generate.