X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/3b6a05fc894d0c1a3d431045ee5a53955ba093a0..e6416905c4afb34e61276cdc07c44813a3ebc5e7:/lunaix-os/kernel/block/blkio.c?ds=sidebyside diff --git a/lunaix-os/kernel/block/blkio.c b/lunaix-os/kernel/block/blkio.c index 44531c4..bc0178c 100644 --- a/lunaix-os/kernel/block/blkio.c +++ b/lunaix-os/kernel/block/blkio.c @@ -24,6 +24,7 @@ __blkio_req_create(struct vecbuf* buffer, .flags = options, .evt_args = evt_args }; breq->vbuf = buffer; + waitq_init(&breq->wait); return breq; } @@ -76,7 +77,7 @@ blkio_commit(struct blkio_context* ctx, struct blkio_req* req) llist_append(&ctx->queue, &req->reqs); // if the pipeline is not running (e.g., stalling). Then we should schedule - // one immediately and kick it start. + // one immediately and kick it started. if (!ctx->busy) { blkio_schedule(ctx); } @@ -102,9 +103,15 @@ void blkio_complete(struct blkio_req* req) { req->flags &= ~(BLKIO_BUSY | BLKIO_PENDING); + if (req->completed) { req->completed(req); } + + // Wake all blocked processes on completion, + // albeit should be no more than one process in everycase (by design) + pwake_all(&req->wait); + if ((req->flags & BLKIO_FOC)) { blkio_free_req(req); }