Whamcloud - gitweb
LU-5518 lfsck: recover orphans from backend lost+found
[fs/lustre-release.git] / lustre / lfsck / lfsck_internal.h
index a00f451..1ce764e 100644 (file)
@@ -111,6 +111,8 @@ struct lfsck_bookmark {
 enum lfsck_namespace_trace_flags {
        LNTF_CHECK_LINKEA       = 0x01,
        LNTF_CHECK_PARENT       = 0x02,
+       LNTF_SKIP_NLINK         = 0x04,
+       LNTF_CHECK_ORPHAN       = 0x08,
        LNTF_ALL                = 0xff
 };
 
@@ -219,8 +221,26 @@ struct lfsck_namespace {
        /* How many lost name entries have been re-inserted. */
        __u64   ln_lost_dirent_repaired;
 
+       /* How many objects under /lost+found have been scanned. */
+       __u64   ln_local_lpf_scanned;
+
+       /* How many objects under /lost+found have been moved to
+        * namespace visible directory. */
+       __u64   ln_local_lpf_moved;
+
+       /* How many objects under /lost+found have been skipped. */
+       __u64   ln_local_lpf_skipped;
+
+       /* How many objects under /lost+found failed to be processed. */
+       __u64   ln_local_lpf_failed;
+
+       /* The size of MDT targets bitmap with nbits. Such bitmap records
+        * the MDTs that contain non-verified MDT-objects. */
+       __u32   ln_bitmap_size;
+
+       __u32   ln_reserved_1;
        /* For further using. 256-bytes aligned now. */
-       __u64   ln_reserved[26];
+       __u64   ln_reserved[25];
 };
 
 enum lfsck_layout_inconsistency_type {
@@ -354,7 +374,8 @@ struct lfsck_operations {
 
        int (*lfsck_in_notify)(const struct lu_env *env,
                               struct lfsck_component *com,
-                              struct lfsck_request *lr);
+                              struct lfsck_request *lr,
+                              struct thandle *th);
 
        int (*lfsck_query)(const struct lu_env *env,
                           struct lfsck_component *com);
@@ -382,7 +403,8 @@ struct lfsck_tgt_desc {
        __u32              ltd_namespace_gen;
        unsigned int       ltd_dead:1,
                           ltd_layout_done:1,
-                          ltd_namespace_done:1;
+                          ltd_namespace_done:1,
+                          ltd_namespace_failed:1;
 };
 
 struct lfsck_tgt_desc_idx {
@@ -749,6 +771,7 @@ void lfsck_quit_generic(const struct lu_env *env,
                        struct lfsck_component *com);
 
 /* lfsck_engine.c */
+int lfsck_unpack_ent(struct lu_dirent *ent, __u64 *cookie, __u16 *type);
 int lfsck_master_engine(void *args);
 int lfsck_assistant_engine(void *args);
 
@@ -1098,11 +1121,15 @@ static inline void lfsck_lad_set_bitmap(const struct lu_env *env,
 
        LASSERT(com->lc_lfsck->li_master);
        LASSERT(bitmap != NULL);
-       LASSERTF(bitmap->size > index, "invalid index: nbits %d, index %u\n",
-                bitmap->size, index);
 
-       cfs_bitmap_set(bitmap, index);
-       lad->lad_incomplete = 1;
+       if (likely(bitmap->size > index)) {
+               cfs_bitmap_set(bitmap, index);
+               lad->lad_incomplete = 1;
+       } else if (com->lc_type == LFSCK_TYPE_NAMESPACE) {
+               struct lfsck_namespace *ns = com->lc_file_ram;
+
+               ns->ln_flags |= LF_INCOMPLETE;
+       }
 }
 
 static inline int lfsck_links_read(const struct lu_env *env,