Whamcloud - gitweb
LU-13439 lmv: qos stay on current MDT if less full
[fs/lustre-release.git] / lustre / lfsck / lfsck_striped_dir.c
index e451a38..2980277 100644 (file)
@@ -168,14 +168,13 @@ void lfsck_lmv_put(const struct lu_env *env, struct lfsck_lmv *llmv)
 
                        LASSERT(llmv->ll_lslr != NULL);
 
-                       OBD_FREE_LARGE(llmv->ll_lslr,
-                                      sizeof(*llmv->ll_lslr) *
-                                      llmv->ll_stripes_allocated);
+                       OBD_FREE_PTR_ARRAY_LARGE(llmv->ll_lslr,
+                                                llmv->ll_stripes_allocated);
                        OBD_FREE_PTR(llu);
                } else {
                        if (llmv->ll_lslr != NULL)
-                               OBD_FREE_LARGE(llmv->ll_lslr,
-                                       sizeof(*llmv->ll_lslr) *
+                               OBD_FREE_PTR_ARRAY_LARGE(
+                                       llmv->ll_lslr,
                                        llmv->ll_stripes_allocated);
 
                        OBD_FREE_PTR(llmv);
@@ -510,7 +509,7 @@ static int lfsck_record_lmv(const struct lu_env *env,
                int new_stripes = index + 1;
                size_t old_size = sizeof(*lslr) * llmv->ll_stripes_allocated;
 
-               OBD_ALLOC_LARGE(new_lslr, sizeof(*new_lslr) * new_stripes);
+               OBD_ALLOC_PTR_ARRAY_LARGE(new_lslr, new_stripes);
                if (new_lslr == NULL) {
                        llmv->ll_failed = 1;
 
@@ -980,7 +979,7 @@ static inline bool lfsck_name_hash_match(struct lmv_mds_md_v1 *lmv,
        if (idx == lmv->lmv_master_mdt_index)
                return true;
 
-       if (!(lmv->lmv_hash_type & LMV_HASH_FLAG_LAYOUT_CHANGE))
+       if (!lmv_hash_is_layout_changing(lmv->lmv_hash_type))
                return false;
 
        idx = lmv_name_to_stripe_index(lmv, name, namelen);
@@ -1360,7 +1359,7 @@ int lfsck_namespace_notify_lmv_master_local(const struct lu_env *env,
        else
                count = lmv4->lmv_stripe_count;
 
-       OBD_ALLOC_LARGE(lslr, sizeof(*lslr) * count);
+       OBD_ALLOC_PTR_ARRAY_LARGE(lslr, count);
        if (lslr == NULL) {
                OBD_FREE_PTR(llu);
 
@@ -1553,8 +1552,7 @@ int lfsck_namespace_repair_bad_name_hash(const struct lu_env *env,
        int                              rc     = 0;
        ENTRY;
 
-       rc = dt_lookup(env, shard, (struct dt_rec *)pfid,
-                      (const struct dt_key *)dotdot);
+       rc = dt_lookup_dir(env, shard, dotdot, pfid);
        if (rc != 0 || !fid_is_sane(pfid))
                GOTO(log, rc);
 
@@ -1763,8 +1761,7 @@ int lfsck_namespace_verify_stripe_slave(const struct lu_env *env,
                GOTO(out, rc);
        }
 
-       rc = dt_lookup(env, obj, (struct dt_rec *)pfid,
-                      (const struct dt_key *)dotdot);
+       rc = dt_lookup_dir(env, obj, dotdot, pfid);
        if (rc != 0 || !fid_is_sane(pfid)) {
                rc = lfsck_namespace_trace_update(env, com, cfid,
                                        LNTF_UNCERTAIN_LMV, true);
@@ -1844,8 +1841,7 @@ int lfsck_namespace_verify_stripe_slave(const struct lu_env *env,
                GOTO(out, rc);
        }
 
-       rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
-                      (const struct dt_key *)name2);
+       rc = dt_lookup_dir(env, parent, name2, &tfid);
        if (rc != 0 || !lu_fid_eq(cfid, &tfid))
                rc = lfsck_namespace_trace_update(env, com, cfid,
                                                  LNTF_UNCERTAIN_LMV, true);
@@ -1999,9 +1995,9 @@ int lfsck_namespace_striped_dir_rescan(const struct lu_env *env,
                        continue;
 
                lnr->lnr_fid = *cfid;
-               lnr->lnr_namelen = snprintf(lnr->lnr_name,
-                                           lnr->lnr_size - sizeof(*lnr),
-                                           DFID":%u", PFID(cfid), i);
+               lnr->lnr_namelen = scnprintf(lnr->lnr_name,
+                                            lnr->lnr_size - sizeof(*lnr),
+                                            DFID":%u", PFID(cfid), i);
                cname = lfsck_name_get_const(env, lnr->lnr_name,
                                             lnr->lnr_namelen);
                obj = lfsck_object_find_bottom(env, lfsck, cfid);
@@ -2230,17 +2226,22 @@ repair:
                }
 
 next:
-               CDEBUG(D_LFSCK, "%s: namespace LFSCK repair the shard "
-                     "%d "DFID" of the striped directory "DFID" with "
-                     "dangling %s/%s, rename %s/%s, llinkea %s/%s, "
-                     "repair_lmvea %s/%s: rc = %d\n", lfsck_lfsck2name(lfsck),
-                     i, PFID(cfid), PFID(pfid),
-                     create ? "yes" : "no", create_repaired ? "yes" : "no",
-                     rename ? "yes" : "no", rename_repaired ? "yes" : "no",
-                     repair_linkea ? "yes" : "no",
-                     linkea_repaired ? "yes" : "no",
-                     repair_lmvea ? "yes" : "no",
-                     lmvea_repaired ? "yes" : "no", rc1);
+               if (create || rename || repair_linkea || repair_lmvea) {
+                       CDEBUG(D_LFSCK, "%s: namespace LFSCK repair the shard "
+                              "%d "DFID" of the striped directory "DFID" with "
+                              "dangling %s/%s, rename %s/%s, llinkea %s/%s, "
+                              "repair_lmvea %s/%s: rc = %d\n",
+                              lfsck_lfsck2name(lfsck),
+                              i, PFID(cfid), PFID(pfid),
+                              create ? "yes" : "no",
+                              create_repaired ? "yes" : "no",
+                              rename ? "yes" : "no",
+                              rename_repaired ? "yes" : "no",
+                              repair_linkea ? "yes" : "no",
+                              linkea_repaired ? "yes" : "no",
+                              repair_lmvea ? "yes" : "no",
+                              lmvea_repaired ? "yes" : "no", rc1);
+               }
 
                if (obj != NULL && !IS_ERR(obj)) {
                        lfsck_object_put(env, obj);