Whamcloud - gitweb
LU-3569 ofd: packing ost_idx in IDIF
[fs/lustre-release.git] / lustre / lfsck / lfsck_lib.c
index b5def07..a4c963c 100644 (file)
@@ -85,11 +85,6 @@ const char *lfsck_param_names[] = {
        NULL
 };
 
-static inline mdsno_t lfsck_dev_idx(struct dt_device *dev)
-{
-       return dev->dd_lu_dev.ld_site->ld_seq_site->ss_node_id;
-}
-
 static inline void lfsck_component_get(struct lfsck_component *com)
 {
        atomic_inc(&com->lc_ref);
@@ -206,11 +201,6 @@ static void lfsck_instance_cleanup(const struct lu_env *env,
                lfsck->li_los = NULL;
        }
 
-       if (lfsck->li_local_root != NULL) {
-               lu_object_put_nocache(env, &lfsck->li_local_root->do_lu);
-               lfsck->li_local_root = NULL;
-       }
-
        OBD_FREE_PTR(lfsck);
 }
 
@@ -481,8 +471,7 @@ static int lfsck_needs_scan_dir(const struct lu_env *env,
                if (rc != 0)
                        return rc;
 
-               if (unlikely(lu_fid_eq(fid,
-                                      lfsck_dto2fid(lfsck->li_local_root))))
+               if (unlikely(lu_fid_eq(fid, &lfsck->li_local_root_fid)))
                        return 0;
 
                obj = lfsck_object_find(env, lfsck, fid);
@@ -928,6 +917,10 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key,
        }
 
        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;
@@ -1000,8 +993,11 @@ int lfsck_start(const struct lu_env *env, struct dt_device *key,
 
 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) {
                valid |= DOIV_ERROR_HANDLE;
@@ -1061,7 +1057,7 @@ int lfsck_stop(const struct lu_env *env, struct dt_device *key, bool pause)
        thread_set_flags(thread, SVC_STOPPING);
        spin_unlock(&lfsck->li_lock);
 
-       cfs_waitq_broadcast(&thread->t_ctl_waitq);
+       wake_up_all(&thread->t_ctl_waitq);
        l_wait_event(thread->t_ctl_waitq,
                     thread_is_stopped(thread),
                     &lwi);
@@ -1076,7 +1072,7 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key,
                   struct dt_device *next, bool master)
 {
        struct lfsck_instance   *lfsck;
-       struct dt_object        *root;
+       struct dt_object        *root  = NULL;
        struct dt_object        *obj;
        struct lu_fid           *fid   = &lfsck_env_info(env)->lti_fid;
        int                      rc;
@@ -1098,7 +1094,7 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key,
        CFS_INIT_LIST_HEAD(&lfsck->li_list_double_scan);
        CFS_INIT_LIST_HEAD(&lfsck->li_list_idle);
        atomic_set(&lfsck->li_ref, 1);
-       cfs_waitq_init(&lfsck->li_thread.t_ctl_waitq);
+       init_waitqueue_head(&lfsck->li_thread.t_ctl_waitq);
        lfsck->li_next = next;
        lfsck->li_bottom = key;
 
@@ -1117,7 +1113,7 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key,
        if (IS_ERR(root))
                GOTO(out, rc = PTR_ERR(root));
 
-       lfsck->li_local_root = root;
+       lfsck->li_local_root_fid = *fid;
         dt_try_as_dir(env, root);
        if (master) {
                lfsck->li_master = 1;
@@ -1161,6 +1157,8 @@ int lfsck_register(const struct lu_env *env, struct dt_device *key,
 add:
        rc = lfsck_instance_add(lfsck);
 out:
+       if (root != NULL && !IS_ERR(root))
+               lu_object_put(env, &root->do_lu);
        if (rc != 0)
                lfsck_instance_cleanup(env, lfsck);
        return rc;