Backport from ml:

commit 7a3b2c754749c73b4a255b2a1070c24dba589098
Author: Miklos Szeredi <[email protected]>
Date:   Wed Jul 1 16:26:00 2015 +0200

    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 <[email protected]>
    Reviewed-by: Ashish Samant <[email protected]>

Signed-off-by: Maxim Patlasov <[email protected]>
---
 fs/fuse/dev.c    |    5 ++---
 fs/fuse/file.c   |    2 +-
 fs/fuse/fuse_i.h |    6 ++----
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 016a854..79bc649 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -310,7 +310,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);
 }
@@ -1238,7 +1237,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;
@@ -1903,7 +1902,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 503e35c..bdb0e49 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -163,7 +163,7 @@ static void fuse_file_put(struct fuse_file *ff, bool sync)
                        __clear_bit(FR_BACKGROUND, &req->flags);
                        fuse_request_send(ff->fc, req);
                        if (req->out.h.error == -EINTR) {
-                               req->state = FUSE_REQ_INIT;
+                               req->state = FUSE_REQ_PENDING;
                                req->out.h.error = 0;
                                goto async_fallback;
                        }
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index b96b6e7..93deda7 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -260,11 +260,9 @@ struct fuse_page_desc {
 
 /** 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
 };
 

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to