Skip to contentSkip to conversation

tests: Fix a bug with count variables

PATCH Applied Tianjia Zhang 2 participants 5 messages Feb 7, 2020 – Mar 6, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Fix a bug with count variables

The counting code here should use the local variable n_nodes_local. Otherwise, the variable n_nodes is counting incorrectly, causing the counting logic of the code to be wrong.

---
 tests/test-rcu-list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/test-rcu-list.c +1 -1
index 6f076473e0..c0fc47ded4 100644
@@ -219,7 +219,7 @@ static void *rcu_q_updater(void *arg)
             j++;
             if (target_el == j) {
                 struct list_element *new_el = g_new(struct list_element, 1);
-                n_nodes += n_nodes_local;
+                n_nodes_local++;
                 TEST_LIST_INSERT_AFTER_RCU(el, new_el, entry);
                 break;
             }
Signature · 1 line
2.17.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 15 lines · Tianjia Zhang
Quoted 5 lines · Stefan Hajnoczi
Quoted 4 lines · Tianjia Zhang

The counting code here should use the local variable n_nodes_local. Otherwise, the variable n_nodes is counting incorrectly, causing the counting logic of the code to be wrong.

Quoted 7 lines
Quoted 4 lines

---
  tests/test-rcu-list.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines

Hi,

I see that this patch has not entered the mainline. It has been more than 20 days. Dont forget it.

Thanks,
Tianjia

Thanks and Best,
Tianjia

#4 lore raw
In reply to Tianjia Zhang
Quoted 8 lines · Tianjia Zhang

The counting code here should use the local variable n_nodes_local. Otherwise, the variable n_nodes is counting incorrectly, causing the counting logic of the code to be wrong.

---
 tests/test-rcu-list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Sorry for the delay! Normally this would not go through my tree, but the tests/ maintainer is away on leave so I'll merge the patch.

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

#5 lore raw
Quoted 10 lines · Stefan Hajnoczi
Quoted 8 lines · Tianjia Zhang

The counting code here should use the local variable n_nodes_local. Otherwise, the variable n_nodes is counting incorrectly, causing the counting logic of the code to be wrong.

---
  tests/test-rcu-list.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines

Sorry for the delay! Normally this would not go through my tree, but the tests/ maintainer is away on leave so I'll merge the patch.

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Thanks and Best,
Tianjia