From 6a71c766e60a9ac12876a0ea8a10c997df2507a3 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 7 Apr 2022 22:21:31 +0200 Subject: kernel/vfs: implement a vfs request queue --- src/kernel/vfs/request.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/kernel/vfs/request.c') diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index 45a7ae7..0214ca7 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -10,10 +10,11 @@ int vfs_request_create(struct vfs_request req_) { struct vfs_request *req; int ret; process_current->state = PS_WAITS4FS; + process_current->waits4fs.queue_next = NULL; // the request is owned by the caller - process_current->pending_req = req_; - req = &process_current->pending_req; + process_current->waits4fs.req = req_; + req = &process_current->waits4fs.req; if (!req->backend) return vfs_request_finish(req, -1); @@ -26,8 +27,10 @@ int vfs_request_create(struct vfs_request req_) { case VFS_BACK_USER: if (req->backend->handler == NULL) { // backend isn't ready yet, join the queue - assert(req->backend->queue == NULL); // TODO implement a proper queue - req->backend->queue = process_current; + struct process **iter = &req->backend->queue; + while (*iter != NULL) + iter = &(*iter)->waits4fs.queue_next; + *iter = process_current; process_switch_any(); } else { vfs_request_pass2handler(req); -- cgit v1.2.3