Commit 4388c5aa authored by Vivek Goyal's avatar Vivek Goyal Committed by Miklos Szeredi

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: default avatarVivek Goyal <vgoyal@redhat.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 79d96eff
...@@ -1033,9 +1033,9 @@ __releases(fiq->lock) ...@@ -1033,9 +1033,9 @@ __releases(fiq->lock)
return err ? err : reqsize; return err ? err : reqsize;
} }
static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq, struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq,
unsigned max, unsigned int max,
unsigned *countp) unsigned int *countp)
{ {
struct fuse_forget_link *head = fiq->forget_list_head.next; struct fuse_forget_link *head = fiq->forget_list_head.next;
struct fuse_forget_link **newhead = &head; struct fuse_forget_link **newhead = &head;
...@@ -1054,6 +1054,7 @@ static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq, ...@@ -1054,6 +1054,7 @@ static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq,
return head; return head;
} }
EXPORT_SYMBOL(fuse_dequeue_forget);
static int fuse_read_single_forget(struct fuse_iqueue *fiq, static int fuse_read_single_forget(struct fuse_iqueue *fiq,
struct fuse_copy_state *cs, struct fuse_copy_state *cs,
...@@ -1061,7 +1062,7 @@ static int fuse_read_single_forget(struct fuse_iqueue *fiq, ...@@ -1061,7 +1062,7 @@ static int fuse_read_single_forget(struct fuse_iqueue *fiq,
__releases(fiq->lock) __releases(fiq->lock)
{ {
int err; int err;
struct fuse_forget_link *forget = dequeue_forget(fiq, 1, NULL); struct fuse_forget_link *forget = fuse_dequeue_forget(fiq, 1, NULL);
struct fuse_forget_in arg = { struct fuse_forget_in arg = {
.nlookup = forget->forget_one.nlookup, .nlookup = forget->forget_one.nlookup,
}; };
...@@ -1109,7 +1110,7 @@ __releases(fiq->lock) ...@@ -1109,7 +1110,7 @@ __releases(fiq->lock)
} }
max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one); max_forgets = (nbytes - ih.len) / sizeof(struct fuse_forget_one);
head = dequeue_forget(fiq, max_forgets, &count); head = fuse_dequeue_forget(fiq, max_forgets, &count);
spin_unlock(&fiq->lock); spin_unlock(&fiq->lock);
arg.count = count; arg.count = count;
...@@ -2119,7 +2120,7 @@ void fuse_abort_conn(struct fuse_conn *fc) ...@@ -2119,7 +2120,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
clear_bit(FR_PENDING, &req->flags); clear_bit(FR_PENDING, &req->flags);
list_splice_tail_init(&fiq->pending, &to_end); list_splice_tail_init(&fiq->pending, &to_end);
while (forget_pending(fiq)) while (forget_pending(fiq))
kfree(dequeue_forget(fiq, 1, NULL)); kfree(fuse_dequeue_forget(fiq, 1, NULL));
wake_up_all(&fiq->waitq); wake_up_all(&fiq->waitq);
spin_unlock(&fiq->lock); spin_unlock(&fiq->lock);
kill_fasync(&fiq->fasync, SIGIO, POLL_IN); kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
......
...@@ -729,6 +729,10 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, ...@@ -729,6 +729,10 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
struct fuse_forget_link *fuse_alloc_forget(void); struct fuse_forget_link *fuse_alloc_forget(void);
struct fuse_forget_link *fuse_dequeue_forget(struct fuse_iqueue *fiq,
unsigned int max,
unsigned int *countp);
/* /*
* Initialize READ or READDIR request * Initialize READ or READDIR request
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment