X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Flustre_lfsck.c;h=e04cc216cf65e8adb393cb53487a0c94d69c6961;hp=20ea2be3148d70f88f08adafe4455d2505d6d65c;hb=7e81f13c4a852cdba9fbebcc2b6385d6c2effa4b;hpb=cc922789d90f9495dc8009eb082392ad41151a3d diff --git a/lustre/utils/lustre_lfsck.c b/lustre/utils/lustre_lfsck.c index 20ea2be..e04cc21 100644 --- a/lustre/utils/lustre_lfsck.c +++ b/lustre/utils/lustre_lfsck.c @@ -53,6 +53,7 @@ static struct option long_opt_start[] = { {"reset", no_argument, 0, 'r'}, {"speed", required_argument, 0, 's'}, {"type", required_argument, 0, 't'}, + {"windows", required_argument, 0, 'w'}, {0, 0, 0, 0} }; @@ -96,6 +97,7 @@ static void usage_start(void) " [-n | --dryrun switch] [-r | --reset]\n" " [-s | --speed speed_limit]\n" " [-t | --type lfsck_type[,lfsck_type...]]\n" + " [-w | --windows win_size]\n" "OPTIONS:\n" "-M: The device to start LFSCK/scrub on.\n" "-e: Error handle, 'continue'(default) or 'abort'.\n" @@ -104,7 +106,8 @@ static void usage_start(void) "-r: Reset scanning start position to the device beginning.\n" "-s: How many items can be scanned at most per second. " "'%d' means no limit (default).\n" - "-t: The LFSCK type(s) to be started.\n", + "-t: The LFSCK type(s) to be started.\n" + "-w: The windows size for async requests pipeline.\n", LFSCK_SPEED_NO_LIMIT); } @@ -141,7 +144,7 @@ int jt_lfsck_start(int argc, char **argv) char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf; char device[MAX_OBD_NAME]; struct lfsck_start start; - char *optstring = "M:e:hn:rs:t:"; + char *optstring = "M:e:hn:rs:t:w:"; int opt, index, rc, val, i, type; memset(&data, 0, sizeof(data)); @@ -234,6 +237,23 @@ int jt_lfsck_start(int argc, char **argv) } break; } + case 'w': + val = atoi(optarg); + if (val < 0 || val > LFSCK_ASYNC_WIN_MAX) { + fprintf(stderr, + "Too large async windows size, " + "which may cause memory issues. " + "The valid range is [0 - %u]. " + "If you do not want to restrict " + "the windows size for async reqeusts " + "pipeline, just set it as 0.\n", + LFSCK_ASYNC_WIN_MAX); + return -EINVAL; + } + + start.ls_async_windows = val; + start.ls_valid |= LSV_ASYNC_WINDOWS; + break; default: fprintf(stderr, "Invalid option, '-h' for help.\n"); return -EINVAL; @@ -325,7 +345,7 @@ int jt_lfsck_stop(int argc, char **argv) return rc; } else { fprintf(stderr, - "Must sepcify device to stop LFSCK.\n"); + "Must specify device to stop LFSCK.\n"); return -EINVAL; } }