* binsfree: * * Insert the buffer into the appropriate free list. Requires a * locked buffer on entry and buffer is unlocked before return. */
| 1523 | * locked buffer on entry and buffer is unlocked before return. |
| 1524 | */ |
| 1525 | static void |
| 1526 | binsfree(struct buf *bp, int qindex) |
| 1527 | { |
| 1528 | struct bufdomain *bd; |
| 1529 | struct bufqueue *bq; |
| 1530 | |
| 1531 | KASSERT(qindex == QUEUE_CLEAN || qindex == QUEUE_DIRTY, |
| 1532 | ("binsfree: Invalid qindex %d", qindex)); |
| 1533 | BUF_ASSERT_XLOCKED(bp); |
| 1534 | |
| 1535 | /* |
| 1536 | * Handle delayed bremfree() processing. |
| 1537 | */ |
| 1538 | if (bp->b_flags & B_REMFREE) { |
| 1539 | if (bp->b_qindex == qindex) { |
| 1540 | bp->b_flags |= B_REUSE; |
| 1541 | bp->b_flags &= ~B_REMFREE; |
| 1542 | BUF_UNLOCK(bp); |
| 1543 | return; |
| 1544 | } |
| 1545 | bq = bufqueue_acquire(bp); |
| 1546 | bq_remove(bq, bp); |
| 1547 | BQ_UNLOCK(bq); |
| 1548 | } |
| 1549 | bd = bufdomain(bp); |
| 1550 | if (qindex == QUEUE_CLEAN) { |
| 1551 | if (bd->bd_lim != 0) |
| 1552 | bq = &bd->bd_subq[PCPU_GET(cpuid)]; |
| 1553 | else |
| 1554 | bq = bd->bd_cleanq; |
| 1555 | } else |
| 1556 | bq = &bd->bd_dirtyq; |
| 1557 | bq_insert(bq, bp, true); |
| 1558 | } |
| 1559 | |
| 1560 | /* |
| 1561 | * buf_free: |