Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Li Wei <[email protected]>
Required-githooks: true
  • Loading branch information
liw committed Jan 30, 2025
1 parent f5a5760 commit 5f3ec8c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
13 changes: 6 additions & 7 deletions src/pool/srv_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2415,9 +2415,9 @@ pool_svc_step_up_cb(struct ds_rsvc *rsvc)
* Step up with the error anyway, so that RPCs to the PS
* receive an error instead of timeouts.
*/
DS_POOL_NOTE_PRINT(DF_UUID": rank %u became pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
DS_POOL_LOG_PRINT(NOTE, DF_UUID": rank %u became pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
rc = 0;
}
return rc;
Expand All @@ -2438,10 +2438,9 @@ pool_svc_step_down_cb(struct ds_rsvc *rsvc)
DS_POOL_LOG_PRINT(NOTE, DF_UUID": rank %u no longer pool service leader "DF_U64"\n",
DP_UUID(svc->ps_uuid), rank, svc->ps_rsvc.s_term);
} else {
DS_POOL_LOG_PRINT(NOTE,
DF_UUID": rank %u no longer pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid),
rank, svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
DS_POOL_LOG_PRINT(NOTE, DF_UUID": rank %u no longer pool service leader "DF_U64
" with error: "DF_RC"\n", DP_UUID(svc->ps_uuid), rank,
svc->ps_rsvc.s_term, DP_RC(svc->ps_error));
svc->ps_error = 0;
}
}
Expand Down
52 changes: 29 additions & 23 deletions src/pool/srv_pool_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
case PO_COMP_ST_DRAIN:
case PO_COMP_ST_DOWNOUT:
/* Nothing to do, already excluded / draining */
D_INFO(DF_MAP ": Skip drain down target (rank %u idx %u)\n",
DP_MAP(pool_uuid, map), target->ta_comp.co_rank,
target->ta_comp.co_index);
D_INFO(DF_MAP ": Skip drain down " DF_TARGET "\n", DP_MAP(pool_uuid, map),
DP_TARGET(target));
break;
case PO_COMP_ST_NEW:
D_ERROR(DF_MAP ": Can't drain new " DF_TARGET "\n", DP_MAP(pool_uuid, map),
Expand All @@ -119,8 +118,8 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
DP_MAP(pool_uuid, map), DP_TARGET(target));
return -DER_BUSY;
case PO_COMP_ST_UPIN:
D_DEBUG(DB_MD, DF_MAP ": change " DF_TARGET " to DRAIN %p\n",
DP_MAP(pool_uuid, map), DP_TARGET(target), map);
D_DEBUG(DB_MD, DF_MAP ": change " DF_TARGET " to DRAIN\n",
DP_MAP(pool_uuid, map), DP_TARGET(target));
target->ta_comp.co_status = PO_COMP_ST_DRAIN;
target->ta_comp.co_fseq = ++(*version);
if (print_changes)
Expand Down Expand Up @@ -152,8 +151,8 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
case PO_COMP_ST_DOWN:
target->ta_comp.co_flags |= PO_COMPF_DOWN2UP;
case PO_COMP_ST_DOWNOUT:
D_DEBUG(DB_MD, DF_MAP ": change " DF_TARGET " to UP %p\n",
DP_MAP(pool_uuid, map), DP_TARGET(target), map);
D_DEBUG(DB_MD, DF_MAP ": change " DF_TARGET " to UP\n",
DP_MAP(pool_uuid, map), DP_TARGET(target));
target->ta_comp.co_status = PO_COMP_ST_UP;
target->ta_comp.co_in_ver = ++(*version);
if (print_changes)
Expand Down Expand Up @@ -200,8 +199,8 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
case PO_COMP_ST_DOWN:
case PO_COMP_ST_DRAIN:
case PO_COMP_ST_NEW:
/* Nothing to do, already UPIN */
D_INFO(DF_MAP ": Skip ADD_IN UPIN " DF_TARGET "\n", DP_MAP(pool_uuid, map),
/* Nothing to do */
D_INFO(DF_MAP ": Skip ADD_IN " DF_TARGET "\n", DP_MAP(pool_uuid, map),
DP_TARGET(target));
break;
case PO_COMP_ST_UP:
Expand All @@ -216,8 +215,8 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
case PO_COMP_ST_DOWNOUT:
case PO_COMP_ST_NEW:
case PO_COMP_ST_UP:
/* Nothing to do, already UPIN */
D_INFO(DF_MAP ": Skip ADD_IN UPIN " DF_TARGET "\n", DP_MAP(pool_uuid, map),
/* Nothing to do */
D_INFO(DF_MAP ": Skip EXCLUDE_OUT " DF_TARGET "\n", DP_MAP(pool_uuid, map),
DP_TARGET(target));
break;
case PO_COMP_ST_DOWN:
Expand All @@ -233,9 +232,9 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
case PO_COMP_ST_UPIN:
case PO_COMP_ST_DOWNOUT:
case PO_COMP_ST_NEW:
/* Nothing to do, already UPIN */
D_INFO(DF_MAP ": Skip ADD_IN UPIN " DF_TARGET "\n", DP_MAP(pool_uuid, map),
DP_TARGET(target));
/* Nothing to do */
D_INFO(DF_MAP ": Skip FINISH_REBUILD " DF_TARGET "\n",
DP_MAP(pool_uuid, map), DP_TARGET(target));
break;
case PO_COMP_ST_DOWN:
case PO_COMP_ST_DRAIN:
Expand All @@ -255,8 +254,8 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
case PO_COMP_ST_DOWNOUT:
case PO_COMP_ST_DOWN:
case PO_COMP_ST_NEW:
/* Nothing to do, already UPIN and DOWNOUT. DOWN can not be revert. */
D_INFO(DF_MAP ": Skip ADD_IN UPIN DOWN " DF_TARGET "\n",
/* Nothing to do. DOWN can not be revert. */
D_INFO(DF_MAP ": Skip REVERT_REBUILD " DF_TARGET "\n",
DP_MAP(pool_uuid, map), DP_TARGET(target));
break;
case PO_COMP_ST_DRAIN: /* revert DRAIN to UPIN */
Expand All @@ -273,19 +272,26 @@ update_one_tgt(uuid_t pool_uuid, struct pool_map *map, struct pool_target *targe
target->ta_comp.co_in_ver = 0;
++(*version);
} else {
D_DEBUG(DB_MD, DF_MAP ": change " DF_TARGET " to DOWNOUT fseq %u\n",
DP_MAP(pool_uuid, map), DP_TARGET(target),
target->ta_comp.co_fseq);
if (target->ta_comp.co_flags & PO_COMPF_DOWN2UP)
if (target->ta_comp.co_flags & PO_COMPF_DOWN2UP) {
D_DEBUG(DB_MD,
DF_MAP ": change " DF_TARGET " to DOWN fseq %u\n",
DP_MAP(pool_uuid, map), DP_TARGET(target),
target->ta_comp.co_fseq);
target->ta_comp.co_status = PO_COMP_ST_DOWN;
else
} else {
D_DEBUG(DB_MD,
DF_MAP ": change " DF_TARGET
" to DOWNOUT fseq %u\n",
DP_MAP(pool_uuid, map), DP_TARGET(target),
target->ta_comp.co_fseq);
target->ta_comp.co_status = PO_COMP_ST_DOWNOUT;
}
target->ta_comp.co_out_ver = ++(*version);
}
if (print_changes)
D_PRINT(DF_MAP ": " DF_TARGET " is excluded.\n",
DP_MAP(pool_uuid, map), DP_TARGET(target));
D_INFO(DF_MAP ": " DF_TARGET " is excluded.\n", DP_MAP(pool_uuid, map),
D_INFO(DF_MAP ": " DF_TARGET " is reverted.\n", DP_MAP(pool_uuid, map),
DP_TARGET(target));
rc = 1;
break;
Expand Down Expand Up @@ -396,7 +402,7 @@ ds_pool_map_tgts_update(uuid_t pool_uuid, struct pool_map *map, struct pool_targ
if (rc < 0)
return rc;

/* if the target status does not need to change */
/* if the rank status does not need to change */
if (rc == 0 && !exclude_rank) {
D_DEBUG(DB_MD, DF_MAP ": skip target " DF_TARGET "\n",
DP_MAP(pool_uuid, map), DP_TARGET(target));
Expand Down

0 comments on commit 5f3ec8c

Please sign in to comment.