X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/3b6a05fc894d0c1a3d431045ee5a53955ba093a0..df1e857ac4d1410ae2bd354e361210b842ab7bc8:/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..c5d688f 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,14 +103,19 @@ void blkio_complete(struct blkio_req* req) { req->flags &= ~(BLKIO_BUSY | BLKIO_PENDING); + if (req->completed) { req->completed(req); } + + // FIXME Not working in first process! Need a dummy process. + // 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); } req->io_ctx->busy--; - - blkio_schedule(req->io_ctx); } \ No newline at end of file