bdrv_change_aio_context: use hash table instead of list of visited nodes
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>
Tue, 25 Oct 2022 08:49:45 +0000 (04:49 -0400)
committerKevin Wolf <kwolf@redhat.com>
Thu, 27 Oct 2022 18:14:11 +0000 (20:14 +0200)
commite08cc001d502958040565636e19a42c06e1ae8b7
treed775af529b1d7d598993d80c95ad1a30907d6a47
parent7e8c182fb5e5950a52623b0d463c2f1fcd15a80a
bdrv_change_aio_context: use hash table instead of list of visited nodes

Minor performance improvement, but given that we have hash tables
available, avoid iterating in the visited nodes list every time just
to check if a node has been already visited.

The data structure is not actually a proper hash map, but an hash set,
as we are just adding nodes and not key,value pairs.

Suggested-by: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20221025084952.2139888-4-eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
include/block/block-global-state.h
include/block/block_int-common.h