* Remove an edge x->y from the graph. */
| 2369 | * Remove an edge x->y from the graph. |
| 2370 | */ |
| 2371 | static void |
| 2372 | graph_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 |
no test coverage detected