]> sourceware.org Git - lvm2.git/commitdiff
cache: simplier signal handling
authorZdenek Kabelac <zkabelac@redhat.com>
Sun, 13 Sep 2020 09:33:39 +0000 (11:33 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Sun, 13 Sep 2020 22:15:14 +0000 (00:15 +0200)
Use just single sigint_allow()/restore() within flushing loop
and void one extra signal manipulation.

lib/metadata/cache_manip.c

index a786e8baca0b187c509128fbad68cc86c31234b2..2c4cc92fbbdde1c4c62927c980e2e413a5eddcd3 100644 (file)
@@ -480,7 +480,7 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
        const struct logical_volume *lock_lv = lv_lock_holder(cache_lv);
        struct lv_segment *cache_seg = first_seg(cache_lv);
        struct lv_status_cache *status;
-       int cleaner_policy, writeback;
+       int cleaner_policy = 0, writeback;
        uint64_t dirty_blocks;
 
        *is_clean = 0;
@@ -488,6 +488,9 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
        //FIXME: use polling to do this...
        for (;;) {
                sigint_allow();
+               if (cleaner_policy)
+                       /* TODO: Use centralized place */
+                       usleep(500000);
                sigint_restore();
                if (sigint_caught()) {
                        sigint_clear();
@@ -523,13 +526,8 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
                log_print_unless_silent("Flushing " FMTu64 " blocks for cache %s.",
                                        dirty_blocks, display_lvname(cache_lv));
 
-               if (cleaner_policy) {
-                       /* TODO: Use centralized place */
-                       sigint_allow();
-                       usleep(500000);
-                       sigint_restore();
+               if (cleaner_policy)
                        continue;
-               }
 
                if (!(cache_lv->status & LVM_WRITE)) {
                        log_warn("WARNING: Dirty blocks found on read-only cache volume %s.",
This page took 0.040593 seconds and 5 git commands to generate.