| 2454 | } |
| 2455 | |
| 2456 | static void |
| 2457 | aio_biowakeup(struct bio *bp) |
| 2458 | { |
| 2459 | struct kaiocb *job = (struct kaiocb *)bp->bio_caller1; |
| 2460 | size_t nbytes; |
| 2461 | long bcount = bp->bio_bcount; |
| 2462 | long resid = bp->bio_resid; |
| 2463 | int error, opcode, nblks; |
| 2464 | int bio_error = bp->bio_error; |
| 2465 | uint16_t flags = bp->bio_flags; |
| 2466 | |
| 2467 | opcode = job->uaiocb.aio_lio_opcode; |
| 2468 | |
| 2469 | aio_biocleanup(bp); |
| 2470 | |
| 2471 | nbytes =bcount - resid; |
| 2472 | atomic_add_acq_long(&job->nbytes, nbytes); |
| 2473 | nblks = btodb(nbytes); |
| 2474 | error = 0; |
| 2475 | /* |
| 2476 | * If multiple bios experienced an error, the job will reflect the |
| 2477 | * error of whichever failed bio completed last. |
| 2478 | */ |
| 2479 | if (flags & BIO_ERROR) |
| 2480 | atomic_set_int(&job->error, bio_error); |
| 2481 | if (opcode & LIO_WRITE) |
| 2482 | atomic_add_int(&job->outblock, nblks); |
| 2483 | else |
| 2484 | atomic_add_int(&job->inblock, nblks); |
| 2485 | atomic_subtract_int(&job->nbio, 1); |
| 2486 | |
| 2487 | |
| 2488 | if (atomic_load_int(&job->nbio) == 0) { |
| 2489 | if (atomic_load_int(&job->error)) |
| 2490 | aio_complete(job, -1, job->error); |
| 2491 | else |
| 2492 | aio_complete(job, atomic_load_long(&job->nbytes), 0); |
| 2493 | } |
| 2494 | } |
| 2495 | |
| 2496 | /* syscall - wait for the next completion of an aio request */ |
| 2497 | static int |
nothing calls this directly
no test coverage detected