aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2015-07-01 10:26:04 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2015-07-01 10:26:04 -0400
commit3a2b5b9cd9610f789f5e5f91a010d9fa3ca78632 (patch)
tree1dda09ba5acc30e2128b1231c01186eaa2dcaaa5 /fs/fuse
parent5250921bb0b25e7fc77ba732e569224410743a05 (diff)
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 <mszeredi@suse.cz> Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dev.c21
-rw-r--r--fs/fuse/fuse_i.h15
-rw-r--r--fs/fuse/inode.c10
3 files changed, 30 insertions, 16 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index b6f901a0dbdd..0fae2a7ded77 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1240,6 +1240,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
1240{ 1240{
1241 int err; 1241 int err;
1242 struct fuse_iqueue *fiq = &fc->iq; 1242 struct fuse_iqueue *fiq = &fc->iq;
1243 struct fuse_pqueue *fpq = &fc->pq;
1243 struct fuse_req *req; 1244 struct fuse_req *req;
1244 struct fuse_in *in; 1245 struct fuse_in *in;
1245 unsigned reqsize; 1246 unsigned reqsize;
@@ -1280,7 +1281,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
1280 spin_unlock(&fiq->waitq.lock); 1281 spin_unlock(&fiq->waitq.lock);
1281 1282
1282 spin_lock(&fc->lock); 1283 spin_lock(&fc->lock);
1283 list_add(&req->list, &fc->io); 1284 list_add(&req->list, &fpq->io);
1284 1285
1285 in = &req->in; 1286 in = &req->in;
1286 reqsize = in->h.len; 1287 reqsize = in->h.len;
@@ -1314,7 +1315,7 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file,
1314 if (!test_bit(FR_ISREPLY, &req->flags)) { 1315 if (!test_bit(FR_ISREPLY, &req->flags)) {
1315 request_end(fc, req); 1316 request_end(fc, req);
1316 } else { 1317 } else {
1317 list_move_tail(&req->list, &fc->processing); 1318 list_move_tail(&req->list, &fpq->processing);
1318 set_bit(FR_SENT, &req->flags); 1319 set_bit(FR_SENT, &req->flags);
1319 /* matches barrier in request_wait_answer() */ 1320 /* matches barrier in request_wait_answer() */
1320 smp_mb__after_atomic(); 1321 smp_mb__after_atomic();
@@ -1815,11 +1816,11 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
1815} 1816}
1816 1817
1817/* Look up request on processing list by unique ID */ 1818/* Look up request on processing list by unique ID */
1818static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique) 1819static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique)
1819{ 1820{
1820 struct fuse_req *req; 1821 struct fuse_req *req;
1821 1822
1822 list_for_each_entry(req, &fc->processing, list) { 1823 list_for_each_entry(req, &fpq->processing, list) {
1823 if (req->in.h.unique == unique || req->intr_unique == unique) 1824 if (req->in.h.unique == unique || req->intr_unique == unique)
1824 return req; 1825 return req;
1825 } 1826 }
@@ -1860,6 +1861,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
1860 struct fuse_copy_state *cs, size_t nbytes) 1861 struct fuse_copy_state *cs, size_t nbytes)
1861{ 1862{
1862 int err; 1863 int err;
1864 struct fuse_pqueue *fpq = &fc->pq;
1863 struct fuse_req *req; 1865 struct fuse_req *req;
1864 struct fuse_out_header oh; 1866 struct fuse_out_header oh;
1865 1867
@@ -1892,7 +1894,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
1892 if (!fc->connected) 1894 if (!fc->connected)
1893 goto err_unlock; 1895 goto err_unlock;
1894 1896
1895 req = request_find(fc, oh.unique); 1897 req = request_find(fpq, oh.unique);
1896 if (!req) 1898 if (!req)
1897 goto err_unlock; 1899 goto err_unlock;
1898 1900
@@ -1913,7 +1915,7 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
1913 } 1915 }
1914 1916
1915 clear_bit(FR_SENT, &req->flags); 1917 clear_bit(FR_SENT, &req->flags);
1916 list_move(&req->list, &fc->io); 1918 list_move(&req->list, &fpq->io);
1917 req->out.h = oh; 1919 req->out.h = oh;
1918 set_bit(FR_LOCKED, &req->flags); 1920 set_bit(FR_LOCKED, &req->flags);
1919 cs->req = req; 1921 cs->req = req;
@@ -2112,6 +2114,7 @@ static void end_polls(struct fuse_conn *fc)
2112void fuse_abort_conn(struct fuse_conn *fc) 2114void fuse_abort_conn(struct fuse_conn *fc)
2113{ 2115{
2114 struct fuse_iqueue *fiq = &fc->iq; 2116 struct fuse_iqueue *fiq = &fc->iq;
2117 struct fuse_pqueue *fpq = &fc->pq;
2115 2118
2116 spin_lock(&fc->lock); 2119 spin_lock(&fc->lock);
2117 if (fc->connected) { 2120 if (fc->connected) {
@@ -2122,7 +2125,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
2122 fc->connected = 0; 2125 fc->connected = 0;
2123 fc->blocked = 0; 2126 fc->blocked = 0;
2124 fuse_set_initialized(fc); 2127 fuse_set_initialized(fc);
2125 list_for_each_entry_safe(req, next, &fc->io, list) { 2128 list_for_each_entry_safe(req, next, &fpq->io, list) {
2126 req->out.h.error = -ECONNABORTED; 2129 req->out.h.error = -ECONNABORTED;
2127 spin_lock(&req->waitq.lock); 2130 spin_lock(&req->waitq.lock);
2128 set_bit(FR_ABORTED, &req->flags); 2131 set_bit(FR_ABORTED, &req->flags);
@@ -2142,7 +2145,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
2142 spin_unlock(&fiq->waitq.lock); 2145 spin_unlock(&fiq->waitq.lock);
2143 kill_fasync(&fiq->fasync, SIGIO, POLL_IN); 2146 kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
2144 2147
2145 list_splice_init(&fc->processing, &to_end2); 2148 list_splice_init(&fpq->processing, &to_end2);
2146 while (!list_empty(&to_end1)) { 2149 while (!list_empty(&to_end1)) {
2147 req = list_first_entry(&to_end1, struct fuse_req, list); 2150 req = list_first_entry(&to_end1, struct fuse_req, list);
2148 __fuse_get_request(req); 2151 __fuse_get_request(req);
@@ -2161,7 +2164,7 @@ int fuse_dev_release(struct inode *inode, struct file *file)
2161{ 2164{
2162 struct fuse_conn *fc = fuse_get_conn(file); 2165 struct fuse_conn *fc = fuse_get_conn(file);
2163 if (fc) { 2166 if (fc) {
2164 WARN_ON(!list_empty(&fc->io)); 2167 WARN_ON(!list_empty(&fc->pq.io));
2165 WARN_ON(fc->iq.fasync != NULL); 2168 WARN_ON(fc->iq.fasync != NULL);
2166 fuse_abort_conn(fc); 2169 fuse_abort_conn(fc);
2167 fuse_conn_put(fc); 2170 fuse_conn_put(fc);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index e8be4611fb8e..3620eec018a4 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -401,6 +401,14 @@ struct fuse_iqueue {
401 struct fasync_struct *fasync; 401 struct fasync_struct *fasync;
402}; 402};
403 403
404struct fuse_pqueue {
405 /** The list of requests being processed */
406 struct list_head processing;
407
408 /** The list of requests under I/O */
409 struct list_head io;
410};
411
404/** 412/**
405 * A Fuse connection. 413 * A Fuse connection.
406 * 414 *
@@ -435,11 +443,8 @@ struct fuse_conn {
435 /** Input queue */ 443 /** Input queue */
436 struct fuse_iqueue iq; 444 struct fuse_iqueue iq;
437 445
438 /** The list of requests being processed */ 446 /** Processing queue */
439 struct list_head processing; 447 struct fuse_pqueue pq;
440
441 /** The list of requests under I/O */
442 struct list_head io;
443 448
444 /** The next unique kernel file handle */ 449 /** The next unique kernel file handle */
445 u64 khctr; 450 u64 khctr;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index caf77d5a6e8d..7b146bb68dd5 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -577,6 +577,13 @@ static void fuse_iqueue_init(struct fuse_iqueue *fiq)
577 fiq->connected = 1; 577 fiq->connected = 1;
578} 578}
579 579
580static void fuse_pqueue_init(struct fuse_pqueue *fpq)
581{
582 memset(fpq, 0, sizeof(struct fuse_pqueue));
583 INIT_LIST_HEAD(&fpq->processing);
584 INIT_LIST_HEAD(&fpq->io);
585}
586
580void fuse_conn_init(struct fuse_conn *fc) 587void fuse_conn_init(struct fuse_conn *fc)
581{ 588{
582 memset(fc, 0, sizeof(*fc)); 589 memset(fc, 0, sizeof(*fc));
@@ -586,8 +593,7 @@ void fuse_conn_init(struct fuse_conn *fc)
586 init_waitqueue_head(&fc->blocked_waitq); 593 init_waitqueue_head(&fc->blocked_waitq);
587 init_waitqueue_head(&fc->reserved_req_waitq); 594 init_waitqueue_head(&fc->reserved_req_waitq);
588 fuse_iqueue_init(&fc->iq); 595 fuse_iqueue_init(&fc->iq);
589 INIT_LIST_HEAD(&fc->processing); 596 fuse_pqueue_init(&fc->pq);
590 INIT_LIST_HEAD(&fc->io);
591 INIT_LIST_HEAD(&fc->bg_queue); 597 INIT_LIST_HEAD(&fc->bg_queue);
592 INIT_LIST_HEAD(&fc->entry); 598 INIT_LIST_HEAD(&fc->entry);
593 atomic_set(&fc->num_waiting, 0); 599 atomic_set(&fc->num_waiting, 0);