diff --git a/src/include/daos_srv/rebuild.h b/src/include/daos_srv/rebuild.h index 8a856c70bb1..30ad5d8a18f 100644 --- a/src/include/daos_srv/rebuild.h +++ b/src/include/daos_srv/rebuild.h @@ -1,5 +1,5 @@ /** - * (C) Copyright 2017-2023 Intel Corporation. + * (C) Copyright 2017-2024 Intel Corporation. * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -34,6 +34,37 @@ typedef enum { (rb_op) == RB_OP_UPGRADE ? "Upgrade" : \ (rb_op) == RB_OP_NONE ? "None" : \ "Unknown") +/* Common rebuild identifying information for INFO/DEBUG logging: + * rb=/// + */ +#define DF_RB "rb=" DF_UUID "/%u/%u/%s" + +/* Full rebuild identifying information includes / + * Instead of this, use DF_RB most of the time (use this for leader change scenarios, etc.) + */ +#define DF_RBF DF_RB " ld=%u/" DF_U64 + +/* arguments for log rebuild identifier given a struct rebuild_global_pool_tracker * */ +#define DP_RB_RGT(rgt) \ + DP_UUID((rgt)->rgt_pool_uuid), (rgt)->rgt_rebuild_ver, (rgt)->rgt_rebuild_gen, \ + RB_OP_STR((rgt)->rgt_opc) + +/* arguments for log rebuild identifier given a struct rebuild_tgt_pool_tracker *rpt */ +#define DP_RB_RPT(rpt) \ + DP_UUID((rpt)->rt_pool_uuid), (rpt)->rt_rebuild_ver, (rpt)->rt_rebuild_gen, \ + RB_OP_STR((rpt)->rt_rebuild_op) +#define DP_RBF_RPT(rpt) DP_RB_RPT(rpt), (rpt)->rt_leader_rank, (rpt)->rt_leader_term + +/* arguments for log rebuild identifier given a struct rebuild_scan_in *rsin */ +#define DP_RB_RSI(rsi) \ + DP_UUID((rsi)->rsi_pool_uuid), (rsi)->rsi_rebuild_ver, (rsi)->rsi_rebuild_gen, \ + RB_OP_STR((rsi)->rsi_rebuild_op) +#define DP_RBF_RSI(rsi) DP_RB_RSI(rsi), (rsi)->rsi_master_rank, (rsi)->rsi_leader_term + +/* arguments for log rebuild identifier given a struct migrate_query_arg * */ +#define DP_RB_MQA(mqa) \ + DP_UUID((mqa)->pool_uuid), (mqa)->version, (mqa)->generation, RB_OP_STR((mqa)->rebuild_op) +#define DP_RBF_MQA(mqa) DP_RB_MQA(mqa), (mqa)->leader_rank, (mqa)->leader_term int ds_rebuild_schedule(struct ds_pool *pool, uint32_t map_ver, daos_epoch_t stable_eph, uint32_t layout_version,