Skip to contentSkip to conversation

ocfs2: break useless while loop

PATCH Superseded Junxiao Bi 3 participants 4 messages Jul 11, 2012 – Aug 15, 2012 OCFS2

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Junxiao Bi

author
#0 lore raw

PATCH 1/1 ocfs2: break useless while loop

---
 fs/ocfs2/dlm/dlmmaster.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/dlm/dlmmaster.c +3 -1
index 005261c..1fadc39 100644
@@ -1888,8 +1888,10 @@ ok:
 			 * up nodes that this node contacted */
 			while ((nn = find_next_bit (mle->response_map, O2NM_MAX_NODES,
 						    nn+1)) < O2NM_MAX_NODES) {
-				if (nn != dlm->node_num && nn != assert->node_idx)
+				if (nn != dlm->node_num && nn != assert->node_idx) {
 					master_request = 1;
+					break;
+				}
 			}
 		}
 		mle->master = assert->node_idx;
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

PATCH 1/1 ocfs2: break useless while loop

Quoted 10 lines · Junxiao Bi
---
 fs/ocfs2/dlm/dlmmaster.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/dlm/dlmmaster.c +0 -0
index 005261c..1fadc39 100644

fs/ocfs2/dlm/dlmmaster.c ok: · line 1894

Quoted 8 lines
fs/ocfs2/dlm/dlmmaster.c +3 -1
@@ -1888,8 +1888,10 @@ ok:
 			 * up nodes that this node contacted */
 			while ((nn = find_next_bit (mle->response_map, O2NM_MAX_NODES,
 						    nn+1)) < O2NM_MAX_NODES) {
-				if (nn != dlm->node_num && nn != assert->node_idx)
+				if (nn != dlm->node_num && nn != assert->node_idx) {
 					master_request = 1;
+					break;
+				}

Seems like this will save a tiny bit of CPU in the assert master
handler. Sunil, can you see any problem?

Joel

Quoted 6 lines
fs/ocfs2/dlm/dlmmaster.c +0 -0
 			}
 		}
 		mle->master = assert->node_idx;
Signature · 1 line
1.7.9.5
Signature · 8 lines
"To announce that there must be no criticism of them president, or
 that we are to stand by the president, right or wrong, is not only
 unpatriotic and servile, but is morally treasonable to the American
 public."
	- Theodore Roosevelt

			http://www.jlbec.org/
			jlbec at evilplan.org
#2 lore raw

PATCH 1/1 ocfs2: break useless while loop

Quoted 18 lines · Joel Becker

fs/ocfs2/dlm/dlmmaster.c ok: · line 1889

Quoted 12 lines · Junxiao Bi
---
 fs/ocfs2/dlm/dlmmaster.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/dlm/dlmmaster.c +0 -0
index 005261c..1fadc39 100644
@@ -1888,8 +1888,10 @@ ok:
                       * up nodes that this node contacted */
                      while ((nn = find_next_bit (mle->response_map,

O2NM_MAX_NODES,

fs/ocfs2/dlm/dlmmaster.c ok: · line 1890

Quoted 1 line
fs/ocfs2/dlm/dlmmaster.c +0 -0
                                                  nn+1)) <

O2NM_MAX_NODES) {

fs/ocfs2/dlm/dlmmaster.c ok: · line 1891

Quoted 1 line
fs/ocfs2/dlm/dlmmaster.c +0 -1
-                             if (nn != dlm->node_num && nn !=

assert->node_idx)

Quoted 10 lines

fs/ocfs2/dlm/dlmmaster.c ok: · line 1891

Quoted 1 line
fs/ocfs2/dlm/dlmmaster.c +1 -0
+                             if (nn != dlm->node_num && nn !=

assert->node_idx) {

fs/ocfs2/dlm/dlmmaster.c ok: · line 1894

Quoted 3 lines
fs/ocfs2/dlm/dlmmaster.c +2 -0
                                      master_request = 1;
+                                     break;
+                             }

Seems like this will save a tiny bit of CPU in the assert master
handler. Sunil, can you see any problem?

Looks good to me. ACK.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20120719/01a7dfb2/attachment.html

maintainer
#3 lore raw

PATCH 1/1 ocfs2: break useless while loop

In reply to Junxiao Bi
Quoted 1 line · Junxiao Bi

This patch is now part of the fixes branch of ocfs2.git.

Joel

Quoted 23 lines
---
 fs/ocfs2/dlm/dlmmaster.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ocfs2/dlm/dlmmaster.c +3 -1
index 005261c..1fadc39 100644
@@ -1888,8 +1888,10 @@ ok:
 			 * up nodes that this node contacted */
 			while ((nn = find_next_bit (mle->response_map, O2NM_MAX_NODES,
 						    nn+1)) < O2NM_MAX_NODES) {
-				if (nn != dlm->node_num && nn != assert->node_idx)
+				if (nn != dlm->node_num && nn != assert->node_idx) {
 					master_request = 1;
+					break;
+				}
 			}
 		}
 		mle->master = assert->node_idx;
Signature · 1 line
1.7.9.5
Signature · 6 lines
"I think it would be a good idea."  
        - Mahatma Ghandi, when asked what he thought of Western
          civilization

			http://www.jlbec.org/
			jlbec at evilplan.org