5 static void __td_zone_gen_index(struct thread_data *td, enum fio_ddir ddir)
7 unsigned int i, j, sprev, aprev;
10 td->zone_state_index[ddir] = malloc(sizeof(struct zone_split_index) * 100);
12 sprev_sz = sprev = aprev = 0;
13 for (i = 0; i < td->o.zone_split_nr[ddir]; i++) {
14 struct zone_split *zsp = &td->o.zone_split[ddir][i];
16 for (j = aprev; j < aprev + zsp->access_perc; j++) {
17 struct zone_split_index *zsi = &td->zone_state_index[ddir][j];
19 zsi->size_perc = sprev + zsp->size_perc;
20 zsi->size_perc_prev = sprev;
22 zsi->size = sprev_sz + zsp->size;
23 zsi->size_prev = sprev_sz;
26 aprev += zsp->access_perc;
27 sprev += zsp->size_perc;
28 sprev_sz += zsp->size;
32 static bool has_zones(struct thread_data *td)
36 for (i = 0; i < DDIR_RWDIR_CNT; i++)
37 zones += td->o.zone_split_nr[i];
43 * Generate state table for indexes, so we don't have to do it inline from
46 void td_zone_gen_index(struct thread_data *td)
53 td->zone_state_index = malloc(DDIR_RWDIR_CNT *
54 sizeof(struct zone_split_index *));
56 for (i = 0; i < DDIR_RWDIR_CNT; i++)
57 __td_zone_gen_index(td, i);
60 void td_zone_free_index(struct thread_data *td)
64 if (!td->zone_state_index)
67 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
68 free(td->zone_state_index[i]);
69 td->zone_state_index[i] = NULL;
72 free(td->zone_state_index);
73 td->zone_state_index = NULL;