From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCHv2 1/2] Xen PV backend: Move call to bdrv_new from blk_init to blk_connect Date: Fri, 5 Apr 2013 15:22:16 +0100 Message-ID: References: <1365157905-22987-1-git-send-email-alex@alex.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1365157905-22987-1-git-send-email-alex@alex.org.uk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Alex Bligh Cc: Ian Campbell , Stefano Stabellini , George Dunlap , Ian Jackson , "qemu-devel@nongnu.org" , xen-devel , Anthony Liguori , Paolo Bonzini List-Id: xen-devel@lists.xenproject.org On Fri, 5 Apr 2013, Alex Bligh wrote: > This commit delays the point at which bdrv_new (and hence blk_open > on the underlying device) is called from blk_init to blk_connect. > This ensures that in an inbound live migrate, the block device is > not opened until it has been closed at the other end. This is in > preparation for supporting devices with open/close consistency > without using O_DIRECT. This commit does NOT itself change O_DIRECT > semantics. > > Commit f3903bbac78a81fcbce1350cdce860764a62783a (in xen's qemu-upstream > repo but not in qemu's repo) should be reverted prior to applying > this commit. > > Signed-off-by: Alex Bligh > --- > hw/xen_disk.c | 71 ++++++++++++++++++++++++++++++++------------------------- > 1 file changed, 40 insertions(+), 31 deletions(-) > > diff --git a/hw/xen_disk.c b/hw/xen_disk.c > index 69e1d9d..dd5a711 100644 > --- a/hw/xen_disk.c > +++ b/hw/xen_disk.c > @@ -701,7 +701,7 @@ static void blk_alloc(struct XenDevice *xendev) > static int blk_init(struct XenDevice *xendev) > { > struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); > - int index, qflags, info = 0; > + int info = 0; > > /* read xenstore entries */ > if (blkdev->params == NULL) { > @@ -744,10 +744,7 @@ static int blk_init(struct XenDevice *xendev) > } > > /* read-only ? */ > - qflags = BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO; > - if (strcmp(blkdev->mode, "w") == 0) { > - qflags |= BDRV_O_RDWR; > - } else { > + if (strcmp(blkdev->mode, "w")) { > info |= VDISK_READONLY; > } > > @@ -756,6 +753,41 @@ static int blk_init(struct XenDevice *xendev) > info |= VDISK_CDROM; > } > > + blkdev->file_blk = BLOCK_SIZE; This is useless, you are setting file_blk twice. Just remove this please.