orangefs: return from orangefs_devreq_read quickly if possible
authorMartin Brandenburg <martin@omnibond.com>
Tue, 25 Apr 2017 19:38:06 +0000 (15:38 -0400)
committerMike Marshall <hubcap@omnibond.com>
Wed, 26 Apr 2017 18:33:00 +0000 (14:33 -0400)
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>
fs/orangefs/devorangefs-req.c

index e1534c9bab16ce69e30eefd6614ca2872595fb04..c19f0787c9c65bddfc8b82ca7fad2f88549f2f91 100644 (file)
@@ -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);