Whamcloud - gitweb
LU-8837 lmv: don't include struct lu_qos_rr in client 50/41950/6
authorMr NeilBrown <neilb@suse.de>
Mon, 8 Mar 2021 23:05:23 +0000 (10:05 +1100)
committerOleg Drokin <green@whamcloud.com>
Sat, 10 Apr 2021 17:40:06 +0000 (17:40 +0000)
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 <neilb@suse.de>
Change-Id: I019cac560d68688042a02a53bd96b605909acdcd
Reviewed-on: https://review.whamcloud.com/41950
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_object.h
lustre/lod/lod_dev.c
lustre/obdclass/lu_tgt_descs.c

index bfd9134..9d5437d 100644 (file)
@@ -1526,6 +1526,7 @@ enum lq_flag {
        LQ_RESET,            /* zero current penalties */
 };
 
        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 */
 /* 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;
 };
 
        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 */
 /* 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 */
        __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 */
        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 */
        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);
                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);
 
 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);
 
index fd24323..d86a5a6 100644 (file)
@@ -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);
        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);
 
 
        RETURN(0);
 
index 1f1cfae..06415ff 100644 (file)
@@ -79,13 +79,6 @@ u64 lu_prandom_u64_max(u64 ep_ro)
 }
 EXPORT_SYMBOL(lu_prandom_u64_max);
 
 }
 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.
  *
 /**
  * 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);
        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);
        set_bit(LQ_DIRTY, &qos->lq_rr.lqr_flags);
+#endif
 out:
        up_write(&qos->lq_rw_sem);
        RETURN(rc);
 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);
        }
 
        set_bit(LQ_DIRTY, &qos->lq_flags);
+#ifdef HAVE_SERVER_SUPPORT
        set_bit(LQ_DIRTY, &qos->lq_rr.lqr_flags);
        set_bit(LQ_DIRTY, &qos->lq_rr.lqr_flags);
+#endif
 out:
        up_write(&qos->lq_rw_sem);
        RETURN(rc);
 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;
 
        if (is_mdt)
                ltd->ltd_lmv_desc.ld_pattern = LMV_HASH_TYPE_DEFAULT;
 
-       lu_qos_rr_init(&ltd->ltd_qos.lq_rr);
-
        return 0;
 }
 EXPORT_SYMBOL(lu_tgt_descs_init);
        return 0;
 }
 EXPORT_SYMBOL(lu_tgt_descs_init);