[libvirt] PATCH: Disable QEMU drive caching

Anthony Liguori anthony at codemonkey.ws
Wed Oct 8 17:16:00 UTC 2008


Daniel P. Berrange wrote:
> On Wed, Oct 08, 2008 at 11:53:14AM -0500, Anthony Liguori wrote:
>   
>> Daniel P. Berrange wrote:
>>     
>>> On Wed, Oct 08, 2008 at 10:51:16AM -0500, Anthony Liguori wrote:
>>>  
>>>       
>>>> A great deal of virtualization users are doing some form of homogeneous 
>>>> consolidation.  If they have a good set of management tools or 
>>>> sophisticated storage, then their guests will be sharing base images or 
>>>> something like that.  Caching in the host will result in major 
>>>> performance improvements because otherwise, the same data will be 
>>>> fetched multiple times.
>>>>    
>>>>         
>>> NB, this has no impact on caching of backing files - QEMU masks out
>>> the O_DIRECT flag when opening the backing file
>>>       
>> It doesn't mask out O_DIRECT, it just doesn't pass any flags to the 
>> backing file when it opens it.  IMHO, this is a bug.
>>     
>
> Perhaps I'm interpreting the wrong bit of code, but I was looking at
> QEMU's  block.c in the bdrv_open2() function. The last thing it does
> is this, which masks out all flags except for the open mode:
>
>     if (bs->backing_file[0] != '\0') {
>
>         if (bdrv_open(bs->backing_hd, backing_filename, flags & (BDRV_O_RDONLY | BDRV_O_RDWR)) < 0)
>             goto fail;
>     }
>   
    if (bs->backing_file[0] != '\0') {
        /* if there is a backing file, use it */
        bs->backing_hd = bdrv_new("");
        if (!bs->backing_hd) {
        fail:
            bdrv_close(bs);
            return -ENOMEM;
        }
        path_combine(backing_filename, sizeof(backing_filename),
                     filename, bs->backing_file);
        if (bdrv_open(bs->backing_hd, backing_filename, 0) < 0)
            goto fail;
    }

Is what's in the latest QEMU tree.  Is what you're looking at carrying a 
patch, perhaps?  If so, there may be a bug in the patch.

Regards,

Anthony Liguori


> Daniel
>   




More information about the libvir-list mailing list