[Qemu-devel] [PATCH] COLO: remove the operation to clear connection list

zhiyong.wu@ucloud.cn posted 1 patch 6 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1508786879-32603-1-git-send-email-zhiyong.wu@ucloud.cn
Test checkpatch passed
Test docker passed
Test s390x passed
net/colo.c |    6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
[Qemu-devel] [PATCH] COLO: remove the operation to clear connection list
Posted by zhiyong.wu@ucloud.cn 6 years, 5 months ago
From: Zhi Yong Wu <zhiyong.wu@ucloud.cn>

When hash table is created with g_hash_table_new_full(),
the free function has been registered. So it isn't necessary
since g_hash_table_remove_all() will call connection_destroy()
for each connection struct automatically.

Signed-off-by: Zhi Yong Wu <zhiyong.wu@ucloud.cn>
---
 net/colo.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/net/colo.c b/net/colo.c
index 28ce7c8..668abb7 100644
--- a/net/colo.c
+++ b/net/colo.c
@@ -197,12 +197,6 @@ Connection *connection_get(GHashTable *connection_track_table,
             trace_colo_proxy_main("colo proxy connection hashtable full,"
                                   " clear it");
             connection_hashtable_reset(connection_track_table);
-            /*
-             * clear the conn_list
-             */
-            while (!g_queue_is_empty(conn_list)) {
-                connection_destroy(g_queue_pop_head(conn_list));
-            }
         }
 
         g_hash_table_insert(connection_track_table, new_key, conn);
-- 
1.7.1


Re: [Qemu-devel] [PATCH] COLO: remove the operation to clear connection list
Posted by Darren Kenny 6 years, 5 months ago
That's consistent with the documented behaviour of
g_hash_table_remove_all().


   Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

Thanks,

Darren.

On Tue, Oct 24, 2017 at 03:27:59AM +0800, zhiyong.wu@ucloud.cn wrote:
>From: Zhi Yong Wu <zhiyong.wu@ucloud.cn>
>
>When hash table is created with g_hash_table_new_full(),
>the free function has been registered. So it isn't necessary
>since g_hash_table_remove_all() will call connection_destroy()
>for each connection struct automatically.
>
>Signed-off-by: Zhi Yong Wu <zhiyong.wu@ucloud.cn>
>---
> net/colo.c |    6 ------
> 1 files changed, 0 insertions(+), 6 deletions(-)
>
>diff --git a/net/colo.c b/net/colo.c
>index 28ce7c8..668abb7 100644
>--- a/net/colo.c
>+++ b/net/colo.c
>@@ -197,12 +197,6 @@ Connection *connection_get(GHashTable *connection_track_table,
>             trace_colo_proxy_main("colo proxy connection hashtable full,"
>                                   " clear it");
>             connection_hashtable_reset(connection_track_table);
>-            /*
>-             * clear the conn_list
>-             */
>-            while (!g_queue_is_empty(conn_list)) {
>-                connection_destroy(g_queue_pop_head(conn_list));
>-            }
>         }
>
>         g_hash_table_insert(connection_track_table, new_key, conn);
>-- 
>1.7.1
>
>