From: Arshad Hussain Date: Thu, 29 Feb 2024 00:41:08 +0000 (+0530) Subject: LU-6142 lfsck: Fix style issues for lfsck_striped_dir.c X-Git-Tag: 2.15.62~124 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ab7e5929f1dcad80e57c82d11cc8f6aac4f6b8f4;p=fs%2Flustre-release.git LU-6142 lfsck: Fix style issues for lfsck_striped_dir.c This patch fixes issues reported by checkpatch for file lustre/lfsck/lfsck_striped_dir.c Test-Parameters: trivial Signed-off-by: Arshad Hussain Change-Id: I6469e5973a5ee33c408ced48bb9ab162307fdf07 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54214 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Timothy Day Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/lfsck/lfsck_striped_dir.c b/lustre/lfsck/lfsck_striped_dir.c index 6cc6034..9d7680f5 100644 --- a/lustre/lfsck/lfsck_striped_dir.c +++ b/lustre/lfsck/lfsck_striped_dir.c @@ -200,14 +200,14 @@ static int lfsck_disable_master_lmv(const struct lu_env *env, struct lfsck_component *com, struct dt_object *obj, bool del_lmv) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lu_attr *la = &info->lti_la; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct dt_device *dev = lfsck_obj2dev(obj); - struct thandle *th = NULL; - int rc = 0; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lu_attr *la = &info->lti_la; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct dt_device *dev = lfsck_obj2dev(obj); + struct thandle *th = NULL; + int rc = 0; + ENTRY; if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN) GOTO(log, rc = 0); @@ -256,8 +256,8 @@ stop: dt_trans_stop(env, dev, th); log: - CDEBUG(D_LFSCK, "%s: namespace LFSCK set the master MDT-object of " - "the striped directory "DFID" as read-only: rc = %d\n", + CDEBUG(D_LFSCK, + "%s: namespace LFSCK set the master MDT-object of the striped directory "DFID" as read-only: rc = %d\n", lfsck_lfsck2name(lfsck), PFID(lfsck_dto2fid(obj)), rc); if (rc <= 0) { @@ -300,8 +300,8 @@ static int lfsck_remove_lmv(const struct lu_env *env, struct dt_object *obj, struct lfsck_namespace_req *lnr) { - struct lustre_handle lh = { 0 }; - int rc; + struct lustre_handle lh = { 0 }; + int rc; lnr->lnr_lmv->ll_ignore = 1; rc = lfsck_ibits_lock(env, com->lc_lfsck, obj, &lh, @@ -333,9 +333,9 @@ static int lfsck_remove_dirent(const struct lu_env *env, struct dt_object *dir, const struct lu_fid *fid, __u32 index) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct dt_object *obj; - int rc; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct dt_object *obj; + int rc; snprintf(info->lti_tmpbuf2, sizeof(info->lti_tmpbuf2), DFID":%u", PFID(fid), index); @@ -388,7 +388,7 @@ static int lfsck_replace_lmv(const struct lu_env *env, __u32 index, __u32 flags) { struct lfsck_lmv *llmv = lnr->lnr_lmv; - int rc; + int rc; rc = lfsck_remove_dirent(env, com, dir, &lslr->lslr_fid, index); @@ -486,19 +486,18 @@ static int lfsck_record_lmv(const struct lu_env *env, struct lmv_mds_md_v1 *lmv, __u32 shard_idx, __u32 flags, __u32 flags2, __u32 *depth) { - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lfsck_lmv *llmv = lnr->lnr_lmv; - const struct lu_fid *fid = &lnr->lnr_fid; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lfsck_lmv *llmv = lnr->lnr_lmv; + const struct lu_fid *fid = &lnr->lnr_fid; struct lfsck_slave_lmv_rec *lslr; struct lfsck_rec_lmv_save *lrls; - int index = shard_idx; - int rc = 0; - ENTRY; + int index = shard_idx; + int rc = 0; - CDEBUG(D_INFO, "%s: record slave LMV EA for the striped directory " - DFID": shard = "DFID", index = %u, flags = %u, flags2 = %u, " - "depth = %d\n", lfsck_lfsck2name(lfsck), - PFID(lfsck_dto2fid(dir)), PFID(fid), + ENTRY; + CDEBUG(D_INFO, + "%s: record slave LMV EA for the striped directory "DFID": shard = "DFID", index = %u, flags = %u, flags2 = %u, depth = %d\n", + lfsck_lfsck2name(lfsck), PFID(lfsck_dto2fid(dir)), PFID(fid), index, flags, flags2, *depth); if (index < 0 || index >= LFSCK_LMV_MAX_STRIPES) @@ -561,13 +560,13 @@ static int lfsck_record_lmv(const struct lu_env *env, /* The existing one is a normal valid object. */ switch (flags) { case LSLF_NONE: - /* The two 'valid' name entries claims the same - * index, the LFSCK cannot distinguish which one - * is correct. Then remove the master LMV EA to - * make all shards to be visible to client, and - * mark the master MDT-object as read-only. The - * administrator can handle the conflict with - * more human knowledge. */ + /* The two 'valid' name entries claims the same index, + * the LFSCK cannot distinguish which one is correct. + * Then remove the master LMV EA to make all shards to + * be visible to client, and mark the master MDT-object + * as read-only. The administrator can handle the + * conflict with more human knowledge. + */ rc = lfsck_remove_lmv(env, com, dir, lnr); break; case LSLF_BAD_INDEX2: @@ -577,21 +576,21 @@ static int lfsck_record_lmv(const struct lu_env *env, no_lmvea: if (llmv->ll_lmv.lmv_hash_type & LMV_HASH_FLAG_LOST_LMV) { - /* If the master LMV EA was re-generated - * by the former LFSCK reparation, and - * before such reparation, someone has - * created the conflict object, but the - * LFSCK did not detect such conflict, - * then we have to remove the master - * LMV EA and mark the master MDT-object - * as read-only. The administrator can - * handle the conflict with more human - * knowledge. */ + /* If the master LMV EA was re-generated by the + * former LFSCK reparation, and before such + * reparation, someone has created the conflict + * object, but the LFSCK did not detect such + * conflict, then we have to remove the master + * LMV EA and mark the master MDT-object as + * read-only. The administrator can handle the + * conflict with more human knowledge. + */ rc = lfsck_remove_lmv(env, com, dir, lnr); } else { /* Otherwise, remove the current name entry, * and add its FID in the LFSCK tracing file - * for further processing. */ + * for further processing. + */ rc = lfsck_namespace_trace_update(env, com, fid, LNTF_CHECK_PARENT, true); if (rc == 0) @@ -609,16 +608,17 @@ no_lmvea: lmv->lmv_master_mdt_index = shard_idx; /* The name entry claims an index that is conflict * with a valid existing name entry, then try the - * index in the lmv recursively. */ + * index in the lmv recursively. + */ rc = lfsck_record_lmv(env, com, dir, lnr, lmv, index, LSLF_BAD_INDEX2, lslr->lslr_flags, depth); lmv->lmv_master_mdt_index = index; if (rc == -ERANGE || rc == -EEXIST) - /* The index in the lmv is invalid or - * also conflict with other. Then we do - * not know how to resolve the conflict. - * We will handle it as handle the case - * of 'LSLF_NONE' vs 'LSLF_NONE'. */ + /* The index in the lmv is invalid or conflict + * with other. Then we do not know how to solve + * the conflict. We will handle it as handle the + * case of 'LSLF_NONE' vs 'LSLF_NONE'. + */ rc = lfsck_remove_lmv(env, com, dir, lnr); break; @@ -635,24 +635,24 @@ no_lmvea: none: if (llmv->ll_lmv.lmv_hash_type & LMV_HASH_FLAG_LOST_LMV) { - /* If the master LMV EA was re-generated - * by the former LFSCK reparation, and - * before such reparation, someone has - * created the conflict object, but the - * LFSCK did not detect such conflict, - * then we have to remove the master - * LMV EA and mark the master MDT-object - * as read-only. The administrator can - * handle the conflict with more human - * knowledge. */ + /* If the master LMV EA was re-generated by the + * former LFSCK reparation, and before such + * reparation, someone has created the conflict + * object, but the LFSCK did not detect such + * conflict, then we have to remove the master + * LMV EA and mark the master MDT-object as + * read-only. The administrator can handle the + * conflict with more human knowledge. + */ rc = lfsck_remove_lmv(env, com, dir, lnr); } else { lrls = &lfsck->li_rec_lmv_save[*depth - 1]; lrls->lrls_fid = lslr->lslr_fid; /* Otherwise, remove the existing name entry, - * and add its FID in the LFSCK tracing file - * for further processing. Refill the slot - * with current slave LMV EA. */ + * and add its FID in the LFSCK tracing file for + * further processing. Refill the slot with + * current slave LMV EA. + */ rc = lfsck_namespace_trace_update(env, com, &lrls->lrls_fid, LNTF_CHECK_PARENT, true); @@ -678,7 +678,8 @@ none: lmv->lmv_master_mdt_index = shard_idx; /* The name entry claims an index that is conflict * with a valid existing name entry, then try the - * index in the lmv recursively. */ + * index in the lmv recursively. + */ rc = lfsck_record_lmv(env, com, dir, lnr, lmv, index, LSLF_BAD_INDEX2, lslr->lslr_flags, depth); lmv->lmv_master_mdt_index = index; @@ -700,13 +701,15 @@ none: case LSLF_BAD_INDEX2: case LSLF_NO_LMVEA: /* Remove the existing dangling name entry. - * Refill the lslr slot with the given LMV. */ + * Refill the lslr slot with the given LMV. + */ rc = lfsck_replace_lmv(env, com, dir, lslr, lnr, lmv, index, flags); break; case LSLF_DANGLING: /* Two dangling name entries conflict, - * remove the current one. */ + * remove the current one. + */ rc = lfsck_remove_dirent(env, com, dir, fid, index); break; case LSLF_BAD_INDEX1: @@ -714,7 +717,8 @@ none: lmv->lmv_master_mdt_index = shard_idx; /* The name entry claims an index that is conflict * with a valid existing name entry, then try the - * index in the lmv recursively. */ + * index in the lmv recursively. + */ rc = lfsck_record_lmv(env, com, dir, lnr, lmv, index, LSLF_BAD_INDEX2, lslr->lslr_flags, depth); lmv->lmv_master_mdt_index = index; @@ -722,7 +726,8 @@ none: /* If the index in the lmv is invalid or * also conflict with other, then remove * the existing dangling name entry. - * Refill the lslr slot with the given LMV. */ + * Refill the lslr slot with the given LMV. + */ rc = lfsck_replace_lmv(env, com, dir, lslr, lnr, lmv, shard_idx, flags); @@ -746,8 +751,7 @@ none: lmv->lmv_hash_type = lslr->lslr_hash_type; index = lslr->lslr_index; - /* The existing one has another possible slot, - * try it recursively. */ + /* Existing one has another possible slot, try recursively. */ rc = lfsck_record_lmv(env, com, dir, lnr, lmv, index, LSLF_BAD_INDEX2, flags, depth); *lmv = lrls->lrls_lmv; @@ -787,7 +791,8 @@ conflict: * make all shards to be visible to client, and * mark the master MDT-object as read-only. The * administrator can handle the conflict with - * more human knowledge. */ + * more human knowledge. + */ rc = lfsck_remove_lmv(env, com, dir, lnr); break; case LSLF_BAD_INDEX2: @@ -803,16 +808,17 @@ conflict: lmv->lmv_master_mdt_index = shard_idx; /* The name entry claims an index that is conflict * with a valid existing name entry, then try the - * index in the lmv recursively. */ + * index in the lmv recursively. + */ rc = lfsck_record_lmv(env, com, dir, lnr, lmv, index, LSLF_BAD_INDEX2, lslr->lslr_flags, depth); lmv->lmv_master_mdt_index = index; if (rc == -ERANGE || rc == -EEXIST) - /* The index in the lmv is invalid or - * also conflict with other. Then we do - * not know how to resolve the conflict. - * We will handle it as handle the case - * of 'LSLF_NONE' vs 'LSLF_NONE'. */ + /* The index in the lmv is invalid or also + * conflict with other. Then we do not know how + * to resolve the conflict. We will handle it as + * handle the case of 'LSLF_NONE' vs 'LSLF_NONE' + */ rc = lfsck_remove_lmv(env, com, dir, lnr); break; @@ -913,7 +919,7 @@ int lfsck_read_stripe_lmv(const struct lu_env *env, lfsck_lmv_header_le_to_cpu(lmv, lmv); /* if LMV is corrupt, return -ENODATA */ if (lmv->lmv_magic != LMV_MAGIC_V1 && - lmv->lmv_magic != LMV_MAGIC_STRIPE) + lmv->lmv_magic != LMV_MAGIC_STRIPE) rc = -ENODATA; } else if (rc >= 0) { /* LMV is corrupt */ @@ -943,9 +949,9 @@ int lfsck_read_stripe_lmv(const struct lu_env *env, int lfsck_shard_name_to_index(const struct lu_env *env, const char *name, int namelen, __u16 type, const struct lu_fid *fid) { - char *name2 = lfsck_env_info(env)->lti_tmpbuf2; - int len; - int idx = 0; + char *name2 = lfsck_env_info(env)->lti_tmpbuf2; + int len; + int idx = 0; if (!S_ISDIR(type)) return -ENOTDIR; @@ -1061,17 +1067,17 @@ int lfsck_namespace_update_lmv(const struct lu_env *env, struct dt_object *obj, struct lmv_mds_md_v1 *lmv, bool locked) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lmv_mds_md_v1 *lmv4 = &info->lti_lmv4; - struct lu_buf *buf = &info->lti_buf; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct dt_device *dev = lfsck_obj2dev(obj); - struct thandle *th = NULL; - struct lustre_handle lh = { 0 }; - int rc = 0; - int rc1 = 0; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lmv_mds_md_v1 *lmv4 = &info->lti_lmv4; + struct lu_buf *buf = &info->lti_buf; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct dt_device *dev = lfsck_obj2dev(obj); + struct thandle *th = NULL; + struct lustre_handle lh = { 0 }; + int rc = 0; + int rc1 = 0; + ENTRY; LASSERT(lmv4 != lmv); if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN) @@ -1093,7 +1099,8 @@ int lfsck_namespace_update_lmv(const struct lu_env *env, GOTO(log, rc = PTR_ERR(th)); /* For remote updating LMV EA, there will be further LFSCK action on - * remote MDT after the updating, so update the LMV EA synchronously. */ + * remote MDT after the updating, so update the LMV EA synchronously. + */ if (dt_object_remote(obj)) th->th_sync = 1; @@ -1125,8 +1132,8 @@ log: lfsck_ibits_unlock(&lh, LCK_EX); out: - CDEBUG(D_LFSCK, "%s: namespace LFSCK updated the %s LMV EA " - "for the object "DFID": rc = %d\n", + CDEBUG(D_LFSCK, + "%s: namespace LFSCK updated the %s LMV EA for the object "DFID": rc = %d\n", lfsck_lfsck2name(lfsck), lmv->lmv_magic == LMV_MAGIC ? "master" : "slave", PFID(lfsck_dto2fid(obj)), rc); @@ -1160,19 +1167,18 @@ static int lfsck_allow_regenerate_master_lmv(const struct lu_env *env, const struct lu_fid *cfid, __u32 cidx) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lu_fid *tfid = &info->lti_fid3; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lu_dirent *ent = - (struct lu_dirent *)info->lti_key; - const struct dt_it_ops *iops; - struct dt_it *di; - __u64 cookie; - __u32 args; - int rc; - __u16 type; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lu_fid *tfid = &info->lti_fid3; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lu_dirent *ent = (struct lu_dirent *)info->lti_key; + const struct dt_it_ops *iops; + struct dt_it *di; + __u64 cookie; + __u32 args; + int rc; + __u16 type; + ENTRY; if (unlikely(!dt_try_as_dir(env, obj, true))) RETURN(-ENOTDIR); @@ -1230,7 +1236,8 @@ static int lfsck_allow_regenerate_master_lmv(const struct lu_env *env, * will cause such subdir to be invisible to client, and * if its index occupies some lost shard index, then the * LFSCK will use it to replace the bad shard, and cause - * the subdir (itself) to be invisible for ever. */ + * the subdir (itself) to be invisible for ever. + */ if (lfsck_shard_name_to_index(env, ent->lde_name, ent->lde_namelen, type, &ent->lde_fid) < 0) GOTO(out, rc = 1); @@ -1268,14 +1275,14 @@ static int lfsck_namespace_notify_lmv_remote(const struct lu_env *env, __u32 event, __u32 flags, __u32 index) { - struct lfsck_request *lr = &lfsck_env_info(env)->lti_lr; - const struct lu_fid *fid = lfsck_dto2fid(obj); - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lfsck_tgt_desc *ltd = NULL; - struct ptlrpc_request *req = NULL; - int rc; - ENTRY; + struct lfsck_request *lr = &lfsck_env_info(env)->lti_lr; + const struct lu_fid *fid = lfsck_dto2fid(obj); + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lfsck_tgt_desc *ltd = NULL; + struct ptlrpc_request *req = NULL; + int rc; + ENTRY; ltd = lfsck_tgt_get(&lfsck->li_mdt_descs, index); if (ltd == NULL) GOTO(out, rc = -ENODEV); @@ -1307,10 +1314,9 @@ static int lfsck_namespace_notify_lmv_remote(const struct lu_env *env, GOTO(out, rc = (rc == -ENOENT ? 1 : rc)); out: - CDEBUG(D_LFSCK, "%s: namespace LFSCK notify LMV EA updated for the " - "object "DFID" on MDT %x remotely with event %u, flags %u: " - "rc = %d\n", lfsck_lfsck2name(lfsck), PFID(fid), index, - event, flags, rc); + CDEBUG(D_LFSCK, + "%s: namespace LFSCK notify LMV EA updated for the object "DFID" on MDT %x remotely with event %u, flags %u: rc = %d\n", + lfsck_lfsck2name(lfsck), PFID(fid), index, event, flags, rc); if (ltd != NULL) lfsck_tgt_put(ltd); @@ -1333,16 +1339,16 @@ int lfsck_namespace_notify_lmv_master_local(const struct lu_env *env, struct lfsck_component *com, struct dt_object *obj) { - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lfsck_namespace *ns = com->lc_file_ram; - struct lmv_mds_md_v1 *lmv4 = &lfsck_env_info(env)->lti_lmv4; - struct lfsck_lmv_unit *llu; - struct lfsck_lmv *llmv; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lfsck_namespace *ns = com->lc_file_ram; + struct lmv_mds_md_v1 *lmv4 = &lfsck_env_info(env)->lti_lmv4; + struct lfsck_lmv_unit *llu; + struct lfsck_lmv *llmv; struct lfsck_slave_lmv_rec *lslr; - int count = 0; - int rc; - ENTRY; + int count = 0; + int rc; + ENTRY; if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN) RETURN(0); @@ -1432,16 +1438,16 @@ static int lfsck_namespace_set_lmv_master(const struct lu_env *env, const struct lu_fid *cfid, __u32 cidx, __u32 flags) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lmv_mds_md_v1 *lmv3 = &info->lti_lmv3; - struct lu_seq_range *range = &info->lti_range; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct seq_server_site *ss = lfsck_dev_site(lfsck); - struct lustre_handle lh = { 0 }; - int pidx = -1; - int rc = 0; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lmv_mds_md_v1 *lmv3 = &info->lti_lmv3; + struct lu_seq_range *range = &info->lti_range; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct seq_server_site *ss = lfsck_dev_site(lfsck); + struct lustre_handle lh = { 0 }; + int pidx = -1; + int rc = 0; + ENTRY; fld_range_set_mdt(range); rc = fld_server_lookup(env, ss->ss_server_fld, fid_seq(lfsck_dto2fid(obj)), range); @@ -1546,14 +1552,14 @@ int lfsck_namespace_repair_bad_name_hash(const struct lu_env *env, struct lfsck_lmv *llmv, const char *name) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lu_fid *pfid = &info->lti_fid3; - struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct dt_object *parent = NULL; - int rc = 0; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lu_fid *pfid = &info->lti_fid3; + struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct dt_object *parent = NULL; + int rc = 0; + ENTRY; rc = dt_lookup_dir(env, shard, dotdot, pfid); if (rc != 0 || !fid_is_sane(pfid)) GOTO(log, rc); @@ -1565,7 +1571,8 @@ int lfsck_namespace_repair_bad_name_hash(const struct lu_env *env, if (unlikely(!dt_object_exists(parent))) /* The parent object was previously accessed when verifying * the slave LMV EA. If this condition is true it is because - * the striped directory is being removed. */ + * the striped directory is being removed. + */ GOTO(log, rc = 1); *lmv2 = llmv->ll_lmv; @@ -1582,9 +1589,8 @@ int lfsck_namespace_repair_bad_name_hash(const struct lu_env *env, GOTO(log, rc); log: - CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant found bad name hash " - "on the MDT %x, parent "DFID", name %s, shard_%x "DFID - ": rc = %d\n", + CDEBUG(D_LFSCK, + "%s: namespace LFSCK assistant found bad name hash on the MDT %x, parent "DFID", name %s, shard_%x "DFID": rc = %d\n", lfsck_lfsck2name(lfsck), lfsck_dev_idx(lfsck), PFID(pfid), name, llmv->ll_lmv.lmv_master_mdt_index, PFID(lfsck_dto2fid(shard)), rc); @@ -1619,23 +1625,22 @@ int lfsck_namespace_scan_shard(const struct lu_env *env, struct lfsck_component *com, struct dt_object *child) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lmv_mds_md_v1 *lmv = &info->lti_lmv; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lfsck_namespace *ns = com->lc_file_ram; - struct ptlrpc_thread *thread = &lfsck->li_thread; - struct lu_dirent *ent = - (struct lu_dirent *)info->lti_key; - struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram; - struct lfsck_lmv *llmv = NULL; - const struct dt_it_ops *iops; - struct dt_it *di; - __u64 cookie; - __u32 args; - int rc; - __u16 type; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lmv_mds_md_v1 *lmv = &info->lti_lmv; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lfsck_namespace *ns = com->lc_file_ram; + struct ptlrpc_thread *thread = &lfsck->li_thread; + struct lu_dirent *ent = (struct lu_dirent *)info->lti_key; + struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram; + struct lfsck_lmv *llmv = NULL; + const struct dt_it_ops *iops; + struct dt_it *di; + __u64 cookie; + __u32 args; + int rc; + __u16 type; + ENTRY; rc = lfsck_read_stripe_lmv(env, lfsck, child, lmv); if (rc != 0) RETURN(rc == -ENODATA ? 1 : rc); @@ -1747,19 +1752,19 @@ int lfsck_namespace_verify_stripe_slave(const struct lu_env *env, struct dt_object *obj, struct lfsck_lmv *llmv) { - struct lfsck_thread_info *info = lfsck_env_info(env); - char *name = info->lti_key; - char *name2; - struct lu_fid *pfid = &info->lti_fid3; - const struct lu_fid *cfid = lfsck_dto2fid(obj); - struct lu_fid tfid; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lmv_mds_md_v1 *clmv = &llmv->ll_lmv; - struct lmv_mds_md_v1 *plmv = &info->lti_lmv; - struct dt_object *parent = NULL; - int rc = 0; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + char *name = info->lti_key; + char *name2; + struct lu_fid *pfid = &info->lti_fid3; + const struct lu_fid *cfid = lfsck_dto2fid(obj); + struct lu_fid tfid; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lmv_mds_md_v1 *clmv = &llmv->ll_lmv; + struct lmv_mds_md_v1 *plmv = &info->lti_lmv; + struct dt_object *parent = NULL; + int rc = 0; + ENTRY; if (!lfsck_is_valid_slave_lmv(clmv)) { rc = lfsck_namespace_trace_update(env, com, cfid, LNTF_UNCERTAIN_LMV, true); @@ -1797,7 +1802,8 @@ int lfsck_namespace_verify_stripe_slave(const struct lu_env *env, /* If the parent has no LMV EA, then it maybe because: * 1) The parent lost the LMV EA. - * 2) The child claims a wrong (slave) LMV EA. */ + * 2) The child claims a wrong (slave) LMV EA. + */ if (rc == -ENODATA) rc = lfsck_namespace_set_lmv_master(env, com, parent, clmv, cfid, clmv->lmv_master_mdt_index, @@ -1821,7 +1827,8 @@ int lfsck_namespace_verify_stripe_slave(const struct lu_env *env, } /* If the master hash type has been set as LMV_HASH_TYPE_UNKNOWN, - * then the slave hash type is not important. */ + * then the slave hash type is not important. + */ if ((plmv->lmv_hash_type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_UNKNOWN && plmv->lmv_hash_type & LMV_HASH_FLAG_BAD_TYPE) @@ -1891,24 +1898,24 @@ int lfsck_namespace_striped_dir_rescan(const struct lu_env *env, struct lfsck_component *com, struct lfsck_namespace_req *lnr) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lfsck_namespace *ns = com->lc_file_ram; - struct lfsck_lmv *llmv = lnr->lnr_lmv; - struct lmv_mds_md_v1 *lmv = &llmv->ll_lmv; - struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2; - struct lfsck_assistant_object *lso = lnr->lnr_lar.lar_parent; - const struct lu_fid *pfid = &lso->lso_fid; - struct dt_object *dir = NULL; - struct dt_object *obj = NULL; - struct lu_seq_range *range = &info->lti_range; - struct seq_server_site *ss = lfsck_dev_site(lfsck); - __u32 stripe_count; - __u32 hash_type; - int rc = 0; - int i; - ENTRY; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lfsck_namespace *ns = com->lc_file_ram; + struct lfsck_lmv *llmv = lnr->lnr_lmv; + struct lmv_mds_md_v1 *lmv = &llmv->ll_lmv; + struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2; + struct lfsck_assistant_object *lso = lnr->lnr_lar.lar_parent; + const struct lu_fid *pfid = &lso->lso_fid; + struct dt_object *dir = NULL; + struct dt_object *obj = NULL; + struct lu_seq_range *range = &info->lti_range; + struct seq_server_site *ss = lfsck_dev_site(lfsck); + __u32 stripe_count; + __u32 hash_type; + int rc = 0; + int i; + ENTRY; if (llmv->ll_lmv_slave) { if (llmv->ll_lmv_verified) { ns->ln_striped_shards_scanned++; @@ -1922,13 +1929,15 @@ int lfsck_namespace_striped_dir_rescan(const struct lu_env *env, /* Either the striped directory has been disabled or only part of * the striped directory have been scanned. The LFSCK cannot repair - * something based on incompleted knowledge. So skip it. */ + * something based on incompleted knowledge. So skip it. + */ if (llmv->ll_ignore || llmv->ll_exit_value <= 0) RETURN(0); /* There ever been some failure, as to the LFSCK cannot know whether * it has got the global knowledge about the LMV EA consistency or not, - * so it cannot make reparation about the incompleted knowledge. */ + * so it cannot make reparation about the incompleted knowledge. + */ if (llmv->ll_failed) { ns->ln_striped_dirs_scanned++; ns->ln_striped_dirs_failed++; @@ -2035,7 +2044,8 @@ int lfsck_namespace_striped_dir_rescan(const struct lu_env *env, break; case LSLF_BAD_INDEX2: /* The index in the slave LMV EA is right, - * the name entry should be updated. */ + * the name entry should be updated. + */ rename = true; snprintf(info->lti_tmpbuf2, sizeof(info->lti_tmpbuf2), DFID":%u", PFID(cfid), lslr->lslr_index); @@ -2047,7 +2057,8 @@ int lfsck_namespace_striped_dir_rescan(const struct lu_env *env, break; case LSLF_BAD_INDEX1: /* The index in the name entry is right, - * the slave LMV EA should be updated. */ + * the slave LMV EA should be updated. + */ case LSLF_NO_LMVEA: repair_lmvea = true; break; @@ -2147,7 +2158,8 @@ repair: /* The slave LMV EA on the remote shard is * correct, just notify the LFSCK instance - * on such MDT to re-verify the name_hash. */ + * on such MDT to re-verify the name_hash. + */ rc1 = lfsck_namespace_notify_lmv_remote(env, com, obj, LE_SET_LMV_SLAVE, LEF_RECHECK_NAME_HASH, @@ -2233,10 +2245,8 @@ repair: next: 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", + 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", @@ -2325,24 +2335,24 @@ int lfsck_namespace_handle_striped_master(const struct lu_env *env, struct lfsck_component *com, struct lfsck_namespace_req *lnr) { - struct lfsck_thread_info *info = lfsck_env_info(env); - struct lmv_mds_md_v1 *lmv = &info->lti_lmv; - struct lfsck_instance *lfsck = com->lc_lfsck; - struct lfsck_namespace *ns = com->lc_file_ram; - struct lfsck_lmv *llmv = lnr->lnr_lmv; - struct lfsck_assistant_object *lso = lnr->lnr_lar.lar_parent; - const struct lu_fid *pfid = &lso->lso_fid; - struct dt_object *dir; - struct dt_object *obj = NULL; - struct dt_device *dev = NULL; - int shard_idx = 0; - int stripe = 0; - int rc = 0; - int depth = 0; - bool repaired = false; + struct lfsck_thread_info *info = lfsck_env_info(env); + struct lmv_mds_md_v1 *lmv = &info->lti_lmv; + struct lfsck_instance *lfsck = com->lc_lfsck; + struct lfsck_namespace *ns = com->lc_file_ram; + struct lfsck_lmv *llmv = lnr->lnr_lmv; + struct lfsck_assistant_object *lso = lnr->lnr_lar.lar_parent; + const struct lu_fid *pfid = &lso->lso_fid; + struct dt_object *dir; + struct dt_object *obj = NULL; + struct dt_device *dev = NULL; + int shard_idx = 0; + int stripe = 0; + int rc = 0; + int depth = 0; + bool repaired = false; enum lfsck_namespace_inconsistency_type type = LNIT_NONE; - ENTRY; + ENTRY; if (unlikely(llmv->ll_ignore)) RETURN(0); @@ -2367,7 +2377,8 @@ int lfsck_namespace_handle_striped_master(const struct lu_env *env, /* Usually, some local filesystem consistency verification * tools can guarantee the local namespace tree consistenct. - * So the LFSCK will only verify the remote directory. */ + * So the LFSCK will only verify the remote directory. + */ if (unlikely(strcmp(lnr->lnr_name, dotdot) == 0)) { rc = lfsck_namespace_trace_update(env, com, pfid, LNTF_CHECK_PARENT, true); @@ -2377,8 +2388,8 @@ int lfsck_namespace_handle_striped_master(const struct lu_env *env, ltd = lfsck_ltd2tgt(&lfsck->li_mdt_descs, shard_idx); if (unlikely(ltd == NULL)) { - CDEBUG(D_LFSCK, "%s: cannot talk with MDT %x which " - "did not join the namespace LFSCK\n", + CDEBUG(D_LFSCK, + "%s: cannot talk with MDT %x which did not join the namespace LFSCK\n", lfsck_lfsck2name(lfsck), shard_idx); lfsck_lad_set_bitmap(env, com, shard_idx); @@ -2429,7 +2440,8 @@ dangling: rc = lfsck_read_stripe_lmv(env, lfsck, obj, lmv); if (unlikely(rc == -ENOENT)) /* It may happen when the remote object has been removed, - * but the local MDT does not aware of that. */ + * but the local MDT does not aware of that. + */ goto dangling; if (rc == -ENODATA) @@ -2470,8 +2482,8 @@ out: } if (rc < 0) { - CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant fail to handle " - "the shard: "DFID", parent "DFID", name %.*s: rc = %d\n", + CDEBUG(D_LFSCK, + "%s: namespace LFSCK assistant fail to handle the shard: "DFID", parent "DFID", name %.*s: rc = %d\n", lfsck_lfsck2name(lfsck), PFID(&lnr->lnr_fid), PFID(pfid), lnr->lnr_namelen, lnr->lnr_name, rc);