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

Function graph_remove_edge

freebsd/kern/kern_lockf.c:2371–2400  ·  view source on GitHub ↗

* Remove an edge x->y from the graph. */

Source from the content-addressed store, hash-verified

2369 * Remove an edge x->y from the graph.
2370 */
2371static void
2372graph_remove_edge(struct owner_graph *g, struct owner_vertex *x,
2373 struct owner_vertex *y)
2374{
2375 struct owner_edge *e;
2376
2377 sx_assert(&lf_owner_graph_lock, SX_XLOCKED);
2378
2379 LIST_FOREACH(e, &x->v_outedges, e_outlink) {
2380 if (e->e_to == y)
2381 break;
2382 }
2383 KASSERT(e, ("Removing non-existent edge from deadlock graph"));
2384
2385 e->e_refs--;
2386 if (e->e_refs == 0) {
2387#ifdef LOCKF_DEBUG
2388 if (lockf_debug & 8) {
2389 printf("removing edge %d:", x->v_order);
2390 lf_print_owner(x->v_owner);
2391 printf(" -> %d:", y->v_order);
2392 lf_print_owner(y->v_owner);
2393 printf("\n");
2394 }
2395#endif
2396 LIST_REMOVE(e, e_outlink);
2397 LIST_REMOVE(e, e_inlink);
2398 free(e, M_LOCKF);
2399 }
2400}
2401
2402/*
2403 * Allocate a vertex from the free list. Return ENOMEM if there are

Callers 1

lf_remove_edgeFunction · 0.85

Calls 3

lf_print_ownerFunction · 0.85
printfFunction · 0.70
freeFunction · 0.70

Tested by

no test coverage detected