* Return the locked bufqueue that bp is a member of. */
| 1494 | * Return the locked bufqueue that bp is a member of. |
| 1495 | */ |
| 1496 | static struct bufqueue * |
| 1497 | bufqueue_acquire(struct buf *bp) |
| 1498 | { |
| 1499 | struct bufqueue *bq, *nbq; |
| 1500 | |
| 1501 | /* |
| 1502 | * bp can be pushed from a per-cpu queue to the |
| 1503 | * cleanq while we're waiting on the lock. Retry |
| 1504 | * if the queues don't match. |
| 1505 | */ |
| 1506 | bq = bufqueue(bp); |
| 1507 | BQ_LOCK(bq); |
| 1508 | for (;;) { |
| 1509 | nbq = bufqueue(bp); |
| 1510 | if (bq == nbq) |
| 1511 | break; |
| 1512 | BQ_UNLOCK(bq); |
| 1513 | BQ_LOCK(nbq); |
| 1514 | bq = nbq; |
| 1515 | } |
| 1516 | return (bq); |
| 1517 | } |
| 1518 | |
| 1519 | /* |
| 1520 | * binsfree: |