MCPcopy Create free account
hub / github.com/F-Stack/f-stack / taskq_lowest_id

Function taskq_lowest_id

freebsd/contrib/openzfs/module/os/linux/spl/spl-taskq.c:270–302  ·  view source on GitHub ↗

* Returns the lowest incomplete taskqid_t. The taskqid_t may * be queued on the pending list, on the priority list, on the * delay list, or on the work list currently being handled, but * it is not 100% complete yet. */

Source from the content-addressed store, hash-verified

268 * it is not 100% complete yet.
269 */
270static taskqid_t
271taskq_lowest_id(taskq_t *tq)
272{
273 taskqid_t lowest_id = tq->tq_next_id;
274 taskq_ent_t *t;
275 taskq_thread_t *tqt;
276
277 ASSERT(tq);
278
279 if (!list_empty(&tq->tq_pend_list)) {
280 t = list_entry(tq->tq_pend_list.next, taskq_ent_t, tqent_list);
281 lowest_id = MIN(lowest_id, t->tqent_id);
282 }
283
284 if (!list_empty(&tq->tq_prio_list)) {
285 t = list_entry(tq->tq_prio_list.next, taskq_ent_t, tqent_list);
286 lowest_id = MIN(lowest_id, t->tqent_id);
287 }
288
289 if (!list_empty(&tq->tq_delay_list)) {
290 t = list_entry(tq->tq_delay_list.next, taskq_ent_t, tqent_list);
291 lowest_id = MIN(lowest_id, t->tqent_id);
292 }
293
294 if (!list_empty(&tq->tq_active_list)) {
295 tqt = list_entry(tq->tq_active_list.next, taskq_thread_t,
296 tqt_active_list);
297 ASSERT(tqt->tqt_id != TASKQID_INVALID);
298 lowest_id = MIN(lowest_id, tqt->tqt_id);
299 }
300
301 return (lowest_id);
302}
303
304/*
305 * Insert a task into a list keeping the list sorted by increasing taskqid.

Callers 2

taskq_cancel_idFunction · 0.85
taskq_threadFunction · 0.85

Calls 1

list_emptyFunction · 0.85

Tested by

no test coverage detected