Skip to content

Commit

Permalink
Export fuse_dequeue_forget() function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rhvgoyal committed Aug 14, 2019
1 parent 7eeff20 commit e80347e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ __releases(fiq->waitq.lock)
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 *countp)
{
Expand All @@ -1206,14 +1206,15 @@ static struct fuse_forget_link *dequeue_forget(struct fuse_iqueue *fiq,

return head;
}
EXPORT_SYMBOL(fuse_dequeue_forget);

static int fuse_read_single_forget(struct fuse_iqueue *fiq,
struct fuse_copy_state *cs,
size_t nbytes)
__releases(fiq->waitq.lock)
{
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 = {
.nlookup = forget->forget_one.nlookup,
};
Expand Down Expand Up @@ -1261,7 +1262,7 @@ __releases(fiq->waitq.lock)
}

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->waitq.lock);

arg.count = count;
Expand Down Expand Up @@ -2231,7 +2232,7 @@ void fuse_abort_conn(struct fuse_conn *fc)
clear_bit(FR_PENDING, &req->flags);
list_splice_tail_init(&fiq->pending, &to_end);
while (forget_pending(fiq))
kfree(dequeue_forget(fiq, 1, NULL));
kfree(fuse_dequeue_forget(fiq, 1, NULL));
wake_up_all_locked(&fiq->waitq);
spin_unlock(&fiq->waitq.lock);
kill_fasync(&fiq->fasync, SIGIO, POLL_IN);
Expand Down
3 changes: 3 additions & 0 deletions fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,9 @@ 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_dequeue_forget(struct fuse_iqueue *fiq,
unsigned max, unsigned *countp);

/* Used by READDIRPLUS */
void fuse_force_forget(struct file *file, u64 nodeid);

Expand Down

0 comments on commit e80347e

Please sign in to comment.