* Wait for a BIO to finish. */
| 4370 | * Wait for a BIO to finish. |
| 4371 | */ |
| 4372 | int |
| 4373 | biowait(struct bio *bp, const char *wchan) |
| 4374 | { |
| 4375 | struct mtx *mtxp; |
| 4376 | |
| 4377 | mtxp = mtx_pool_find(mtxpool_sleep, bp); |
| 4378 | mtx_lock(mtxp); |
| 4379 | while ((bp->bio_flags & BIO_DONE) == 0) |
| 4380 | msleep(bp, mtxp, PRIBIO, wchan, 0); |
| 4381 | mtx_unlock(mtxp); |
| 4382 | if (bp->bio_error != 0) |
| 4383 | return (bp->bio_error); |
| 4384 | if (!(bp->bio_flags & BIO_ERROR)) |
| 4385 | return (0); |
| 4386 | return (EIO); |
| 4387 | } |
| 4388 | |
| 4389 | void |
| 4390 | biofinish(struct bio *bp, struct devstat *stat, int error) |
no test coverage detected