summaryrefslogtreecommitdiffstats
path: root/fs/fuse/dev.c
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-01-16 22:14:31 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-16 23:15:30 -0800
commit83cfd4935124b165e942c317dc3e9ebb0a3e6a63 (patch)
tree6b6276dde7fbe07dd9e5d44332eef5f2b9451d4c /fs/fuse/dev.c
parent6383bdaa2ed2d461d9f4d369dfaa9d610fc972e3 (diff)
downloadlinux-83cfd4935124b165e942c317dc3e9ebb0a3e6a63.tar.bz2
[PATCH] fuse: introduce unified request state
The state of request was made up of 2 bitfields (->sent and ->finished) and of the fact that the request was on a list or not. Unify this into a single state field. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse/dev.c')
-rw-r--r--fs/fuse/dev.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 4f1ca7b119ed..bc8a3846a4bf 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -181,7 +181,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
*/
static void request_end(struct fuse_conn *fc, struct fuse_req *req)
{
- req->finished = 1;
+ req->state = FUSE_REQ_FINISHED;
spin_unlock(&fuse_lock);
if (req->background) {
down_read(&fc->sbput_sem);
@@ -250,10 +250,10 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
spin_unlock(&fuse_lock);
block_sigs(&oldset);
- wait_event_interruptible(req->waitq, req->finished);
+ wait_event_interruptible(req->waitq, req->state == FUSE_REQ_FINISHED);
restore_sigs(&oldset);
spin_lock(&fuse_lock);
- if (req->finished)
+ if (req->state == FUSE_REQ_FINISHED)
return;
req->out.h.error = -EINTR;
@@ -268,10 +268,10 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
wait_event(req->waitq, !req->locked);
spin_lock(&fuse_lock);
}
- if (!req->sent && !list_empty(&req->list)) {
+ if (req->state == FUSE_REQ_PENDING) {
list_del(&req->list);
__fuse_put_request(req);
- } else if (!req->finished && req->sent)
+ } else if (req->state == FUSE_REQ_SENT)
background_request(fc, req);
}
@@ -306,6 +306,7 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
fc->outstanding_debt++;
}
list_add_tail(&req->list, &fc->pending);
+ req->state = FUSE_REQ_PENDING;
wake_up(&fc->waitq);
}
@@ -639,6 +640,7 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
goto err_unlock;
req = list_entry(fc->pending.next, struct fuse_req, list);
+ req->state = FUSE_REQ_READING;
list_del_init(&req->list);
in = &req->in;
@@ -672,7 +674,7 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
if (!req->isreply)
request_end(fc, req);
else {
- req->sent = 1;
+ req->state = FUSE_REQ_SENT;
list_add_tail(&req->list, &fc->processing);
spin_unlock(&fuse_lock);
}