[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>

authored by

Miklos Szeredi and committed by
Linus Torvalds
d77a1d5b 83cfd493

+10 -6
+4 -4
fs/fuse/dev.c
··· 181 */ 182 static void request_end(struct fuse_conn *fc, struct fuse_req *req) 183 { 184 req->state = FUSE_REQ_FINISHED; 185 spin_unlock(&fuse_lock); 186 if (req->background) { ··· 642 643 req = list_entry(fc->pending.next, struct fuse_req, list); 644 req->state = FUSE_REQ_READING; 645 - list_del_init(&req->list); 646 647 in = &req->in; 648 reqsize = in->h.len; ··· 676 request_end(fc, req); 677 else { 678 req->state = FUSE_REQ_SENT; 679 - list_add_tail(&req->list, &fc->processing); 680 spin_unlock(&fuse_lock); 681 } 682 return reqsize; ··· 769 if (!req) 770 goto err_unlock; 771 772 - list_del_init(&req->list); 773 if (req->interrupted) { 774 spin_unlock(&fuse_lock); 775 fuse_copy_finish(&cs); ··· 776 request_end(fc, req); 777 return -ENOENT; 778 } 779 req->out.h = oh; 780 req->locked = 1; 781 cs.req = req; ··· 836 while (!list_empty(head)) { 837 struct fuse_req *req; 838 req = list_entry(head->next, struct fuse_req, list); 839 - list_del_init(&req->list); 840 req->out.h.error = -ECONNABORTED; 841 request_end(fc, req); 842 spin_lock(&fuse_lock);
··· 181 */ 182 static void request_end(struct fuse_conn *fc, struct fuse_req *req) 183 { 184 + list_del(&req->list); 185 req->state = FUSE_REQ_FINISHED; 186 spin_unlock(&fuse_lock); 187 if (req->background) { ··· 641 642 req = list_entry(fc->pending.next, struct fuse_req, list); 643 req->state = FUSE_REQ_READING; 644 + list_move(&req->list, &fc->io); 645 646 in = &req->in; 647 reqsize = in->h.len; ··· 675 request_end(fc, req); 676 else { 677 req->state = FUSE_REQ_SENT; 678 + list_move_tail(&req->list, &fc->processing); 679 spin_unlock(&fuse_lock); 680 } 681 return reqsize; ··· 768 if (!req) 769 goto err_unlock; 770 771 if (req->interrupted) { 772 spin_unlock(&fuse_lock); 773 fuse_copy_finish(&cs); ··· 776 request_end(fc, req); 777 return -ENOENT; 778 } 779 + list_move(&req->list, &fc->io); 780 req->out.h = oh; 781 req->locked = 1; 782 cs.req = req; ··· 835 while (!list_empty(head)) { 836 struct fuse_req *req; 837 req = list_entry(head->next, struct fuse_req, list); 838 req->out.h.error = -ECONNABORTED; 839 request_end(fc, req); 840 spin_lock(&fuse_lock);
+5 -2
fs/fuse/fuse_i.h
··· 124 * A request to the client 125 */ 126 struct fuse_req { 127 - /** This can be on either unused_list, pending or processing 128 - lists in fuse_conn */ 129 struct list_head list; 130 131 /** Entry on the background list */ ··· 222 223 /** The list of requests being processed */ 224 struct list_head processing; 225 226 /** Requests put in the background (RELEASE or any other 227 interrupted request) */
··· 124 * A request to the client 125 */ 126 struct fuse_req { 127 + /** This can be on either unused_list, pending processing or 128 + io lists in fuse_conn */ 129 struct list_head list; 130 131 /** Entry on the background list */ ··· 222 223 /** The list of requests being processed */ 224 struct list_head processing; 225 + 226 + /** The list of requests under I/O */ 227 + struct list_head io; 228 229 /** Requests put in the background (RELEASE or any other 230 interrupted request) */
+1
fs/fuse/inode.c
··· 382 init_waitqueue_head(&fc->waitq); 383 INIT_LIST_HEAD(&fc->pending); 384 INIT_LIST_HEAD(&fc->processing); 385 INIT_LIST_HEAD(&fc->unused_list); 386 INIT_LIST_HEAD(&fc->background); 387 sema_init(&fc->outstanding_sem, 1); /* One for INIT */
··· 382 init_waitqueue_head(&fc->waitq); 383 INIT_LIST_HEAD(&fc->pending); 384 INIT_LIST_HEAD(&fc->processing); 385 + INIT_LIST_HEAD(&fc->io); 386 INIT_LIST_HEAD(&fc->unused_list); 387 INIT_LIST_HEAD(&fc->background); 388 sema_init(&fc->outstanding_sem, 1); /* One for INIT */