From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0f2J-0004Bu-9f for qemu-devel@nongnu.org; Fri, 27 Jun 2014 18:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0f2B-0007CM-P8 for qemu-devel@nongnu.org; Fri, 27 Jun 2014 18:54:27 -0400 Received: from vs-m.tc.umn.edu ([134.84.135.97]:48612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0f2B-0007C5-Hz for qemu-devel@nongnu.org; Fri, 27 Jun 2014 18:54:19 -0400 Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by vs-m.tc.umn.edu (UMN smtpd) with ESMTP for ; Fri, 27 Jun 2014 17:54:12 -0500 (CDT) Received: by mail-we0-f177.google.com with SMTP id u56so5783383wes.22 for ; Fri, 27 Jun 2014 15:54:09 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <53ADE6F8.1070303@redhat.com> References: <53ADE6F8.1070303@redhat.com> Date: Fri, 27 Jun 2014 18:54:09 -0400 Message-ID: From: Xiongzi Ge Content-Type: multipart/alternative; boundary=f46d0435c018f2995004fcd92f1c Subject: Re: [Qemu-devel] The first function called after migration for a block device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org --f46d0435c018f2995004fcd92f1c Content-Type: text/plain; charset=UTF-8 Hi Paolo, Thanks. I found a function called bdrv_invalidate_cache() in qcow2.c. After migration, it will be called to invalidate the cache of the block device? On Fri, Jun 27, 2014 at 5:49 PM, Paolo Bonzini wrote: > Il 27/06/2014 21:41, Xiongzi Ge ha scritto: > > >> When I studied the code, I found in migration.c, >> bdrv_clear_incoming_migration_all(); >> >> the cache of the bdrv devices will be deleted. >> >> Is this the one for the functions to be called after migration? >> >> Does the bdrv device need to be reopen or load state in block.c? >> >> I would like to find this function to add my new code. >> > > This function is not going to do anything if your code is in "raw" format. > In particular, it has *nothing* to do with the guest OS's cache. That > cache is managed by the guest OS and, as I have already told you multiple > times, there is *nothing* that QEMU can do about it. > > All you can do is use O_DIRECT in the guest. > > Paolo > --f46d0435c018f2995004fcd92f1c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Paolo,

Thanks. I found a funct= ion called bdrv_invalidate_cache() in qcow2.c. After migration, it will be = called to invalidate the cache of the block device?=C2=A0


On Fri, Jun 27, 2014 at 5:49 PM, Paolo B= onzini <pbonzini@redhat.com> wrote:
Il 27/06/2014 21:41, Xiongzi Ge ha scritto:


When I studied the code, I found in migration.c,
bdrv_clear_incoming_migration_all();

the cache of the bdrv devices will be deleted.

Is this the one for the functions to be called after migration?

Does the bdrv device need to be reopen or load state in block.c?

I would like to find this function to add my new code.

This function is not going to do anything if your code is in "raw"= ; format. =C2=A0In particular, it has *nothing* to do with the guest OS'= ;s cache. =C2=A0That cache is managed by the guest OS and, as I have alread= y told you multiple times, there is *nothing* that QEMU can do about it.
All you can do is use O_DIRECT in the guest.

Paolo

--f46d0435c018f2995004fcd92f1c--