summaryrefslogtreecommitdiffstats
path: root/fs/orangefs/devorangefs-req.c
diff options
context:
space:
mode:
authorMartin Brandenburg <martin@omnibond.com>2017-04-25 21:38:06 +0200
committerMike Marshall <hubcap@omnibond.com>2017-04-26 20:33:00 +0200
commitb7a57ccab891584d00ae03dce1176b2d4cbe08e7 (patch)
tree066e124a463472b365a4933be82da9e5574d397c /fs/orangefs/devorangefs-req.c
parentorangefs: ensure the userspace component is unmounted if mount fails (diff)
downloadlinux-b7a57ccab891584d00ae03dce1176b2d4cbe08e7.tar.xz
linux-b7a57ccab891584d00ae03dce1176b2d4cbe08e7.zip
orangefs: return from orangefs_devreq_read quickly if possible
It is not necessary to take the lock and search through the request list if the list is empty. Signed-off-by: Martin Brandenburg <martin@omnibond.com> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/devorangefs-req.c')
-rw-r--r--fs/orangefs/devorangefs-req.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c
index e1534c9bab16..c19f0787c9c6 100644
--- a/fs/orangefs/devorangefs-req.c
+++ b/fs/orangefs/devorangefs-req.c
@@ -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);