summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2019-06-05 15:50:43 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2019-09-12 08:59:40 -0400
commit4388c5aac4bae5c83a2c66882043942002ba09a2 (patch)
treee57b579948968968447508ad7747ff644b9b89c7
parent79d96efffda7597b41968d5d8813b39fc2965f1b (diff)
fuse: export fuse_dequeue_forget() function
File systems like virtio-fs need to do not have to play directly with forget list data structures. There is a helper function use that instead. Rename dequeue_forget() to fuse_dequeue_forget() and export it so that stacked filesystems can use it. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r--fs/fuse/dev.c13
-rw-r--r--fs/fuse/fuse_i.h4
2 files changed, 11 insertions, 6 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 151176a99dc2..943bc5cf941a 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1033,9 +1033,9 @@ __releases(fiq->lock)
1033 return err ? err : reqsize; 1033 return err ? err : reqsize;
1034} 1034}
1035 1035
1036static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq, 1036struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq,
1037 unsigned max, 1037 unsigned int max,
1038 unsigned *countp) 1038 unsigned int *countp)
1039{ 1039{
1040 struct fuse_forget_link *head = fiq->forget_list_head.next; 1040 struct fuse_forget_link *head = fiq->forget_list_head.next;
1041 struct fuse_forget_link **newhead = &head; 1041 struct fuse_forget_link **newhead = &head;
@@ -1054,6 +1054,7 @@ static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq,
1054 1054
1055 return head; 1055 return head;
1056} 1056}
1057EXPORT_SYMBOL(fuse_dequeue_forget);
1057 1058
1058static int fuse_read_single_forget(struct fuse_iqueue *fiq, 1059static int fuse_read_single_forget(struct fuse_iqueue *fiq,
1059 struct fuse_copy_state *cs, 1060 struct fuse_copy_state *cs,
@@ -1061,7 +1062,7 @@ static int fuse_read_single_forget(struct fuse_iqueue *fiq,
1061__releases(fiq->lock) 1062__releases(fiq->lock)
1062{ 1063{
1063 int err; 1064 int err;
1064 struct fuse_forget_link *forget = dequeue_forget(fiq, 1, NULL); 1065 struct fuse_forget_link *forget = fuse_dequeue_forget(fiq, 1, NULL);
1065 struct fuse_forget_in arg = { 1066 struct fuse_forget_in arg = {
1066 .nlookup = forget->forget_one.nlookup, 1067 .nlookup = forget->forget_one.nlookup,
1067 }; 1068 };
@@ -1109,7 +1110,7 @@ __releases(fiq->lock)
1109 } 1110 }
1110 1111
1111 max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one); 1112 max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one);
1112 head = dequeue_forget(fiq, max_forgets, &count); 1113 head = fuse_dequeue_forget(fiq, max_forgets, &count);
1113 spin_unlock(&fiq->lock); 1114 spin_unlock(&fiq->lock);
1114 1115
1115 arg.count = count; 1116 arg.count = count;
@@ -2119,7 +2120,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
2119 clear_bit(FR_PENDING, &req->flags); 2120 clear_bit(FR_PENDING, &req->flags);
2120 list_splice_tail_init(&fiq->pending, &to_end); 2121 list_splice_tail_init(&fiq->pending, &to_end);
2121 while (forget_pending(fiq)) 2122 while (forget_pending(fiq))
2122 kfree(dequeue_forget(fiq, 1, NULL)); 2123 kfree(fuse_dequeue_forget(fiq, 1, NULL));
2123 wake_up_all(&fiq->waitq); 2124 wake_up_all(&fiq->waitq);
2124 spin_unlock(&fiq->lock); 2125 spin_unlock(&fiq->lock);
2125 kill_fasync(&fiq->fasync, SIGIO, POLL_IN); 2126 kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index b868b71d47d9..5f910c99e8dd 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -729,6 +729,10 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
729 729
730struct fuse_forget_link *fuse_alloc_forget(void); 730struct fuse_forget_link *fuse_alloc_forget(void);
731 731
732struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq,
733 unsigned int max,
734 unsigned int *countp);
735
732/* 736/*
733 * Initialize READ or READDIR request 737 * Initialize READ or READDIR request
734 */ 738 */