]> sourceware.org Git - lvm2.git/commitdiff
dmstats: do not walk regions if deleting a single id
authorBryn M. Reeves <bmr@redhat.com>
Sun, 19 Jun 2016 13:40:03 +0000 (14:40 +0100)
committerBryn M. Reeves <bmr@redhat.com>
Tue, 5 Jul 2016 18:53:16 +0000 (19:53 +0100)
tools/dmsetup.c

index f7a3f740a6f466079443881d51991f2c1c677a7f..dfb362bfab8950c8f33f2075e7c2909c898e1110 100644 (file)
@@ -4965,16 +4965,20 @@ static int _stats_delete(CMD_ARGS)
                goto out;
        }
 
-       dm_stats_walk_do(dms) {
-               if (_switches[ALL_REGIONS_ARG])
+       if (_switches[ALL_REGIONS_ARG]) {
+               dm_stats_walk_do(dms) {
                        region_id = dm_stats_get_current_region(dms);
-               if (!dm_stats_delete_region(dms, region_id)) {
-                       log_error("Could not delete statistics region.");
-                       goto out;
-               }
+                       if (!dm_stats_delete_region(dms, region_id)) {
+                               log_error("Could not delete statistics region.");
+                               goto out;
+                       }
+                       log_info("Deleted statistics region %" PRIu64, region_id);
+                       dm_stats_walk_next_region(dms);
+               } dm_stats_walk_while(dms);
+       } else {
+               dm_stats_delete_region(dms, region_id);
                log_info("Deleted statistics region %" PRIu64, region_id);
-               dm_stats_walk_next_region(dms);
-       } dm_stats_walk_while(dms);
+       }
 
        r = 1;
 
This page took 0.065321 seconds and 5 git commands to generate.