aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-01-17 01:14:31 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-17 02:15:30 -0500
commitd77a1d5b611742c538364f041ff4610d27b14fe7 (patch)
treec18cf2c112ad17e07a3e0d0459c55f04b257e3e3 /fs/fuse
parent83cfd4935124b165e942c317dc3e9ebb0a3e6a63 (diff)
[PATCH] fuse: introduce list for requests under I/O
Create a new list for requests in the process of being transfered to/from userspace. This will be needed to be able to abort all requests even those currently under I/O Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dev.c8
-rw-r--r--fs/fuse/fuse_i.h7
-rw-r--r--fs/fuse/inode.c1
3 files changed, 10 insertions, 6 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index bc8a3846a4bf..609875dbd212 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -181,6 +181,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
181 */ 181 */
182static void request_end(struct fuse_conn *fc, struct fuse_req *req) 182static void request_end(struct fuse_conn *fc, struct fuse_req *req)
183{ 183{
184 list_del(&req->list);
184 req->state = FUSE_REQ_FINISHED; 185 req->state = FUSE_REQ_FINISHED;
185 spin_unlock(&fuse_lock); 186 spin_unlock(&fuse_lock);
186 if (req->background) { 187 if (req->background) {
@@ -641,7 +642,7 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
641 642
642 req = list_entry(fc->pending.next, struct fuse_req, list); 643 req = list_entry(fc->pending.next, struct fuse_req, list);
643 req->state = FUSE_REQ_READING; 644 req->state = FUSE_REQ_READING;
644 list_del_init(&req->list); 645 list_move(&req->list, &fc->io);
645 646
646 in = &req->in; 647 in = &req->in;
647 reqsize = in->h.len; 648 reqsize = in->h.len;
@@ -675,7 +676,7 @@ static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov,
675 request_end(fc, req); 676 request_end(fc, req);
676 else { 677 else {
677 req->state = FUSE_REQ_SENT; 678 req->state = FUSE_REQ_SENT;
678 list_add_tail(&req->list, &fc->processing); 679 list_move_tail(&req->list, &fc->processing);
679 spin_unlock(&fuse_lock); 680 spin_unlock(&fuse_lock);
680 } 681 }
681 return reqsize; 682 return reqsize;
@@ -768,7 +769,6 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
768 if (!req) 769 if (!req)
769 goto err_unlock; 770 goto err_unlock;
770 771
771 list_del_init(&req->list);
772 if (req->interrupted) { 772 if (req->interrupted) {
773 spin_unlock(&fuse_lock); 773 spin_unlock(&fuse_lock);
774 fuse_copy_finish(&cs); 774 fuse_copy_finish(&cs);
@@ -776,6 +776,7 @@ static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov,
776 request_end(fc, req); 776 request_end(fc, req);
777 return -ENOENT; 777 return -ENOENT;
778 } 778 }
779 list_move(&req->list, &fc->io);
779 req->out.h = oh; 780 req->out.h = oh;
780 req->locked = 1; 781 req->locked = 1;
781 cs.req = req; 782 cs.req = req;
@@ -835,7 +836,6 @@ static void end_requests(struct fuse_conn *fc, struct list_head *head)
835 while (!list_empty(head)) { 836 while (!list_empty(head)) {
836 struct fuse_req *req; 837 struct fuse_req *req;
837 req = list_entry(head->next, struct fuse_req, list); 838 req = list_entry(head->next, struct fuse_req, list);
838 list_del_init(&req->list);
839 req->out.h.error = -ECONNABORTED; 839 req->out.h.error = -ECONNABORTED;
840 request_end(fc, req); 840 request_end(fc, req);
841 spin_lock(&fuse_lock); 841 spin_lock(&fuse_lock);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 8cc87ebeed2e..5742253164d9 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -124,8 +124,8 @@ enum fuse_req_state {
124 * A request to the client 124 * A request to the client
125 */ 125 */
126struct fuse_req { 126struct fuse_req {
127 /** This can be on either unused_list, pending or processing 127 /** This can be on either unused_list, pending processing or
128 lists in fuse_conn */ 128 io lists in fuse_conn */
129 struct list_head list; 129 struct list_head list;
130 130
131 /** Entry on the background list */ 131 /** Entry on the background list */
@@ -223,6 +223,9 @@ struct fuse_conn {
223 /** The list of requests being processed */ 223 /** The list of requests being processed */
224 struct list_head processing; 224 struct list_head processing;
225 225
226 /** The list of requests under I/O */
227 struct list_head io;
228
226 /** Requests put in the background (RELEASE or any other 229 /** Requests put in the background (RELEASE or any other
227 interrupted request) */ 230 interrupted request) */
228 struct list_head background; 231 struct list_head background;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index ceee75df7b32..d7aaffe979dd 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -382,6 +382,7 @@ static struct fuse_conn *new_conn(void)
382 init_waitqueue_head(&fc->waitq); 382 init_waitqueue_head(&fc->waitq);
383 INIT_LIST_HEAD(&fc->pending); 383 INIT_LIST_HEAD(&fc->pending);
384 INIT_LIST_HEAD(&fc->processing); 384 INIT_LIST_HEAD(&fc->processing);
385 INIT_LIST_HEAD(&fc->io);
385 INIT_LIST_HEAD(&fc->unused_list); 386 INIT_LIST_HEAD(&fc->unused_list);
386 INIT_LIST_HEAD(&fc->background); 387 INIT_LIST_HEAD(&fc->background);
387 sema_init(&fc->outstanding_sem, 1); /* One for INIT */ 388 sema_init(&fc->outstanding_sem, 1); /* One for INIT */