From: Miklos Szeredi Date: Wed, 1 Jul 2015 14:26:00 +0000 (+0200) Subject: fuse: simplify req states X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7a3b2c754749c73b4a255b2a1070c24dba589098;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git fuse: simplify req states 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 Reviewed-by: Ashish Samant --- diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 638aafde6e22..e5c541b7c7af 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -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); } @@ -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; @@ -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); diff --git a/fs/fuse/file.c b/fs/fuse/file.c index bf272263c1a2..d0c23d075427 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -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); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 7257adba7ecd..3fd65f613515 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -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 };