mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2025-01-25 13:13:21 +08:00
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>
This commit is contained in:
parent
601c5e1b23
commit
07cc891d1d
@ -67,11 +67,11 @@ static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids,
|
|||||||
int sleep_interval)
|
int sleep_interval)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int remaining;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
remaining = count;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
int clean = 1;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (!ids[i])
|
if (!ids[i])
|
||||||
continue;
|
continue;
|
||||||
@ -80,22 +80,21 @@ static int wait_for_subvolume_cleaning(int fd, int count, u64 *ids,
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"ERROR: can't perform the search - %s\n",
|
"ERROR: can't perform the search - %s\n",
|
||||||
strerror(-ret));
|
strerror(-ret));
|
||||||
goto out;
|
return ret;
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("Subvolume id %llu is gone\n", ids[i]);
|
printf("Subvolume id %llu is gone\n", ids[i]);
|
||||||
ids[i] = 0;
|
ids[i] = 0;
|
||||||
remaining--;
|
} else {
|
||||||
|
clean = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!remaining)
|
if (clean == 0)
|
||||||
break;
|
break;
|
||||||
sleep(sleep_interval);
|
sleep(sleep_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * const subvolume_cmd_group_usage[] = {
|
static const char * const subvolume_cmd_group_usage[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user