Re: [PATCH v3 02/14] qemu_process: Deduplicate code in qemuProcessNeedHugepagesPath()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 23, 2021 at 15:24:24 +0200, Michal Privoznik wrote:
> The aim of qemuProcessNeedHugepagesPath() is to return whether
> guest needs private path inside HugeTLBFS mounts (deducted from
> domain definition @def) or whether the memory device that user is
> hotplugging in needs the private path (deducted from the @mem
> argument). The actual creation of the path is done in the only
> caller qemuProcessBuildDestroyMemoryPaths().
> 
> The rule for the first case (@def) and the second case (@mem) is
> the same (domain has a DIMM device that has HP requested) and is
> written twice. Move the logic into a function to deduplicate the
> code.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_process.c | 29 +++++++++++++++++++++++------
>  1 file changed, 23 insertions(+), 6 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 92c1f0ab74..449e5f1547 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3872,6 +3872,27 @@ qemuProcessReconnectCheckMemAliasOrderMismatch(virDomainObj *vm)
>  }
>  
>  
> +static bool
> +qemuProcessDomainMemoryDefNeedHugepagesPath(const virDomainMemoryDef *mem,
> +                                            const long system_pagesize)
> +{
> +    switch (mem->model) {
> +    case VIR_DOMAIN_MEMORY_MODEL_DIMM:
> +        return mem->pagesize &&
> +            mem->pagesize != system_pagesize;

Put both terms on a single line.

Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux