Whamcloud - gitweb
LU-3950 lfsck: control LFSCK on all devices via single command
[fs/lustre-release.git] / lustre / lfsck / lfsck_internal.h
index 038c350..01d3c60 100644 (file)
@@ -252,6 +252,8 @@ struct lfsck_layout {
 };
 
 struct lfsck_component;
+struct lfsck_tgt_descs;
+struct lfsck_tgt_desc;
 
 struct lfsck_operations {
        int (*lfsck_reset)(const struct lu_env *env,
@@ -267,7 +269,8 @@ struct lfsck_operations {
                                bool init);
 
        int (*lfsck_prep)(const struct lu_env *env,
-                         struct lfsck_component *com);
+                         struct lfsck_component *com,
+                         struct lfsck_start_param *lsp);
 
        int (*lfsck_exec_oit)(const struct lu_env *env,
                              struct lfsck_component *com,
@@ -296,6 +299,23 @@ struct lfsck_operations {
 
        void (*lfsck_quit)(const struct lu_env *env,
                           struct lfsck_component *com);
+
+       int (*lfsck_in_notify)(const struct lu_env *env,
+                              struct lfsck_component *com,
+                              struct lfsck_request *lr);
+
+       int (*lfsck_query)(const struct lu_env *env,
+                          struct lfsck_component *com);
+
+       int (*lfsck_stop_notify)(const struct lu_env *env,
+                                struct lfsck_component *com,
+                                struct lfsck_tgt_descs *ltds,
+                                struct lfsck_tgt_desc *ltd,
+                                struct ptlrpc_request_set *set);
+
+       int (*lfsck_join)(const struct lu_env *env,
+                         struct lfsck_component *com,
+                         struct lfsck_start_param *lsp);
 };
 
 #define TGT_PTRS               256     /* number of pointers at 1st level */
@@ -307,8 +327,12 @@ struct lfsck_tgt_desc {
        struct dt_device  *ltd_key;
        struct obd_export *ltd_exp;
        struct list_head   ltd_layout_list;
+       struct list_head   ltd_layout_phase_list;
        atomic_t           ltd_ref;
        __u32              ltd_index;
+       __u32              ltd_layout_gen;
+       unsigned int       ltd_dead:1,
+                          ltd_layout_done:1;
 };
 
 struct lfsck_tgt_desc_idx {
@@ -413,6 +437,7 @@ struct lfsck_instance {
        void                     *li_out_notify_data;
        struct dt_device         *li_next;
        struct dt_device         *li_bottom;
+       struct obd_device        *li_obd;
        struct ldlm_namespace    *li_namespace;
        struct local_oid_storage *li_los;
        struct lu_fid             li_local_root_fid;  /* backend root "/" */
@@ -458,8 +483,13 @@ struct lfsck_instance {
        /* How many objects have been scanned since last sleep. */
        __u32                     li_new_scanned;
 
-       unsigned int              li_paused:1, /* The lfsck is paused. */
-                                 li_oit_over:1, /* oit is finished. */
+       /* The status when the LFSCK stopped or paused. */
+       __u32                     li_status;
+
+       /* The flags when the lFSCK stopped or paused. */
+       __u32                     li_flags;
+
+       unsigned int              li_oit_over:1, /* oit is finished. */
                                  li_drop_dryrun:1, /* Ever dryrun, not now. */
                                  li_master:1, /* Master instance or not. */
                                  li_current_oit_processed:1;
@@ -473,10 +503,18 @@ enum lfsck_linkea_flags {
        LLF_REPAIR_FAILED       = 0x02,
 };
 
+struct lfsck_async_interpret_args {
+       struct lfsck_component          *laia_com;
+       struct lfsck_tgt_descs          *laia_ltds;
+       struct lfsck_tgt_desc           *laia_ltd;
+       struct lfsck_request            *laia_lr;
+};
+
 struct lfsck_thread_args {
-       struct lu_env            lta_env;
-       struct lfsck_instance   *lta_lfsck;
-       struct lfsck_component  *lta_com;
+       struct lu_env                    lta_env;
+       struct lfsck_instance           *lta_lfsck;
+       struct lfsck_component          *lta_com;
+       struct lfsck_start_param        *lta_lsp;
 };
 
 struct lfsck_thread_info {
@@ -498,6 +536,8 @@ struct lfsck_thread_info {
        struct lu_dirent        lti_ent;
        char                    lti_key[NAME_MAX + 16];
        struct lfsck_request    lti_lr;
+       struct lfsck_async_interpret_args lti_laia;
+       struct lfsck_stop       lti_stop;
 };
 
 /* lfsck_lib.c */
@@ -518,12 +558,14 @@ void lfsck_control_speed_by_self(struct lfsck_component *com);
 int lfsck_reset(const struct lu_env *env, struct lfsck_instance *lfsck,
                bool init);
 struct lfsck_thread_args *lfsck_thread_args_init(struct lfsck_instance *lfsck,
-                                                struct lfsck_component *com);
+                                                struct lfsck_component *com,
+                                                struct lfsck_start_param *lsp);
 void lfsck_thread_args_fini(struct lfsck_thread_args *lta);
 void lfsck_fail(const struct lu_env *env, struct lfsck_instance *lfsck,
                bool new_checked);
 int lfsck_checkpoint(const struct lu_env *env, struct lfsck_instance *lfsck);
-int lfsck_prep(const struct lu_env *env, struct lfsck_instance *lfsck);
+int lfsck_prep(const struct lu_env *env, struct lfsck_instance *lfsck,
+              struct lfsck_start_param *lsp);
 int lfsck_exec_oit(const struct lu_env *env, struct lfsck_instance *lfsck,
                   struct dt_object *obj);
 int lfsck_exec_dir(const struct lu_env *env, struct lfsck_instance *lfsck,
@@ -532,6 +574,11 @@ int lfsck_post(const struct lu_env *env, struct lfsck_instance *lfsck,
               int result);
 int lfsck_double_scan(const struct lu_env *env, struct lfsck_instance *lfsck);
 void lfsck_quit(const struct lu_env *env, struct lfsck_instance *lfsck);
+int lfsck_async_request(const struct lu_env *env, struct obd_export *exp,
+                       struct lfsck_request *lr,
+                       struct ptlrpc_request_set *set,
+                       ptlrpc_interpterer_t interpterer,
+                       void *args, int request);
 
 /* lfsck_engine.c */
 int lfsck_master_engine(void *args);