[vbox-dev] [PATCH] open virtual disk file with O_DIRECT

Frank Mehnert frank.mehnert at oracle.com
Tue Mar 1 23:48:29 PST 2011


On Wednesday 02 March 2011 05:53:52 howard0su wrote:
> On Wed, Mar 2, 2011 at 5:17 AM, Frank Mehnert <frank.mehnert at oracle.com> 
wrote:
> > On Tuesday 22 February 2011 11:24:30 Howard Su wrote:
> >> I am not sure how big diff this change will bring in. But I think this
> >> is worth trying. I enable this unconditional because i believe the
> >> most write for disk file doesn't need cache in host (guest already
> >> handle it.)
> >> 
> >> Index: VD.cpp
> >> ===================================================================
> >> --- VD.cpp      (revision 35998)
> >> +++ VD.cpp      (working copy)
> >> @@ -2333,7 +2333,7 @@
> >>      pStorage->pfnCompleted = pfnCompleted;
> >> 
> >>      /* Open the file. */
> >> -    int rc = RTFileOpen(&pStorage->File, pszLocation, fOpen);
> >> +    int rc = RTFileOpen(&pStorage->File, pszLocation, fOpen |
> >> RTFILE_O_NO_CACHE);
> >>      if (RT_SUCCESS(rc))
> >>      {
> >>          *ppStorage = pStorage;
> > 
> > This change does not make much sense. Better disable the host I/O
> > cache in the VM settings which is the correct strategy.
> 
> That setting is only used to control disable host i/o for direct
> attach raw device. It doesn't apply to the disk files you opened. this
> is what I read from code. Correct me if i am wrong.

Yes, you are wrong :) If you disable the host cache for a storage
controller, all attached mediums will use asynchronous I/O and
will access the host medium with O_DIRECT. There are a few exceptions
(AFAIR for example NFS) but it should be visible in the VBox.log
file if the host cache is used or not.

Kind regards,

Frank
-- 
ORACLE Deutschland B.V. & Co. KG   Dr.-Ing. Frank Mehnert
Werkstrasse 24                     Staff Engineer, VirtualBox
71384 Weinstadt, Germany           mailto:frank.mehnert at oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://www.virtualbox.org/pipermail/vbox-dev/attachments/20110302/26f92a14/attachment-0001.bin 


More information about the vbox-dev mailing list