btrfs-progs: rename MUST_LOG to LOG_ALWAYS
Rename MUST_LOG Use a prefix LOG_ so we can add more levels, use it where it was hardcoded as argument to pr_verbose. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
b73a29936a
commit
9150cdd7e6
|
@ -351,7 +351,7 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
|
|||
} else if (ret > 0) {
|
||||
error("balance: %s", btrfs_err_str(ret));
|
||||
} else {
|
||||
pr_verbose(MUST_LOG,
|
||||
pr_verbose(LOG_ALWAYS,
|
||||
"Done, had to relocate %llu out of %llu chunks\n",
|
||||
(unsigned long long)args->stat.completed,
|
||||
(unsigned long long)args->stat.considered);
|
||||
|
@ -742,7 +742,7 @@ static int cmd_balance_resume(const struct cmd_struct *cmd,
|
|||
ret = 1;
|
||||
}
|
||||
} else {
|
||||
pr_verbose(MUST_LOG,
|
||||
pr_verbose(LOG_ALWAYS,
|
||||
"Done, had to relocate %llu out of %llu chunks\n",
|
||||
(unsigned long long)args.stat.completed,
|
||||
(unsigned long long)args.stat.considered);
|
||||
|
|
|
@ -453,7 +453,7 @@ static int cmd_device_scan(const struct cmd_struct *cmd, int argc, char **argv)
|
|||
error("cannot unregister devices: %m");
|
||||
}
|
||||
} else {
|
||||
pr_verbose(-1, "Scanning for Btrfs filesystems\n");
|
||||
pr_verbose(LOG_ALWAYS, "Scanning for Btrfs filesystems\n");
|
||||
ret = btrfs_scan_devices(1);
|
||||
error_on(ret, "error %d while scanning", ret);
|
||||
ret = btrfs_register_all_devices();
|
||||
|
|
|
@ -177,7 +177,7 @@ static int cmd_quota_rescan(const struct cmd_struct *cmd, int argc, char **argv)
|
|||
}
|
||||
|
||||
if (ret == 0) {
|
||||
pr_verbose(MUST_LOG, "quota rescan started\n");
|
||||
pr_verbose(LOG_ALWAYS, "quota rescan started\n");
|
||||
fflush(stdout);
|
||||
} else if (ret < 0 && (!wait_for_completion || e != EINPROGRESS)) {
|
||||
error("quota rescan failed: %m");
|
||||
|
|
|
@ -787,8 +787,8 @@ static int overwrite_ok(const char * path)
|
|||
return 2;
|
||||
|
||||
if (!warn) {
|
||||
pr_verbose(-1, "Skipping existing file %s\n", path);
|
||||
pr_verbose(-1, "If you wish to overwrite use -o\n");
|
||||
pr_verbose(LOG_ALWAYS, "Skipping existing file %s\n", path);
|
||||
pr_verbose(LOG_ALWAYS, "If you wish to overwrite use -o\n");
|
||||
} else {
|
||||
pr_verbose(1, "Skipping existing file %s\n", path);
|
||||
}
|
||||
|
|
|
@ -1354,7 +1354,7 @@ static int scrub_start(const struct cmd_struct *cmd, int argc, char **argv,
|
|||
}
|
||||
|
||||
if (!n_start && !n_resume) {
|
||||
pr_verbose(MUST_LOG,
|
||||
pr_verbose(LOG_ALWAYS,
|
||||
"scrub: nothing to resume for %s, fsid %s\n",
|
||||
path, fsid);
|
||||
nothing_to_resume = 1;
|
||||
|
@ -1427,7 +1427,7 @@ static int scrub_start(const struct cmd_struct *cmd, int argc, char **argv,
|
|||
if (pid) {
|
||||
int stat;
|
||||
scrub_handle_sigint_parent();
|
||||
pr_verbose(MUST_LOG,
|
||||
pr_verbose(LOG_ALWAYS,
|
||||
"scrub %s on %s, fsid %s (pid=%d)\n",
|
||||
n_start ? "started" : "resumed",
|
||||
path, fsid, pid);
|
||||
|
@ -1688,7 +1688,7 @@ static int cmd_scrub_cancel(const struct cmd_struct *cmd, int argc, char **argv)
|
|||
}
|
||||
|
||||
ret = 0;
|
||||
pr_verbose(MUST_LOG, "scrub cancelled\n");
|
||||
pr_verbose(LOG_ALWAYS, "scrub cancelled\n");
|
||||
|
||||
out:
|
||||
close_file_or_dir(fdmnt, dirstream);
|
||||
|
|
|
@ -172,7 +172,7 @@ static int cmd_subvol_create(const struct cmd_struct *cmd,
|
|||
if (fddst < 0)
|
||||
goto out;
|
||||
|
||||
pr_verbose(MUST_LOG, "Create subvolume '%s/%s'\n", dstdir, newname);
|
||||
pr_verbose(LOG_ALWAYS, "Create subvolume '%s/%s'\n", dstdir, newname);
|
||||
if (inherit) {
|
||||
struct btrfs_ioctl_vol_args_v2 args;
|
||||
|
||||
|
@ -402,17 +402,17 @@ again:
|
|||
goto out;
|
||||
}
|
||||
|
||||
pr_verbose(MUST_LOG, "Delete subvolume (%s): ",
|
||||
pr_verbose(LOG_ALWAYS, "Delete subvolume (%s): ",
|
||||
commit_mode == COMMIT_EACH ||
|
||||
(commit_mode == COMMIT_AFTER && cnt + 1 == argc) ?
|
||||
"commit" : "no-commit");
|
||||
|
||||
if (subvolid == 0)
|
||||
pr_verbose(MUST_LOG, "'%s/%s'\n", dname, vname);
|
||||
pr_verbose(LOG_ALWAYS, "'%s/%s'\n", dname, vname);
|
||||
else if (!subvol_path_not_found)
|
||||
pr_verbose(MUST_LOG, "'%s'\n", full_subvolpath);
|
||||
pr_verbose(LOG_ALWAYS, "'%s'\n", full_subvolpath);
|
||||
else
|
||||
pr_verbose(MUST_LOG, "subvolid=%llu\n", subvolid);
|
||||
pr_verbose(LOG_ALWAYS, "subvolid=%llu\n", subvolid);
|
||||
|
||||
if (subvolid == 0)
|
||||
err = btrfs_util_delete_subvolume_fd(fd, vname, 0);
|
||||
|
@ -634,11 +634,11 @@ static int cmd_subvol_snapshot(const struct cmd_struct *cmd,
|
|||
|
||||
if (readonly) {
|
||||
args.flags |= BTRFS_SUBVOL_RDONLY;
|
||||
pr_verbose(MUST_LOG,
|
||||
pr_verbose(LOG_ALWAYS,
|
||||
"Create a readonly snapshot of '%s' in '%s/%s'\n",
|
||||
subvol, dstdir, newname);
|
||||
} else {
|
||||
pr_verbose(MUST_LOG,
|
||||
pr_verbose(LOG_ALWAYS,
|
||||
"Create a snapshot of '%s' in '%s/%s'\n",
|
||||
subvol, dstdir, newname);
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ void internal_error(const char *fmt, ...);
|
|||
* options haven't been set by the user) due to backward compatibility reasons
|
||||
* where applications may expect the output.
|
||||
*/
|
||||
#define MUST_LOG -1
|
||||
#define LOG_ALWAYS -1
|
||||
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
void pr_verbose(int level, const char *fmt, ...);
|
||||
|
|
Loading…
Reference in New Issue