[libvirt] [PATCH v2 RESEND 06/12] conf: Introduce address caching for PCI extensions

Andrea Bolognani abologna at redhat.com
Tue Jul 24 14:03:36 UTC 2018


On Tue, 2018-07-10 at 16:02 +0800, Yi Min Zhao wrote:
> This patch provides a caching mechanism for the device address
> extensions uid and fid on S390. For efficient sparse address allocation,
> we introduce two hash tables for uid/fid which hold the address set
> information per domain. Also in order to improve performance of
> searching available value, we introduce our own callbacks for the two
> hashtables. In this way, uid/fid is saved in hash key and hash value
> could be any non-NULL pointer due to no operation on hash value. That is
> also the reason why we don't introduce hash value free callback.

Pretty much assuming your hash table implementation doesn't have
any issues, because I lack the expertise to review it properly :)

Some code style issues below.

[...]
> +static uint32_t virZPCIAddrCode(const void *name, uint32_t seed)

The return type and each of the function arguments should be on
separate lines, like

  static uint32_t
  virZPCIAddrCode(const void *name,
                  uint32_t seed)

[...]
> +static bool virZPCIAddrEqual(const void *namea, const void *nameb)

Same.

[...]
> +static void *virZPCIAddrCopy(const void *name)

Same.

[...]
> +static void virZPCIAddrKeyFree(void *name)

Same.

[...]
> +int
> +virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddressSetPtr addrs,
> +                                     virDomainPCIAddressExtensionFlags extFlags)
> +{
> +    if (extFlags == VIR_PCI_ADDRESS_EXTENSION_ZPCI) {

This should probably be

  if (extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI)

since we're dealing with flags, but given the way you end up
calling the function it might be okay as it is.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list