An on-line Lustre consistency check and repair tool.
.TP
.B lfsck_start \fR<-M | --device [MDT,OST]_device>
- \fR[-e | --error <error_handle>]
- \fR[-h | --help]
- \fR[-n | --dryrun <switch>]
- \fR[-r | --reset]
- \fR[-s | --speed <speed_limit>]
- \fR[-A | --all]
- \fR[-t | --type <lfsck_type[,lfsck_type...]>]
- \fR[-w | --windows <win_size>]
- \fR[-o | --orphan]
+ \fR[-A | --all] [-c | --create_ostobj [on | off]]
+ \fR[-e | --error <continue | abort>] [-h | --help]
+ \fR[-n | --dryrun [on | off]] [-o | --orphan]
+ \fR[-r | --reset] [-s | --speed speed_limit]
+ \fR[-t | --type lfsck_type[,lfsck_type...]]
+ \fR[-w | --window_size size]
.br
Start LFSCK on the specified MDT or OST device with specified parameters.
.TP
-M, --device <MDT,OST_device>
The MDT or OST device to start LFSCK/scrub on.
.TP
+ -A, --all
+Start LFSCK on all MDT devices.
+.TP
+ -c, --create_ostobj [on | off]
+Create the lost OST-object for dangling LOV EA: 'off'(default) or 'on'. Under
+default mode, when the LFSCK find some MDT-object with dangling reference, it
+will report the inconsistency but without repairing. Otherwise the LFSCK will
+re-create the missed OST-object.
+.TP
-e, --error <error_handle>
With error_handle as 'abort' LFSCK will stop if a repair is impossible. If no
value is specified, the saved value will be used if resuming from a checkpoint.
-h, --help
Show this help.
.TP
- -n, --dryrun <on|off>
+ -n, --dryrun [on | off]
Perform a trial run with no changes made. Default is 'off'
.TP
+ -o, --orphan
+Handle orphan objects, such as orphan OST-objects for layout LFSCK.
+.TP
-r, --reset
Set the current position of object iteration to the beginning of the specified
-MDT. By default the iterator will resume scanning from the last checkpoint
-(saved periodically by LFSCK) provided it is available.
+device. The non-specified parameters will also be reset as default. By default
+the iterator will resume the scanning from the last checkpoint (position), and
+other non-specified parameters will be the same as former non-completed run.
.TP
-s, --speed <speed_limit>
Set the upper limit of LFSCK processing in objects per second. If no value is
specified the saved value is used (if resuming from a check point). Otherwise
the default value of 0 is used. 0 means run as fast as possible.
.TP
- -A, --all
-Start LFSCK on all devices.
-.TP
-t, --type <lfsck_type[,lfsck_type...]>
The type of LFSCK checking/repair to execute. By default, the LFSCK
component(s) which ran last time and did not finish or the component(s)
Alternative types include FID-in-dirent and linkEA (namespace) and MDT-OST
inconsistency (layout).
.TP
- -w, --windows
+ -w, --window_size <size>
The window size for async requests pipeline.
.TP
- -o, --orphan
-Handle orphan objects, such as orphan OST-objects for layout LFSCK.
-.TP
-.B lfsck_stop \fR<-M | --device [MDT,OST]_device>
- \fR[-A | --all]
- \fR[-h | --help]
+.B lfsck_stop \fR<-M | --device [MDT,OST]_device> [-A | --all] [-h | --help]
Stop LFSCK on the specified MDT or OST device.
.TP
-M, --device <[MDT,OST]_device>
RETURN(rc);
}
+
+int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
+ struct lfsck_start *start, bool reset)
+{
+ struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram;
+ int rc = 0;
+ bool dirty = false;
+
+ if (start == NULL) {
+ LASSERT(reset);
+
+ if (bk->lb_param & LPF_ALL_TGT) {
+ bk->lb_param &= ~LPF_ALL_TGT;
+ dirty = true;
+ }
+
+ if (bk->lb_param & LPF_CREATE_OSTOBJ) {
+ bk->lb_param &= ~LPF_CREATE_OSTOBJ;
+ dirty = true;
+ }
+
+ if (bk->lb_param & LPF_FAILOUT) {
+ bk->lb_param &= ~LPF_FAILOUT;
+ dirty = true;
+ }
+
+ if (bk->lb_param & LPF_DRYRUN) {
+ bk->lb_param &= ~LPF_DRYRUN;
+ dirty = true;
+ }
+
+ if (bk->lb_param & LPF_ORPHAN) {
+ bk->lb_param &= ~LPF_ORPHAN;
+ dirty = true;
+ }
+
+ if (__lfsck_set_speed(lfsck, LFSCK_SPEED_NO_LIMIT))
+ dirty = true;
+
+ if (bk->lb_async_windows != LFSCK_ASYNC_WIN_DEFAULT) {
+ bk->lb_async_windows = LFSCK_ASYNC_WIN_DEFAULT;
+ dirty = true;
+ }
+ } else {
+ if ((bk->lb_param & LPF_ALL_TGT) &&
+ !(start->ls_flags & LPF_ALL_TGT)) {
+ bk->lb_param &= ~LPF_ALL_TGT;
+ dirty = true;
+ } else if (!(bk->lb_param & LPF_ALL_TGT) &&
+ (start->ls_flags & LPF_ALL_TGT)) {
+ bk->lb_param |= LPF_ALL_TGT;
+ dirty = true;
+ }
+
+ if ((start->ls_valid & LSV_CREATE_OSTOBJ) || reset) {
+ if ((bk->lb_param & LPF_CREATE_OSTOBJ) &&
+ !(start->ls_valid & LSV_CREATE_OSTOBJ)) {
+ bk->lb_param &= ~LPF_CREATE_OSTOBJ;
+ dirty = true;
+ } else if (!(bk->lb_param & LPF_CREATE_OSTOBJ) &&
+ (start->ls_flags & LPF_CREATE_OSTOBJ)) {
+ bk->lb_param |= LPF_CREATE_OSTOBJ;
+ dirty = true;
+ }
+ }
+
+ if ((start->ls_valid & LSV_ERROR_HANDLE) || reset) {
+ if ((bk->lb_param & LPF_FAILOUT) &&
+ !(start->ls_valid & LSV_ERROR_HANDLE)) {
+ bk->lb_param &= ~LPF_FAILOUT;
+ dirty = true;
+ } else if (!(start->ls_flags & LPF_FAILOUT) &&
+ (bk->lb_param & LPF_FAILOUT)) {
+ bk->lb_param &= ~LPF_FAILOUT;
+ dirty = true;
+ }
+ }
+
+ if ((start->ls_valid & LSV_DRYRUN) || reset) {
+ if ((bk->lb_param & LPF_DRYRUN) &&
+ !(start->ls_valid & LSV_DRYRUN)) {
+ bk->lb_param &= ~LPF_DRYRUN;
+ dirty = true;
+ } else if (!(start->ls_flags & LPF_DRYRUN) &&
+ (bk->lb_param & LPF_DRYRUN)) {
+ bk->lb_param &= ~LPF_DRYRUN;
+ lfsck->li_drop_dryrun = 1;
+ dirty = true;
+ }
+ }
+
+ if ((bk->lb_param & LPF_ORPHAN) &&
+ !(start->ls_flags & LPF_ORPHAN)) {
+ bk->lb_param &= ~LPF_ORPHAN;
+ dirty = true;
+ } else if (!(bk->lb_param & LPF_ORPHAN) &&
+ (start->ls_flags & LPF_ORPHAN)) {
+ bk->lb_param |= LPF_ORPHAN;
+ dirty = true;
+ }
+
+ if (start->ls_valid & LSV_SPEED_LIMIT) {
+ if (__lfsck_set_speed(lfsck, start->ls_speed_limit))
+ dirty = true;
+ } else if (reset) {
+ if (__lfsck_set_speed(lfsck, LFSCK_SPEED_NO_LIMIT))
+ dirty = true;
+ }
+
+ if (start->ls_valid & LSV_ASYNC_WINDOWS) {
+ if (bk->lb_async_windows != start->ls_async_windows) {
+ bk->lb_async_windows = start->ls_async_windows;
+ dirty = true;
+ }
+ } else if (reset &&
+ bk->lb_async_windows != LFSCK_ASYNC_WIN_DEFAULT) {
+ bk->lb_async_windows = LFSCK_ASYNC_WIN_DEFAULT;
+ dirty = true;
+ }
+ }
+
+ if (dirty)
+ rc = lfsck_bookmark_store(env, lfsck);
+
+ return rc;
+}
+
const char *prefix);
void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
struct lfsck_position *pos, bool init);
+bool __lfsck_set_speed(struct lfsck_instance *lfsck, __u32 limit);
void lfsck_control_speed(struct lfsck_instance *lfsck);
void lfsck_control_speed_by_self(struct lfsck_component *com);
int lfsck_reset(const struct lu_env *env, struct lfsck_instance *lfsck,
struct lfsck_instance *lfsck);
int lfsck_bookmark_setup(const struct lu_env *env,
struct lfsck_instance *lfsck);
+int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
+ struct lfsck_start *start, bool reset);
/* lfsck_namespace.c */
int lfsck_namespace_setup(const struct lu_env *env,
int rc;
rc = lfsck_layout_reset(env, com, false);
+ if (rc == 0)
+ rc = lfsck_set_param(env, lfsck, start, true);
+
if (rc != 0)
return rc;
}
}
}
-static void __lfsck_set_speed(struct lfsck_instance *lfsck, __u32 limit)
+bool __lfsck_set_speed(struct lfsck_instance *lfsck, __u32 limit)
{
- lfsck->li_bookmark_ram.lb_speed_limit = limit;
+ bool dirty = false;
+
if (limit != LFSCK_SPEED_NO_LIMIT) {
if (limit > HZ) {
lfsck->li_sleep_rate = limit / HZ;
lfsck->li_sleep_jif = 0;
lfsck->li_sleep_rate = 0;
}
+
+ if (lfsck->li_bookmark_ram.lb_speed_limit != limit) {
+ lfsck->li_bookmark_ram.lb_speed_limit = limit;
+ dirty = true;
+ }
+
+ return dirty;
}
void lfsck_control_speed(struct lfsck_instance *lfsck)
lfsck = lfsck_instance_find(key, true, false);
if (likely(lfsck != NULL)) {
mutex_lock(&lfsck->li_mutex);
- __lfsck_set_speed(lfsck, val);
- rc = lfsck_bookmark_store(&env, lfsck);
+ if (__lfsck_set_speed(lfsck, val))
+ rc = lfsck_bookmark_store(&env, lfsck);
mutex_unlock(&lfsck->li_mutex);
lfsck_instance_put(&env, lfsck);
} else {
lfsck = lfsck_instance_find(key, true, false);
if (likely(lfsck != NULL)) {
if (val > LFSCK_ASYNC_WIN_MAX) {
- CERROR("%s: 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 requests pipeline, "
- "just set it as 0.\n",
- lfsck_lfsck2name(lfsck), LFSCK_ASYNC_WIN_MAX);
+ CWARN("%s: Too large async window size, which "
+ "may cause memory issues. The valid range "
+ "is [0 - %u]. If you do not want to restrict "
+ "the window size for async requests pipeline, "
+ "just set it as 0.\n",
+ lfsck_lfsck2name(lfsck), LFSCK_ASYNC_WIN_MAX);
rc = -EINVAL;
} else if (lfsck->li_bookmark_ram.lb_async_windows != val) {
mutex_lock(&lfsck->li_mutex);
struct lfsck_component *com;
struct l_wait_info lwi = { 0 };
struct lfsck_thread_args *lta;
- bool dirty = false;
long rc = 0;
__u16 valid = 0;
__u16 flags = 0;
}
start->ls_version = bk->lb_version;
- if (start->ls_valid & LSV_SPEED_LIMIT) {
- __lfsck_set_speed(lfsck, start->ls_speed_limit);
- dirty = true;
- }
-
- if (start->ls_valid & LSV_ASYNC_WINDOWS &&
- bk->lb_async_windows != start->ls_async_windows) {
- bk->lb_async_windows = start->ls_async_windows;
- dirty = true;
- }
-
- if (start->ls_valid & LSV_ERROR_HANDLE) {
- valid |= DOIV_ERROR_HANDLE;
- if (start->ls_flags & LPF_FAILOUT)
- flags |= DOIF_FAILOUT;
-
- if ((start->ls_flags & LPF_FAILOUT) &&
- !(bk->lb_param & LPF_FAILOUT)) {
- bk->lb_param |= LPF_FAILOUT;
- dirty = true;
- } else if (!(start->ls_flags & LPF_FAILOUT) &&
- (bk->lb_param & LPF_FAILOUT)) {
- bk->lb_param &= ~LPF_FAILOUT;
- dirty = true;
- }
- }
-
- if (start->ls_valid & LSV_DRYRUN) {
- valid |= DOIV_DRYRUN;
- if (start->ls_flags & LPF_DRYRUN)
- flags |= DOIF_DRYRUN;
-
- if ((start->ls_flags & LPF_DRYRUN) &&
- !(bk->lb_param & LPF_DRYRUN)) {
- bk->lb_param |= LPF_DRYRUN;
- dirty = true;
- } else if (!(start->ls_flags & LPF_DRYRUN) &&
- (bk->lb_param & LPF_DRYRUN)) {
- bk->lb_param &= ~LPF_DRYRUN;
- lfsck->li_drop_dryrun = 1;
- dirty = true;
- }
- }
-
- if (bk->lb_param & LPF_ALL_TGT &&
- !(start->ls_flags & LPF_ALL_TGT)) {
- bk->lb_param &= ~LPF_ALL_TGT;
- dirty = true;
- } else if (!(bk->lb_param & LPF_ALL_TGT) &&
- start->ls_flags & LPF_ALL_TGT) {
- bk->lb_param |= LPF_ALL_TGT;
- dirty = true;
- }
-
- if (bk->lb_param & LPF_ORPHAN &&
- !(start->ls_flags & LPF_ORPHAN)) {
- bk->lb_param &= ~LPF_ORPHAN;
- dirty = true;
- } else if (!(bk->lb_param & LPF_ORPHAN) &&
- start->ls_flags & LPF_ORPHAN) {
- bk->lb_param |= LPF_ORPHAN;
- dirty = true;
- }
-
- if (start->ls_valid & LSV_CREATE_OSTOBJ) {
- if (bk->lb_param & LPF_CREATE_OSTOBJ &&
- !(start->ls_flags & LPF_CREATE_OSTOBJ)) {
- bk->lb_param &= ~LPF_CREATE_OSTOBJ;
- dirty = true;
- } else if (!(bk->lb_param & LPF_CREATE_OSTOBJ) &&
- start->ls_flags & LPF_CREATE_OSTOBJ) {
- bk->lb_param |= LPF_CREATE_OSTOBJ;
- dirty = true;
- }
- }
-
- if (dirty) {
- rc = lfsck_bookmark_store(env, lfsck);
- if (rc != 0)
- GOTO(out, rc);
- }
-
- if (start->ls_flags & LPF_RESET)
- flags |= DOIF_RESET;
if (start->ls_active != 0) {
struct lfsck_component *next;
GOTO(out, rc = -ENOTSUPP);
}
- cfs_list_for_each_entry_safe(com, next,
- &lfsck->li_list_scan, lc_link) {
+ list_for_each_entry_safe(com, next,
+ &lfsck->li_list_scan, lc_link) {
if (!(com->lc_type & start->ls_active)) {
rc = com->lc_ops->lfsck_post(env, com, 0,
false);
/* The component status will be updated
* when its prep() is called later by
* the LFSCK main engine. */
- cfs_list_del_init(&com->lc_link);
- cfs_list_add_tail(&com->lc_link,
- &lfsck->li_list_scan);
+ list_del_init(&com->lc_link);
+ list_add_tail(&com->lc_link,
+ &lfsck->li_list_scan);
}
start->ls_active &= ~type;
}
}
}
- cfs_list_for_each_entry(com, &lfsck->li_list_scan, lc_link) {
+ if (list_empty(&lfsck->li_list_scan)) {
+ /* The speed limit will be used to control both the LFSCK and
+ * low layer scrub (if applied), need to be handled firstly. */
+ if (start->ls_valid & LSV_SPEED_LIMIT) {
+ if (__lfsck_set_speed(lfsck, start->ls_speed_limit)) {
+ rc = lfsck_bookmark_store(env, lfsck);
+ if (rc != 0)
+ GOTO(out, rc);
+ }
+ }
+
+ goto trigger;
+ }
+
+ if (start->ls_flags & LPF_RESET)
+ flags |= DOIF_RESET;
+
+ rc = lfsck_set_param(env, lfsck, start, !!(flags & DOIF_RESET));
+ if (rc != 0)
+ GOTO(out, rc);
+
+ list_for_each_entry(com, &lfsck->li_list_scan, lc_link) {
start->ls_active |= com->lc_type;
if (flags & DOIF_RESET) {
rc = com->lc_ops->lfsck_reset(env, com, false);
trigger:
lfsck->li_args_dir = LUDA_64BITHASH | LUDA_VERIFY;
- if (bk->lb_param & LPF_DRYRUN) {
+ if (bk->lb_param & LPF_DRYRUN)
lfsck->li_args_dir |= LUDA_VERIFY_DRYRUN;
- valid |= DOIV_DRYRUN;
- flags |= DOIF_DRYRUN;
- }
- if (bk->lb_param & LPF_FAILOUT) {
+ if (start != NULL && start->ls_valid & LSV_ERROR_HANDLE) {
valid |= DOIV_ERROR_HANDLE;
- flags |= DOIF_FAILOUT;
+ if (start->ls_flags & LPF_FAILOUT)
+ flags |= DOIF_FAILOUT;
+ }
+
+ if (start != NULL && start->ls_valid & LSV_DRYRUN) {
+ valid |= DOIV_DRYRUN;
+ if (start->ls_flags & LPF_DRYRUN)
+ flags |= DOIF_DRYRUN;
}
- if (!cfs_list_empty(&lfsck->li_list_scan))
+ if (!list_empty(&lfsck->li_list_scan))
flags |= DOIF_OUTUSED;
lfsck->li_args_oit = (flags << DT_OTABLE_IT_FLAGS_SHIFT) | valid;
if (IS_ERR(lta))
GOTO(out, rc = PTR_ERR(lta));
+ __lfsck_set_speed(lfsck, bk->lb_speed_limit);
rc = PTR_ERR(kthread_run(lfsck_master_engine, lta, "lfsck"));
if (IS_ERR_VALUE(rc)) {
CERROR("%s: cannot start LFSCK thread: rc = %ld\n",
int rc;
rc = lfsck_namespace_reset(env, com, false);
+ if (rc == 0)
+ rc = lfsck_set_param(env, lfsck, lsp->lsp_start, true);
+
if (rc != 0)
return rc;
}
}
spin_unlock(&scrub->os_lock);
- if (scrub->os_file.sf_status == SS_COMPLETED)
+ if (scrub->os_file.sf_status == SS_COMPLETED) {
+ if (!(flags & SS_SET_FAILOUT))
+ flags |= SS_CLEAR_FAILOUT;
+
+ if (!(flags & SS_SET_DRYRUN))
+ flags |= SS_CLEAR_DRYRUN;
+
flags |= SS_RESET;
+ }
scrub->os_start_flags = flags;
thread_set_flags(thread, 0);
# run under normal mode
#
# Lustre-2.x (x <= 5) used "-n off" to disable dryrun which does not
- # work under Lustre-2.y (y >=6), the test scripts should be fixed as
- # "-noff" or "--dryrun=off".
- scrub_start 15 --dryrun=off
+ # work under Lustre-2.y (y >= 6), the test script should be fixed as
+ # "-noff" or "--dryrun=off" or nothing by default.
+ scrub_start 15
scrub_check_status 16 completed
scrub_check_flags 17 ""
scrub_check_params 18 ""
scrub_check_repaired 19 20
# run under normal mode again
- scrub_start 20 --dryrun=off
+ scrub_start 20
scrub_check_status 21 completed
scrub_check_flags 22 ""
scrub_check_params 23 ""
{"==== LFSCK ====", jt_noop, 0, "LFSCK"},
{"lfsck_start", jt_lfsck_start, 0, "start LFSCK\n"
"usage: lfsck_start <-M | --device [MDT,OST]_device>\n"
- " [-A | --all] [-c | --create_ostobj [swtich]]\n"
- " [-e | --error error_handle] [-h | --help]\n"
- " [-n | --dryrun [switch]] [-o | --orphan]\n"
+ " [-A | --all] [-c | --create_ostobj [on | off]]\n"
+ " [-e | --error {continue | abort}] [-h | --help]\n"
+ " [-n | --dryrun [on | off]] [-o | --orphan]\n"
" [-r | --reset] [-s | --speed speed_limit]\n"
" [-t | --type lfsck_type[,lfsck_type...]]\n"
- " [-w | --windows win_size]"},
+ " [-w | --window_size size]"},
{"lfsck_stop", jt_lfsck_stop, 0, "stop lfsck(s)\n"
"usage: lfsck_stop <-M | --device [MDT,OST]_device>\n"
" [-A | --all] [-h | --help]"},
{"reset", no_argument, 0, 'r'},
{"speed", required_argument, 0, 's'},
{"type", required_argument, 0, 't'},
- {"windows", required_argument, 0, 'w'},
+ {"window_size", required_argument, 0, 'w'},
{0, 0, 0, 0 }
};
fprintf(stderr, "Start LFSCK.\n"
"SYNOPSIS:\n"
"lfsck_start <-M | --device [MDT,OST]_device>\n"
- " [-A | --all] [-c | --create_ostobj [swtich]]\n"
- " [-e | --error error_handle] [-h | --help]\n"
- " [-n | --dryrun [switch]] [-o | --orphan]\n"
+ " [-A | --all] [-c | --create_ostobj [on | off]]\n"
+ " [-e | --error {continue | abort}] [-h | --help]\n"
+ " [-n | --dryrun [on | off]] [-o | --orphan]\n"
" [-r | --reset] [-s | --speed speed_limit]\n"
" [-t | --type lfsck_type[,lfsck_type...]]\n"
- " [-w | --windows win_size]\n"
+ " [-w | --window_size size]\n"
"OPTIONS:\n"
"-M: The device to start LFSCK/scrub on.\n"
"-A: Start LFSCK on all MDT devices.\n"
- "-c: create the lost OST-object for dangling LOV EA. "
+ "-c: Create the lost OST-object for dangling LOV EA: "
"'off'(default) or 'on'.\n"
"-e: Error handle, 'continue'(default) or 'abort'.\n"
"-h: Help information.\n"
"-n: Check without modification. 'off'(default) or 'on'.\n"
- "-o: handle orphan objects.\n"
+ "-o: Handle orphan objects.\n"
"-r: Reset scanning start position to the device beginning.\n"
+ " The non-specified parameters will be reset as default.\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"
- "-w: The windows size for async requests pipeline.\n",
+ "-w: The window size for async requests pipeline.\n",
LFSCK_SPEED_NO_LIMIT);
}
char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
char device[MAX_OBD_NAME];
struct lfsck_start start;
- char *optstring = "M:Ac::e:hn::ors:t:w:";
+ char *optstring = "Ac::e:hM:n::ors:t:w:";
int opt, index, rc, val, i, type;
memset(&data, 0, sizeof(data));
while ((opt = getopt_long(argc, argv, optstring, long_opt_start,
&index)) != EOF) {
switch (opt) {
- case 'M':
- rc = lfsck_pack_dev(&data, device, optarg);
- if (rc != 0)
- return rc;
- break;
case 'A':
start.ls_flags |= LPF_ALL_TGT | LPF_BROADCAST;
break;
case 'h':
usage_start();
return 0;
+ case 'M':
+ rc = lfsck_pack_dev(&data, device, optarg);
+ if (rc != 0)
+ return rc;
+ break;
case 'n':
if (optarg == NULL || strcmp(optarg, "on") == 0) {
start.ls_flags |= LPF_DRYRUN;
val = atoi(optarg);
if (val < 0 || val > LFSCK_ASYNC_WIN_MAX) {
fprintf(stderr,
- "Too large async windows size, "
+ "Too large async window 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 "
+ "the window size for async reqeusts "
"pipeline, just set it as 0.\n",
LFSCK_ASYNC_WIN_MAX);
return -EINVAL;
char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
char device[MAX_OBD_NAME];
struct lfsck_stop stop;
- char *optstring = "M:Ah";
+ char *optstring = "AhM:";
int opt, index, rc;
memset(&data, 0, sizeof(data));
while ((opt = getopt_long(argc, argv, optstring, long_opt_stop,
&index)) != EOF) {
switch (opt) {
- case 'M':
- rc = lfsck_pack_dev(&data, device, optarg);
- if (rc != 0)
- return rc;
- break;
case 'A':
stop.ls_flags |= LPF_ALL_TGT | LPF_BROADCAST;
break;
case 'h':
usage_stop();
return 0;
+ case 'M':
+ rc = lfsck_pack_dev(&data, device, optarg);
+ if (rc != 0)
+ return rc;
+ break;
default:
fprintf(stderr, "Invalid option, '-h' for help.\n");
return -EINVAL;