* Unschedule the periodic timer that processes bw_meter entry of type "<=" * by removing the entry from the proper hash bucket. */
| 2149 | * by removing the entry from the proper hash bucket. |
| 2150 | */ |
| 2151 | static void |
| 2152 | unschedule_bw_meter(struct bw_meter *x) |
| 2153 | { |
| 2154 | int time_hash; |
| 2155 | struct bw_meter *prev, *tmp; |
| 2156 | |
| 2157 | MFC_LOCK_ASSERT(); |
| 2158 | |
| 2159 | if (!(x->bm_flags & BW_METER_LEQ)) |
| 2160 | return; /* XXX: we schedule timers only for "<=" entries */ |
| 2161 | |
| 2162 | /* |
| 2163 | * Compute the timeout hash value and delete the entry |
| 2164 | */ |
| 2165 | time_hash = x->bm_time_hash; |
| 2166 | if (time_hash >= BW_METER_BUCKETS) |
| 2167 | return; /* Entry was not scheduled */ |
| 2168 | |
| 2169 | for (prev = NULL, tmp = V_bw_meter_timers[time_hash]; |
| 2170 | tmp != NULL; prev = tmp, tmp = tmp->bm_time_next) |
| 2171 | if (tmp == x) |
| 2172 | break; |
| 2173 | |
| 2174 | if (tmp == NULL) |
| 2175 | panic("unschedule_bw_meter: bw_meter entry not found"); |
| 2176 | |
| 2177 | if (prev != NULL) |
| 2178 | prev->bm_time_next = x->bm_time_next; |
| 2179 | else |
| 2180 | V_bw_meter_timers[time_hash] = x->bm_time_next; |
| 2181 | |
| 2182 | x->bm_time_next = NULL; |
| 2183 | x->bm_time_hash = BW_METER_BUCKETS; |
| 2184 | } |
| 2185 | |
| 2186 | /* |
| 2187 | * Process all "<=" type of bw_meter that should be processed now, |
no test coverage detected