@@ -2017,6 +2017,29 @@ static int dix_spare_target_with_data(struct m0_dix_rec_op *rec_op,
20172017 true);
20182018}
20192019
2020+ static void dix_online_unit_choose (struct m0_dix_req * req ,
2021+ struct m0_dix_rec_op * rec_op )
2022+ {
2023+ struct m0_dix_pg_unit * pgu ;
2024+ uint64_t start_unit ;
2025+ uint64_t i ;
2026+ uint64_t j ;
2027+
2028+ M0_ENTRY ();
2029+ M0_PRE (req -> dr_type == DIX_GET );
2030+ start_unit = req -> dr_items [rec_op -> dgp_item ].dxi_pg_unit ;
2031+ M0_ASSERT (start_unit < dix_rec_op_spare_offset (rec_op ));
2032+ for (i = 0 ; i < start_unit ; i ++ )
2033+ rec_op -> dgp_units [i ].dpu_unavail = true;
2034+ for (i = start_unit ; i < rec_op -> dgp_units_nr ; i ++ ) {
2035+ pgu = & rec_op -> dgp_units [i ];
2036+ if (!pgu -> dpu_is_spare && !pgu -> dpu_unavail )
2037+ break ;
2038+ }
2039+ for (j = i + 1 ; j < rec_op -> dgp_units_nr ; j ++ )
2040+ rec_op -> dgp_units [j ].dpu_unavail = true;
2041+ }
2042+
20202043static void dix_pg_unit_pd_assign (struct m0_dix_pg_unit * pgu ,
20212044 struct m0_pooldev * pd )
20222045{
@@ -2173,6 +2196,16 @@ static void dix_rop_units_set(struct m0_dix_req *req)
21732196 }
21742197
21752198 m0_rwlock_read_unlock (& pm -> pm_lock );
2199+
2200+ /*
2201+ * For meta requests,
2202+ * only one CAS GET request should be sent for every record.
2203+ * Choose the best destination for every record.
2204+ */
2205+ if (req -> dr_type == DIX_GET && req -> dr_is_meta ) {
2206+ for (i = 0 ; i < rop -> dg_rec_ops_nr ; i ++ )
2207+ dix_online_unit_choose (req , & rop -> dg_rec_ops [i ]);
2208+ }
21762209}
21772210
21782211static bool dix_pg_unit_skip (struct m0_dix_req * req ,
0 commit comments