From b6882c8ae4f47e931cc7b49da1c6bffaaf31499b Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Tue, 9 Mar 2021 10:05:23 +1100 Subject: [PATCH] LU-8837 lmv: don't include struct lu_qos_rr in client The 'lqrr' field in 'struct lu_qos' is not used on the client (lmv). So make it server-only for use in lod. - move 'struct lu_qos_rr' into lu_target.h - protect lq_rr with HAVE_SERVER_SUPPORT - make lu_qos_rr_init() a static-inline in lu_target, and call it explicitly from lod instead of from lu_tgt_descs_init() - protect setting of LQ_DIRTY to in lu_tgt_descs.c with HAVE_SERVER_SUPPORT Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: I019cac560d68688042a02a53bd96b605909acdcd Reviewed-on: https://review.whamcloud.com/41950 Reviewed-by: Lai Siyao Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/include/lu_object.h | 12 +++++++++++- lustre/lod/lod_dev.c | 2 ++ lustre/obdclass/lu_tgt_descs.c | 13 ++++--------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index bfd9134..9d5437d 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1526,6 +1526,7 @@ enum lq_flag { LQ_RESET, /* zero current penalties */ }; +#ifdef HAVE_SERVER_SUPPORT /* round-robin QoS data for LOD/LMV */ struct lu_qos_rr { spinlock_t lqr_alloc; /* protect allocation index */ @@ -1536,6 +1537,14 @@ struct lu_qos_rr { unsigned long lqr_flags; }; +static inline void lu_qos_rr_init(struct lu_qos_rr *lqr) +{ + spin_lock_init(&lqr->lqr_alloc); + set_bit(LQ_DIRTY, &lqr->lqr_flags); +} + +#endif /* HAVE_SERVER_SUPPORT */ + /* QoS data per MDS/OSS */ struct lu_svr_qos { struct obd_uuid lsq_uuid; /* ptlrpc's c_remote_uuid */ @@ -1600,7 +1609,9 @@ struct lu_qos { __u32 lq_active_svr_count; unsigned int lq_prio_free; /* priority for free space */ unsigned int lq_threshold_rr;/* priority for rr */ +#ifdef HAVE_SERVER_SUPPORT struct lu_qos_rr lq_rr; /* round robin qos data */ +#endif unsigned long lq_flags; #if 0 unsigned long lq_dirty:1, /* recalc qos data */ @@ -1642,7 +1653,6 @@ struct lu_tgt_descs { ldi_tgt[(index) % TGT_PTRS_PER_BLOCK] u64 lu_prandom_u64_max(u64 ep_ro); -void lu_qos_rr_init(struct lu_qos_rr *lqr); int lu_qos_add_tgt(struct lu_qos *qos, struct lu_tgt_desc *ltd); void lu_tgt_qos_weight_calc(struct lu_tgt_desc *tgt); diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index fd24323..d86a5a6 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -1816,6 +1816,8 @@ static int lod_init0(const struct lu_env *env, struct lod_device *lod, spin_lock_init(&lod->lod_connects_lock); lu_tgt_descs_init(&lod->lod_mdt_descs, true); lu_tgt_descs_init(&lod->lod_ost_descs, false); + lu_qos_rr_init(&lod->lod_mdt_descs.ltd_qos.lq_rr); + lu_qos_rr_init(&lod->lod_ost_descs.ltd_qos.lq_rr); RETURN(0); diff --git a/lustre/obdclass/lu_tgt_descs.c b/lustre/obdclass/lu_tgt_descs.c index 1f1cfae..06415ff 100644 --- a/lustre/obdclass/lu_tgt_descs.c +++ b/lustre/obdclass/lu_tgt_descs.c @@ -79,13 +79,6 @@ u64 lu_prandom_u64_max(u64 ep_ro) } EXPORT_SYMBOL(lu_prandom_u64_max); -void lu_qos_rr_init(struct lu_qos_rr *lqr) -{ - spin_lock_init(&lqr->lqr_alloc); - set_bit(LQ_DIRTY, &lqr->lqr_flags); -} -EXPORT_SYMBOL(lu_qos_rr_init); - /** * Add a new target to Quality of Service (QoS) target table. * @@ -161,7 +154,9 @@ int lu_qos_add_tgt(struct lu_qos *qos, struct lu_tgt_desc *tgt) list_add_tail(&svr->lsq_svr_list, &tempsvr->lsq_svr_list); set_bit(LQ_DIRTY, &qos->lq_flags); +#ifdef HAVE_SERVER_SUPPORT set_bit(LQ_DIRTY, &qos->lq_rr.lqr_flags); +#endif out: up_write(&qos->lq_rw_sem); RETURN(rc); @@ -202,7 +197,9 @@ static int lu_qos_del_tgt(struct lu_qos *qos, struct lu_tgt_desc *ltd) } set_bit(LQ_DIRTY, &qos->lq_flags); +#ifdef HAVE_SERVER_SUPPORT set_bit(LQ_DIRTY, &qos->lq_rr.lqr_flags); +#endif out: up_write(&qos->lq_rw_sem); RETURN(rc); @@ -284,8 +281,6 @@ int lu_tgt_descs_init(struct lu_tgt_descs *ltd, bool is_mdt) if (is_mdt) ltd->ltd_lmv_desc.ld_pattern = LMV_HASH_TYPE_DEFAULT; - lu_qos_rr_init(<d->ltd_qos.lq_rr); - return 0; } EXPORT_SYMBOL(lu_tgt_descs_init); -- 1.8.3.1