Skip to contentSkip to conversation

gfs2/locking/dlm: use an temp variable to reduce a spin_unlock

PATCH In review Denis Cheng 2 participants 2 messages Jul 25, 2007 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2/locking/dlm: use an temp variable to reduce a spin_unlock

this is more clear.

---
 fs/gfs2/locking/dlm/plock.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
fs/gfs2/locking/dlm/plock.c +6 -5
index fba1f1d..1f7b038 100644
@@ -346,15 +346,16 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
 
 static unsigned int dev_poll(struct file *file, poll_table *wait)
 {
+	unsigned int mask = 0;
+
 	poll_wait(file, &send_wq, wait);
 
 	spin_lock(&ops_lock);
-	if (!list_empty(&send_list)) {
-		spin_unlock(&ops_lock);
-		return POLLIN | POLLRDNORM;
-	}
+	if (!list_empty(&send_list))
+		mask = POLLIN | POLLRDNORM;
 	spin_unlock(&ops_lock);
-	return 0;
+
+	return mask;
 }
 
 static const struct file_operations dev_fops = {
Signature · 1 line
1.5.2.2
#1 lore raw

Hi,

Now applied to the GFS2 -nmw git tree. Thanks,

Steve.

Quoted 33 lines · Denis Cheng

this is more clear.

---
 fs/gfs2/locking/dlm/plock.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
fs/gfs2/locking/dlm/plock.c +6 -5
index fba1f1d..1f7b038 100644
@@ -346,15 +346,16 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
 
 static unsigned int dev_poll(struct file *file, poll_table *wait)
 {
+	unsigned int mask = 0;
+
 	poll_wait(file, &send_wq, wait);
 
 	spin_lock(&ops_lock);
-	if (!list_empty(&send_list)) {
-		spin_unlock(&ops_lock);
-		return POLLIN | POLLRDNORM;
-	}
+	if (!list_empty(&send_list))
+		mask = POLLIN | POLLRDNORM;
 	spin_unlock(&ops_lock);
-	return 0;
+
+	return mask;
 }
 
 static const struct file_operations dev_fops = {