qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH 1/1] block: add cache mode with direct IO and wi


From: Kevin Wolf
Subject: Re: [Qemu-block] [PATCH 1/1] block: add cache mode with direct IO and without flushes
Date: Fri, 16 Sep 2016 10:08:46 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 15.09.2016 um 18:39 hat Denis V. Lunev geschrieben:
> On 09/15/2016 07:09 PM, Kevin Wolf wrote:
> > Am 15.09.2016 um 15:19 hat Denis V. Lunev geschrieben:
> >> This mode could be very useful for flush bottlenecks evaluation and for
> >> running non-persistent VMs, when host crash is considered not fatal.
> >>
> >> Signed-off-by: Denis V. Lunev <address@hidden>
> >> CC: Kevin Wolf <address@hidden>
> >> CC: Max Reitz <address@hidden>
> > Why not just specify the individual options?
> >
> >     -drive file=...,cache.direct=on,cache.no-flush=on
> >
> > Kevin
> then we need to have three options:
>   cache.direct=on/off
>   cache.flush=on/off (default on)
>   cache.writethrough=on/off
> What will have preference, old style option, new style option, rightmost
> option?

The individual options take precedence, see the code that handles the
"cache=..." option in drive_init():

    value = qemu_opt_get(all_opts, "cache");
    if (value) {
        int flags = 0;
        bool writethrough;

        if (bdrv_parse_cache_mode(value, &flags, &writethrough) != 0) {
            error_report("invalid cache option");
            return NULL;
        }

        /* Specific options take precedence */
        if (!qemu_opt_get(all_opts, BDRV_OPT_CACHE_WB)) {
            qemu_opt_set_bool(all_opts, BDRV_OPT_CACHE_WB,
                              !writethrough, &error_abort);
        }
        if (!qemu_opt_get(all_opts, BDRV_OPT_CACHE_DIRECT)) {
            qemu_opt_set_bool(all_opts, BDRV_OPT_CACHE_DIRECT,
                              !!(flags & BDRV_O_NOCACHE), &error_abort);
        }
        if (!qemu_opt_get(all_opts, BDRV_OPT_CACHE_NO_FLUSH)) {
            qemu_opt_set_bool(all_opts, BDRV_OPT_CACHE_NO_FLUSH,
                              !!(flags & BDRV_O_NO_FLUSH), &error_abort);
        }
        qemu_opt_unset(all_opts, "cache");
    }

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]