Skip to content

Commit

Permalink
fuse: use list_first_entry() in flush_bg_queue()
Browse files Browse the repository at this point in the history
This cleanup patch makes the function to use the primitive
instead of direct dereferencing.

Also, move fiq dereferencing out of cycle, since it's
always constant.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Kirill Tkhai authored and Miklos Szeredi committed Sep 28, 2018
1 parent 88bc7d5 commit e287179
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,13 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,

static void flush_bg_queue(struct fuse_conn *fc)
{
struct fuse_iqueue *fiq = &fc->iq;

while (fc->active_background < fc->max_background &&
!list_empty(&fc->bg_queue)) {
struct fuse_req *req;
struct fuse_iqueue *fiq = &fc->iq;

req = list_entry(fc->bg_queue.next, struct fuse_req, list);
req = list_first_entry(&fc->bg_queue, struct fuse_req, list);
list_del(&req->list);
fc->active_background++;
spin_lock(&fiq->waitq.lock);
Expand Down

0 comments on commit e287179

Please sign in to comment.