X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=cmds-scrub.c;h=6b909f2046c524d9ab08ce82be7455fc3f8cb41b;hb=cc66055f97ef7ecdd77b18487b5c32f8334b8c8b;hp=2cf7f3084efc25d0095b4b4519fc1c8eb2f62e75;hpb=5b160549582fe3cd852ce501570232a1cc227338;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/cmds-scrub.c b/cmds-scrub.c index 2cf7f30..6b909f2 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -44,6 +44,7 @@ #include "disk-io.h" #include "commands.h" +#include "help.h" static const char * const scrub_cmd_group_usage[] = { "btrfs scrub [options] |", @@ -467,7 +468,7 @@ static struct scrub_file_record **scrub_read_file(int fd, int report_errors) { int avail = 0; int old_avail = 0; - char l[16 * 1024]; + char l[SZ_16K]; int state = 0; int curr = -1; int i = 0; @@ -590,8 +591,6 @@ again: ret = 0; _SCRUB_KVREAD(ret, &i, data_extents_scrubbed, avail, l, &p[curr]->p); - _SCRUB_KVREAD(ret, &i, data_extents_scrubbed, avail, l, - &p[curr]->p); _SCRUB_KVREAD(ret, &i, tree_extents_scrubbed, avail, l, &p[curr]->p); _SCRUB_KVREAD(ret, &i, data_bytes_scrubbed, avail, l, @@ -848,8 +847,7 @@ static void *scrub_one_dev(void *ctx) IOPRIO_PRIO_VALUE(sp->ioprio_class, sp->ioprio_classdata)); if (ret) - warning("setting ioprio failed: %s (ignored)", - strerror(errno)); + warning("setting ioprio failed: %m (ignored)"); ret = ioctl(sp->fd, BTRFS_IOC_SCRUB, &sp->scrub_args); gettimeofday(&tv, NULL); @@ -1194,8 +1192,8 @@ static int scrub_start(int argc, char **argv, int resume) if (mkdir_p(datafile)) { warning_on(!do_quiet, - "cannot create scrub data file, mkdir %s failed: %s. Status recording disabled", - datafile, strerror(errno)); + "cannot create scrub data file, mkdir %s failed: %m. Status recording disabled", + datafile); do_record = 0; } free(datafile); @@ -1266,7 +1264,7 @@ static int scrub_start(int argc, char **argv, int resume) spc.progress = calloc(fi_args.num_devices * 2, sizeof(*spc.progress)); if (!t_devs || !sp || !spc.progress) { - error_on(!do_quiet, "scrub failed: %s", strerror(errno)); + error_on(!do_quiet, "scrub failed: %m"); err = 1; goto out; } @@ -1345,9 +1343,9 @@ static int scrub_start(int argc, char **argv, int resume) ret = listen(prg_fd, 100); if (ret == -1) { warning_on(!do_quiet, - "failed to open the progress status socket at %s: %s. Progress cannot be queried", + "failed to open the progress status socket at %s: %m. Progress cannot be queried", sock_path[0] ? sock_path : - SCRUB_PROGRESS_SOCKET_PATH, strerror(errno)); + SCRUB_PROGRESS_SOCKET_PATH); if (prg_fd != -1) { close(prg_fd); prg_fd = -1; @@ -1371,8 +1369,7 @@ static int scrub_start(int argc, char **argv, int resume) if (do_background) { pid = fork(); if (pid == -1) { - error_on(!do_quiet, "cannot scrub, fork failed: %s", - strerror(errno)); + error_on(!do_quiet, "cannot scrub, fork failed: %m"); err = 1; goto out; } @@ -1390,8 +1387,8 @@ static int scrub_start(int argc, char **argv, int resume) } ret = wait(&stat); if (ret != pid) { - error_on(!do_quiet, "wait failed (ret=%d): %s", - ret, strerror(errno)); + error_on(!do_quiet, "wait failed (ret=%d): %m", + ret); err = 1; goto out; } @@ -1719,8 +1716,7 @@ static int cmd_scrub_status(int argc, char **argv) fdres = socket(AF_UNIX, SOCK_STREAM, 0); if (fdres == -1) { - error("failed to create socket to receive progress information: %s", - strerror(errno)); + error("failed to create socket to receive progress information: %m"); err = 1; goto out; }