Backport from ml:

commit 3a2b5b9cd9610f789f5e5f91a010d9fa3ca78632
Author: Miklos Szeredi <[email protected]>
Date:   Wed Jul 1 16:26:04 2015 +0200

    fuse: separate out processing queue

    This is just two fields: fc->io and fc->processing.

    This patch just rearranges the fields, no functional change.

    Signed-off-by: Miklos Szeredi <[email protected]>
    Reviewed-by: Ashish Samant <[email protected]>

Signed-off-by: Maxim Patlasov <[email protected]>
---
 fs/fuse/control.c |    4 ++--
 fs/fuse/dev.c     |   21 ++++++++++++---------
 fs/fuse/fuse_i.h  |   15 ++++++++++-----
 fs/fuse/inode.c   |   14 ++++++++++----
 4 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 61a6a48..10201ac 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -281,13 +281,13 @@ static int fuse_conn_seq_open(struct file *filp, int 
list_id)
        fcp->conn = conn;
        switch (list_id) {
        case FUSE_PROCESSING_REQ:
-               fcp->req_list = &conn->processing;
+               fcp->req_list = &conn->pq.processing;
                break;
        case FUSE_PENDING_REQ:
                fcp->req_list = &conn->iq.pending;
                break;
        case FUSE_IO_REQ:
-               fcp->req_list = &conn->io;
+               fcp->req_list = &conn->pq.io;
                break;
        default:
                BUG();
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 09110d4..77ff42c 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1204,6 +1204,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, 
struct file *file,
 {
        int err;
        struct fuse_iqueue *fiq = &fc->iq;
+       struct fuse_pqueue *fpq = &fc->pq;
        struct fuse_req *req;
        struct fuse_in *in;
        unsigned reqsize;
@@ -1244,7 +1245,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, 
struct file *file,
        spin_unlock(&fiq->waitq.lock);
 
        spin_lock(&fc->lock);
-       list_add(&req->list, &fc->io);
+       list_add(&req->list, &fpq->io);
 
        in = &req->in;
        reqsize = in->h.len;
@@ -1278,7 +1279,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, 
struct file *file,
        if (!test_bit(FR_ISREPLY, &req->flags)) {
                request_end(fc, req);
        } else {
-               list_move_tail(&req->list, &fc->processing);
+               list_move_tail(&req->list, &fpq->processing);
                set_bit(FR_SENT, &req->flags);
                /* matches barrier in request_wait_answer() */
                smp_mb__after_atomic();
@@ -1811,11 +1812,11 @@ static int fuse_notify(struct fuse_conn *fc, enum 
fuse_notify_code code,
 }
 
 /* Look up request on processing list by unique ID */
-static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique)
+static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique)
 {
        struct fuse_req *req;
 
-       list_for_each_entry(req, &fc->processing, list) {
+       list_for_each_entry(req, &fpq->processing, list) {
                if (req->in.h.unique == unique || req->intr_unique == unique)
                        return req;
        }
@@ -1856,6 +1857,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
                                 struct fuse_copy_state *cs, size_t nbytes)
 {
        int err;
+       struct fuse_pqueue *fpq = &fc->pq;
        struct fuse_req *req;
        struct fuse_out_header oh;
 
@@ -1888,7 +1890,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
        if (!fc->connected)
                goto err_unlock;
 
-       req = request_find(fc, oh.unique);
+       req = request_find(fpq, oh.unique);
        if (!req)
                goto err_unlock;
 
@@ -1909,7 +1911,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
        }
 
        clear_bit(FR_SENT, &req->flags);
-       list_move(&req->list, &fc->io);
+       list_move(&req->list, &fpq->io);
        req->out.h = oh;
        set_bit(FR_LOCKED, &req->flags);
        cs->req = req;
@@ -2105,6 +2107,7 @@ static void end_polls(struct fuse_conn *fc)
 void fuse_abort_conn(struct fuse_conn *fc)
 {
        struct fuse_iqueue *fiq = &fc->iq;
+       struct fuse_pqueue *fpq = &fc->pq;
 
        spin_lock(&fc->lock);
        if (fc->connected) {
@@ -2115,7 +2118,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
                fc->connected = 0;
                fc->blocked = 0;
                fuse_set_initialized(fc);
-               list_for_each_entry_safe(req, next, &fc->io, list) {
+               list_for_each_entry_safe(req, next, &fpq->io, list) {
                        req->out.h.error = -ECONNABORTED;
                        spin_lock(&req->waitq.lock);
                        set_bit(FR_ABORTED, &req->flags);
@@ -2135,7 +2138,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
                spin_unlock(&fiq->waitq.lock);
                kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
 
-               list_splice_init(&fc->processing, &to_end2);
+               list_splice_init(&fpq->processing, &to_end2);
                while (!list_empty(&to_end1)) {
                        req = list_first_entry(&to_end1, struct fuse_req, list);
                        __fuse_get_request(req);
@@ -2154,7 +2157,7 @@ int fuse_dev_release(struct inode *inode, struct file 
*file)
 {
        struct fuse_conn *fc = fuse_get_conn(file);
        if (fc) {
-               WARN_ON(!list_empty(&fc->io));
+               WARN_ON(!list_empty(&fc->pq.io));
                WARN_ON(fc->iq.fasync != NULL);
                fuse_abort_conn(fc);
                fuse_conn_put(fc);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 0892108..d609749 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -434,6 +434,14 @@ struct fuse_iqueue {
        struct fasync_struct *fasync;
 };
 
+struct fuse_pqueue {
+       /** The list of requests being processed */
+       struct list_head processing;
+
+       /** The list of requests under I/O */
+       struct list_head io;
+};
+
 /**
  * A Fuse connection.
  *
@@ -469,11 +477,8 @@ struct fuse_conn {
        /** Input queue */
        struct fuse_iqueue iq;
 
-       /** The list of requests being processed */
-       struct list_head processing;
-
-       /** The list of requests under I/O */
-       struct list_head io;
+       /** Processing queue */
+       struct fuse_pqueue pq;
 
        /** The next unique kernel file handle */
        u64 khctr;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 446d2e1..d5d6a00 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -421,10 +421,10 @@ int fuse_invalidate_files(struct fuse_conn *fc, u64 
nodeid)
        err = filemap_write_and_wait(inode->i_mapping);
        if (!err || err == -EIO) { /* AS_EIO might trigger -EIO */
                spin_lock(&fc->lock);
-               fuse_kill_requests(fc, inode, &fc->processing);
+               fuse_kill_requests(fc, inode, &fc->pq.processing);
                fuse_kill_requests(fc, inode, &fc->iq.pending);
                fuse_kill_requests(fc, inode, &fc->bg_queue);
-               fuse_kill_requests(fc, inode, &fc->io);
+               fuse_kill_requests(fc, inode, &fc->pq.io);
                wake_up(&fi->page_waitq); /* readpage[s] can wait on fuse wb */
                spin_unlock(&fc->lock);
 
@@ -697,6 +697,13 @@ static void fuse_iqueue_init(struct fuse_iqueue *fiq)
        fiq->connected = 1;
 }
 
+static void fuse_pqueue_init(struct fuse_pqueue *fpq)
+{
+       memset(fpq, 0, sizeof(struct fuse_pqueue));
+       INIT_LIST_HEAD(&fpq->processing);
+       INIT_LIST_HEAD(&fpq->io);
+}
+
 void fuse_conn_init(struct fuse_conn *fc)
 {
        memset(fc, 0, sizeof(*fc));
@@ -707,8 +714,7 @@ void fuse_conn_init(struct fuse_conn *fc)
        init_waitqueue_head(&fc->blocked_waitq);
        init_waitqueue_head(&fc->reserved_req_waitq);
        fuse_iqueue_init(&fc->iq);
-       INIT_LIST_HEAD(&fc->processing);
-       INIT_LIST_HEAD(&fc->io);
+       fuse_pqueue_init(&fc->pq);
        INIT_LIST_HEAD(&fc->bg_queue);
        INIT_LIST_HEAD(&fc->entry);
        INIT_LIST_HEAD(&fc->conn_files);

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

Reply via email to