Skip to content

Commit

Permalink
orangefs: return from orangefs_devreq_read quickly if possible
Browse files Browse the repository at this point in the history
It is not necessary to take the lock and search through the request list
if the list is empty.

Signed-off-by: Martin Brandenburg <[email protected]>
Signed-off-by: Mike Marshall <[email protected]>
  • Loading branch information
Martin Brandenburg authored and hubcapsc committed Apr 26, 2017
1 parent 9d286b0 commit b7a57cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/orangefs/devorangefs-req.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ static ssize_t orangefs_devreq_read(struct file *file,
return -EINVAL;
}

/* Check for an empty list before locking. */
if (list_empty(&orangefs_request_list))
return -EAGAIN;

restart:
/* Get next op (if any) from top of list. */
spin_lock(&orangefs_request_list_lock);
Expand Down

0 comments on commit b7a57cc

Please sign in to comment.