4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License version 2 for more details. A copy is
14 * included in the COPYING file that accompanied this code.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Copyright (c) 2013, Intel Corporation.
26 * lustre/include/lustre_lfsck.h
28 * Lustre LFSCK exported functions.
30 * Author: Fan, Yong <fan.yong@intel.com>
33 #ifndef _LUSTRE_LFSCK_H
34 # define _LUSTRE_LFSCK_H
36 #include <lustre/lustre_lfsck_user.h>
37 #include <lustre_dlm.h>
38 #include <lu_object.h>
39 #include <dt_object.h>
55 * -----------------------------------------------------------------
59 * LS_SCANNING_PHASE2 LS_FAILED LS_STOPPED LS_PAUSED LS_CRASHED LS_PARTIAL
63 * | (lfsck:restart) |: |: |: |: |:
65 * -----------------------------------------------------------------
71 /* The lfsck file is new created, for new MDT, upgrading from old disk,
72 * or re-creating the lfsck file manually. */
75 /* The first-step system scanning. */
76 LS_SCANNING_PHASE1 = 1,
78 /* The second-step system scanning. */
79 LS_SCANNING_PHASE2 = 2,
81 /* The LFSCK processing has completed for all objects. */
84 /* The LFSCK exited automatically for failure, will not auto restart. */
87 /* The LFSCK is stopped manually, will not auto restart. */
90 /* LFSCK is paused automatically when umount,
91 * will be restarted automatically when remount. */
94 /* System crashed during the LFSCK,
95 * will be restarted automatically after recovery. */
98 /* Some OST/MDT failed during the LFSCK, or not join the LFSCK. */
101 /* The LFSCK is failed because its controller is failed. */
104 /* The LFSCK is stopped because its controller is stopped. */
107 /* The LFSCK is paused because its controller is paused. */
113 struct lfsck_start_param {
114 struct lfsck_start *lsp_start;
116 unsigned int lsp_index_valid:1;
119 /* For LE_PAIRS_VERIFY returned status */
120 enum lfsck_pv_status {
122 LPVS_INCONSISTENT = 1,
123 LPVS_INCONSISTENT_TOFIX = 2,
126 typedef int (*lfsck_out_notify)(const struct lu_env *env, void *data,
127 enum lfsck_events event);
129 int lfsck_register_namespace(const struct lu_env *env, struct dt_device *key,
130 struct ldlm_namespace *ns);
131 int lfsck_register(const struct lu_env *env, struct dt_device *key,
132 struct dt_device *next, struct obd_device *obd,
133 lfsck_out_notify notify, void *notify_data, bool master);
134 void lfsck_degister(const struct lu_env *env, struct dt_device *key);
136 int lfsck_add_target(const struct lu_env *env, struct dt_device *key,
137 struct dt_device *tgt, struct obd_export *exp,
138 __u32 index, bool for_ost);
139 void lfsck_del_target(const struct lu_env *env, struct dt_device *key,
140 struct dt_device *tgt, __u32 index, bool for_ost);
142 int lfsck_start(const struct lu_env *env, struct dt_device *key,
143 struct lfsck_start_param *lsp);
144 int lfsck_stop(const struct lu_env *env, struct dt_device *key,
145 struct lfsck_stop *stop);
146 int lfsck_in_notify(const struct lu_env *env, struct dt_device *key,
147 struct lfsck_request *lr, struct thandle *th);
148 int lfsck_query(const struct lu_env *env, struct dt_device *key,
149 struct lfsck_request *lr);
151 int lfsck_get_speed(struct seq_file *m, struct dt_device *key);
152 int lfsck_set_speed(struct dt_device *key, int val);
153 int lfsck_get_windows(struct seq_file *m, struct dt_device *key);
154 int lfsck_set_windows(struct dt_device *key, int val);
156 int lfsck_dump(struct seq_file *m, struct dt_device *key, enum lfsck_type type);
158 static inline void lfsck_pack_rfa(struct lfsck_request *lr,
159 const struct lu_fid *fid,
160 __u32 event, __u16 com)
162 memset(lr, 0, sizeof(*lr));
164 lr->lr_event = event;
168 #endif /* _LUSTRE_LFSCK_H */