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>
*/
static void request_end(struct fuse_conn *fc, struct fuse_req *req)
{
*/
static void request_end(struct fuse_conn *fc, struct fuse_req *req)
{
+ req->state = FUSE_REQ_FINISHED;
spin_unlock(&fuse_lock);
if (req->background) {
down_read(&fc->sbput_sem);
spin_unlock(&fuse_lock);
if (req->background) {
down_read(&fc->sbput_sem);
spin_unlock(&fuse_lock);
block_sigs(&oldset);
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);
restore_sigs(&oldset);
spin_lock(&fuse_lock);
+ if (req->state == FUSE_REQ_FINISHED)
return;
req->out.h.error = -EINTR;
return;
req->out.h.error = -EINTR;
wait_event(req->waitq, !req->locked);
spin_lock(&fuse_lock);
}
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);
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);
}
background_request(fc, req);
}
fc->outstanding_debt++;
}
list_add_tail(&req->list, &fc->pending);
fc->outstanding_debt++;
}
list_add_tail(&req->list, &fc->pending);
+ req->state = FUSE_REQ_PENDING;
goto err_unlock;
req = list_entry(fc->pending.next, struct fuse_req, list);
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;
list_del_init(&req->list);
in = &req->in;
if (!req->isreply)
request_end(fc, req);
else {
if (!req->isreply)
request_end(fc, req);
else {
+ req->state = FUSE_REQ_SENT;
list_add_tail(&req->list, &fc->processing);
spin_unlock(&fuse_lock);
}
list_add_tail(&req->list, &fc->processing);
spin_unlock(&fuse_lock);
}
struct fuse_arg args[3];
};
struct fuse_arg args[3];
};
+/** The request state */
+enum fuse_req_state {
+ FUSE_REQ_INIT = 0,
+ FUSE_REQ_PENDING,
+ FUSE_REQ_READING,
+ FUSE_REQ_SENT,
+ FUSE_REQ_FINISHED
+};
+
/**
* A request to the client
*/
/**
* A request to the client
*/
/** Data is being copied to/from the request */
unsigned locked:1;
/** Data is being copied to/from the request */
unsigned locked:1;
- /** Request has been sent to userspace */
- unsigned sent:1;
-
- /** The request is finished */
- unsigned finished:1;
+ /** State of the request */
+ enum fuse_req_state state;
/** The request input */
struct fuse_in in;
/** The request input */
struct fuse_in in;