| 163 | } |
| 164 | |
| 165 | static void add_level(struct timers *timers, unsigned int level) |
| 166 | { |
| 167 | struct timer_level *l; |
| 168 | struct timer *t; |
| 169 | unsigned int i; |
| 170 | struct list_head from_far; |
| 171 | |
| 172 | l = timer_alloc(timers, sizeof(*l)); |
| 173 | if (!l) |
| 174 | return; |
| 175 | |
| 176 | for (i = 0; i < ARRAY_SIZE(l->list); i++) |
| 177 | list_head_init(&l->list[i]); |
| 178 | timers->level[level] = l; |
| 179 | |
| 180 | list_head_init(&from_far); |
| 181 | timers_far_get(timers, &from_far, level_max_time(timers, level)); |
| 182 | |
| 183 | while ((t = list_pop(&from_far, struct timer, list)) != NULL) |
| 184 | timer_add_raw(timers, t); |
| 185 | } |
| 186 | |
| 187 | /* We don't need to search past the first at level 0, since the |
| 188 | * bucket range is 1; they're all the same. */ |