From d7d495f5229fc36cfc8c66113449197225ff8d6f Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 11 May 2022 18:27:55 +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. Lustre-change: https://review.whamcloud.com/47293 Lustre-commit: TBD (from d04b04056e45edc95117f0761359ddc4637d3f37) 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 Reviewed-on: https://review.whamcloud.com/47295 Tested-by: jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger --- 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 c5a9f39..caaf06e 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -2413,8 +2413,8 @@ void lod_collect_avoidance(struct lod_object *lo, struct lod_avoid_guide *lag, struct cfs_bitmap *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; /** @@ -2424,57 +2424,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 (cfs_bitmap_check(bitmap, ost->ltd_index)) - continue; + if (cfs_bitmap_check(bitmap, ost->ltd_index)) + continue; + + QOS_DEBUG("OST%d used in conflicting mirror " + "component\n", ost->ltd_index); + cfs_bitmap_set(bitmap, ost->ltd_index); + lag->lag_ost_avail--; - QOS_DEBUG("OST%d used in conflicting mirror " - "component\n", ost->ltd_index); - cfs_bitmap_set(bitmap, ost->ltd_index); - 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++; - } + 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