Переглянути джерело

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>
Martin Brandenburg 8 роки тому
батько
коміт
b7a57ccab8
1 змінених файлів з 4 додано та 0 видалено
  1. 4 0
      fs/orangefs/devorangefs-req.c

+ 4 - 0
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);