From d04b04056e45edc95117f0761359ddc4637d3f37 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 11 May 2022 18:36:15 +0800 Subject: [PATCH] LU-15841 lod: iterate component to collect avoid array In newly created file, the mirror information hasn't been established as LOD is trying allocate OST for its components, so we need to iterate component instead of mirror to collect the avoid guidance information. Test-Parameters: testlist=sanity-flr env=ONLY=47,ONLY_REPEAT=40 Fixes: fabf3fe7 ("LU-9007 lod: improve obj alloc for FLR file") Signed-off-by: Bobi Jam Change-Id: I6bbe5f6b6dfea06c5213b77b7ebb6a5d28aa0d17 --- lustre/lod/lod_qos.c | 85 +++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index df1f27f..1caca8c 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -2408,8 +2408,8 @@ void lod_collect_avoidance(struct lod_object *lo, struct lod_avoid_guide *lag, unsigned long *bitmap = lag->lag_ost_avoid_bitmap; int i, j; - /* iterate mirrors */ - for (i = 0; i < lo->ldo_mirror_count; i++) { + /* iterate components */ + for (i = 0; i < lo->ldo_comp_cnt; i++) { struct lod_layout_component *comp; /** @@ -2419,57 +2419,54 @@ void lod_collect_avoidance(struct lod_object *lo, struct lod_avoid_guide *lag, * not available, we still have other mirror with different * OSTs to read the data. */ - comp = &lo->ldo_comp_entries[lo->ldo_mirrors[i].lme_start]; + comp = &lo->ldo_comp_entries[i]; if (comp->llc_id != LCME_ID_INVAL && mirror_id_of(comp->llc_id) == mirror_id_of(lod_comp->llc_id)) continue; - /* iterate components of a mirror */ - lod_foreach_mirror_comp(comp, lo, i) { - /** - * skip non-overlapped or un-instantiated components, - * NOTE: don't use lod_comp_inited(comp) to judge - * whether @comp has been inited, since during - * declare phase, comp->llc_stripe has been allocated - * while it's init flag not been set until the exec - * phase. - */ - if (!lu_extent_is_overlapped(&comp->llc_extent, - &lod_comp->llc_extent) || - !comp->llc_stripe) - continue; + /** + * skip non-overlapped or un-instantiated components, + * NOTE: don't use lod_comp_inited(comp) to judge + * whether @comp has been inited, since during + * declare phase, comp->llc_stripe has been allocated + * while it's init flag not been set until the exec + * phase. + */ + if (!lu_extent_is_overlapped(&comp->llc_extent, + &lod_comp->llc_extent) || + !comp->llc_stripe) + continue; - /** - * collect used OSTs index and OSS info from a - * component - */ - for (j = 0; j < comp->llc_stripe_count; j++) { - struct lod_tgt_desc *ost; - struct lu_svr_qos *lsq; - int k; + /** + * collect used OSTs index and OSS info from a + * component + */ + for (j = 0; j < comp->llc_stripe_count; j++) { + struct lod_tgt_desc *ost; + struct lu_svr_qos *lsq; + int k; - ost = OST_TGT(lod, comp->llc_ost_indices[j]); - lsq = ost->ltd_qos.ltq_svr; + ost = OST_TGT(lod, comp->llc_ost_indices[j]); + lsq = ost->ltd_qos.ltq_svr; - if (test_bit(ost->ltd_index, bitmap)) - continue; + if (test_bit(ost->ltd_index, bitmap)) + continue; - QOS_DEBUG("OST%d used in conflicting mirror " - "component\n", ost->ltd_index); - set_bit(ost->ltd_index, bitmap); - lag->lag_ost_avail--; - - for (k = 0; k < lag->lag_oaa_count; k++) { - if (lag->lag_oss_avoid_array[k] == - lsq->lsq_id) - break; - } - if (k == lag->lag_oaa_count) { - lag->lag_oss_avoid_array[k] = - lsq->lsq_id; - lag->lag_oaa_count++; - } + QOS_DEBUG("OST%d used in conflicting mirror " + "component\n", ost->ltd_index); + set_bit(ost->ltd_index, bitmap); + lag->lag_ost_avail--; + + for (k = 0; k < lag->lag_oaa_count; k++) { + if (lag->lag_oss_avoid_array[k] == + lsq->lsq_id) + break; + } + if (k == lag->lag_oaa_count) { + lag->lag_oss_avoid_array[k] = + lsq->lsq_id; + lag->lag_oaa_count++; } } } -- 1.8.3.1