summaryrefslogtreecommitdiff
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-08-26 22:03:39 +0800
committerDavid Sterba <dsterba@suse.com>2015-09-01 14:02:49 +0200
commit07cc891d1d9819d5cf0628af555e7727d289cf7b (patch)
tree5cc04c30289275fc03b4ba6fe325445b52f184dc /cmds-subvolume.c
parent601c5e1b234fa13bbbed89bce3201f81340ff15d (diff)
btrfs-progs: Simplify all-subvolumn-clean condition for wait_for_subvolume_cleaning
Instead of using a dirty-subvolumn-counter in old code, this patch turn to use a simple and direct way: If (not dirty-subvolumn found in current loop) { return all_clean; } Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r--cmds-subvolume.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index b4785da3..82173c04 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -67,11 +67,11 @@ static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids,
int sleep_interval)
{
int ret;
- int remaining;
int i;
- remaining = count;
while (1) {
+ int clean = 1;
+
for (i = 0; i < count; i++) {
if (!ids[i])
continue;
@@ -80,22 +80,21 @@ static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids,
fprintf(stderr,
"ERROR: can't perform the search - %s\n",
strerror(-ret));
- goto out;
+ return ret;
}
if (ret) {
printf("Subvolume id %llu is gone\n", ids[i]);
ids[i] = 0;
- remaining--;
+ } else {
+ clean = 0;
}
}
- if (!remaining)
+ if (clean == 0)
break;
sleep(sleep_interval);
}
- ret = 0;
-out:
- return ret;
+ return 0;
}
static const char * const subvolume_cmd_group_usage[] = {