#include "commands.h"
#include "utils.h"
+#include "help.h"
static const char * const balance_cmd_group_usage[] = {
"btrfs balance <command> [options] <path>",
printf("WARNING:\n\n");
printf("\tFull balance without filters requested. This operation is very\n");
printf("\tintense and takes potentially very long. It is recommended to\n");
- printf("\tuse the balance filters to narrow down the balanced data.\n");
+ printf("\tuse the balance filters to narrow down the scope of balance.\n");
printf("\tUse 'btrfs balance start --full-balance' option to skip this\n");
printf("\twarning. The operation will start in %d seconds.\n", delay);
printf("\tUse Ctrl-C to stop it.\n");
fprintf(stderr, "balance canceled by user\n");
ret = 0;
} else {
- error("error during balancing '%s': %s", path,
- strerror(errno));
+ error("error during balancing '%s': %m", path);
if (errno != EINPROGRESS)
fprintf(stderr,
"There may be more info in syslog - try dmesg | tail\n");
"-v be verbose",
"-f force reducing of metadata integrity",
"--full-balance do not print warning and do not delay start",
- "--background run the balance as a background process",
+ "--background|--bg",
+ " run the balance as a background process",
NULL
};
GETOPT_VAL_FULL_BALANCE },
{ "background", no_argument, NULL,
GETOPT_VAL_BACKGROUND },
+ { "bg", no_argument, NULL, GETOPT_VAL_BACKGROUND },
{ NULL, 0, NULL, 0 }
};
"unable to fork to run balance in background");
exit(1);
case (0):
- chdir("/");
+ /*
+ * Read the return value to silence compiler
+ * warning. Change to / should succeed and
+ * we're not in a security-sensitive context.
+ */
+ i = chdir("/");
close(0);
close(1);
close(2);
else
ret = 1;
} else {
- error("error during balancing '%s': %s\n"
+ error("error during balancing '%s': %m\n"
"There may be more info in syslog - try dmesg | tail",
- path, strerror(errno));
+ path);
ret = 1;
}
} else {
ret = 0;
goto out;
}
- error("balance status on '%s' failed: %s", path, strerror(errno));
+ error("balance status on '%s' failed: %m", path);
ret = 2;
goto out;
}