Whamcloud - gitweb
LU-14119 lfsck: replace dt_lookup() with dt_lookup_dir()
[fs/lustre-release.git] / lustre / lfsck / lfsck_engine.c
index 3d0b80e..f9c65b8 100644 (file)
@@ -93,17 +93,6 @@ static void lfsck_di_dir_put(const struct lu_env *env, struct lfsck_instance *lf
        iops->put(env, di);
 }
 
-static int lfsck_parent_fid(const struct lu_env *env, struct dt_object *obj,
-                           struct lu_fid *fid)
-{
-       if (unlikely(!S_ISDIR(lfsck_object_type(obj)) ||
-                    !dt_try_as_dir(env, obj)))
-               return -ENOTDIR;
-
-       return dt_lookup(env, obj, (struct dt_rec *)fid,
-                        (const struct dt_key *)"..");
-}
-
 /**
  * Check whether needs to scan the directory or not.
  *
@@ -217,7 +206,7 @@ static int lfsck_needs_scan_dir(const struct lu_env *env,
                if (rc < 0 && rc != -ENODATA)
                        GOTO(out, rc);
 
-               rc = lfsck_parent_fid(env, obj, fid);
+               rc = dt_lookup_dir(env, obj, dotdot, fid);
                if (depth > 0)
                        lfsck_object_put(env, obj);
 
@@ -274,7 +263,7 @@ static int lfsck_load_stripe_lmv(const struct lu_env *env,
                else
                        stripes = lmv->lmv_stripe_count;
 
-               OBD_ALLOC_LARGE(lslr, sizeof(*lslr) * stripes);
+               OBD_ALLOC_PTR_ARRAY_LARGE(lslr, stripes);
                if (lslr == NULL) {
                        OBD_FREE_PTR(llmv);
 
@@ -1071,7 +1060,7 @@ int lfsck_master_engine(void *args)
               lfsck->li_pos_checkpoint.lp_oit_cookie,
               lfsck->li_pos_checkpoint.lp_dir_cookie,
               PFID(&lfsck->li_pos_checkpoint.lp_dir_parent),
-              current_pid());
+              current->pid);
 
        spin_lock(&lfsck->li_lock);
        if (unlikely(!thread_is_starting(thread))) {
@@ -1102,7 +1091,7 @@ int lfsck_master_engine(void *args)
               lfsck->li_pos_checkpoint.lp_oit_cookie,
               lfsck->li_pos_checkpoint.lp_dir_cookie,
               PFID(&lfsck->li_pos_checkpoint.lp_dir_parent),
-              current_pid(), rc);
+              current->pid, rc);
 
        if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_CRASH))
                rc = lfsck_post(env, lfsck, rc);
@@ -1583,7 +1572,7 @@ int lfsck_assistant_engine(void *args)
        struct lfsck_assistant_data       *lad     = com->lc_data;
        struct ptlrpc_thread              *mthread = &lfsck->li_thread;
        struct ptlrpc_thread              *athread = &lad->lad_thread;
-       struct lfsck_assistant_operations *lao     = lad->lad_ops;
+       const struct lfsck_assistant_operations *lao     = lad->lad_ops;
        struct lfsck_assistant_req        *lar;
        int                                rc      = 0;
        int                                rc1     = 0;