Skip to content

Commit

Permalink
fuse: simplify req states
Browse files Browse the repository at this point in the history
FUSE_REQ_INIT is actually the same state as FUSE_REQ_PENDING and
FUSE_REQ_READING and FUSE_REQ_WRITING can be merged into a common
FUSE_REQ_IO state.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
  • Loading branch information
Miklos Szeredi committed Jul 1, 2015
1 parent c477526 commit 7a3b2c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 2 additions & 3 deletions fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
req->in.h.len = sizeof(struct fuse_in_header) +
len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
list_add_tail(&req->list, &fc->pending);
req->state = FUSE_REQ_PENDING;
wake_up(&fc->waitq);
kill_fasync(&fc->fasync, SIGIO, POLL_IN);
}
Expand Down Expand Up @@ -1274,7 +1273,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
}

req = list_entry(fc->pending.next, struct fuse_req, list);
req->state = FUSE_REQ_READING;
req->state = FUSE_REQ_IO;
list_move(&req->list, &fc->io);

in = &req->in;
Expand Down Expand Up @@ -1905,7 +1904,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
return nbytes;
}

req->state = FUSE_REQ_WRITING;
req->state = FUSE_REQ_IO;
list_move(&req->list, &fc->io);
req->out.h = oh;
set_bit(FR_LOCKED, &req->flags);
Expand Down
3 changes: 1 addition & 2 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,8 +1743,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req,
}
}

if (old_req->num_pages == 1 && (old_req->state == FUSE_REQ_INIT ||
old_req->state == FUSE_REQ_PENDING)) {
if (old_req->num_pages == 1 && old_req->state == FUSE_REQ_PENDING) {
struct backing_dev_info *bdi = inode_to_bdi(page->mapping->host);

copy_highpage(old_req->pages[0], page);
Expand Down
6 changes: 2 additions & 4 deletions fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,9 @@ struct fuse_args {

/** The request state */
enum fuse_req_state {
FUSE_REQ_INIT = 0,
FUSE_REQ_PENDING,
FUSE_REQ_READING,
FUSE_REQ_PENDING = 0,
FUSE_REQ_IO,
FUSE_REQ_SENT,
FUSE_REQ_WRITING,
FUSE_REQ_FINISHED
};

Expand Down

0 comments on commit 7a3b2c7

Please sign in to comment.