Skip to contentSkip to conversation

ioemu : add flush in ide_unplug_harddisks()

PATCH In review Tomonari Horikoshi 3 participants 4 messages Feb 20, 2009 – Feb 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioemu : add flush in ide_unplug_harddisks()

Hi

I think the "flush" is necessary.
When "ioemu ide device" changes into "vbd" by "ide_unplug_harddisks()".

What do you think?

Best regards,
Tomonari Horikoshi

hw/ide.c +4 -0
index da7057c..d3e35b0 100644
@@ -2928,6 +2928,10 @@ static void _ide_unplug_harddisks(int start)
         for (j = 0; j < nb_drives; j++)
             if (drives_table[j].bdrv == s->bs)
                 drives_table[j].bdrv = NULL;
+
+        bdrv_flush(s->bs);
+        bdrv_aio_flush(s->bs, ide_flush_cb, s);
+
         bdrv_close(s->bs);
         s->bs = NULL;
         ide_reset(s);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 8 lines · Tomonari Horikoshi

Hi

I think the "flush" is necessary.
When "ioemu ide device" changes into "vbd" by "ide_unplug_harddisks()".

What do you think?

I don't think that calling bdrv_aio_flush is a good idea since it is asyncronous and right after the call we are going to close the device without waiting for completion.

#2 lore raw

Stefano Stabellini writes ("Re: [Xen-devel] [PATCH] ioemu : add flush in ide_unplug_harddisks()"):

Quoted 7 lines
Quoted 2 lines · Tomonari Horikoshi

I think the "flush" is necessary.
When "ioemu ide device" changes into "vbd" by "ide_unplug_harddisks()".

I don't think that calling bdrv_aio_flush is a good idea since it is asyncronous and right after the call we are going to close the device without waiting for completion.

Yes, bdrv_aio_flush is wrong I think.

This seems related to the discussion we had in January. As I wrote in
http://lists.xensource.com/archives/html/xen-devel/2009-01/msg00165.html
it seems to me that the guest should know about be able to flush for itself ? After all we implement the IDE flush cache command.

Ian.

#3 lore raw

Hi.

Thank you for the comment.

I have understood that it is a best approach to use the IDE flush cache command.

I'm sorry I had overlooked the thread.

Best regards,
Tomonari Horikoshi

Ian Jackson san wrote:----------------------

Sent:    Mon, 23 Feb 2009 16:41:16 +0000
Subject: Re: [Xen-devel] [PATCH] ioemu : add flush in ide_unplug_harddisks()
Quoted 20 lines

Stefano Stabellini writes ("Re: [Xen-devel] [PATCH] ioemu : add flush in ide_unplug_harddisks() "):

Quoted 7 lines
Quoted 2 lines · Tomonari Horikoshi

I think the "flush" is necessary.
When "ioemu ide device" changes into "vbd" by "ide_unplug_harddisks()".

I don't think that calling bdrv_aio_flush is a good idea since it is asyncronous and right after the call we are going to close the device without waiting for completion.

Yes, bdrv_aio_flush is wrong I think.

This seems related to the discussion we had in January. As I wrote in
http://lists.xensource.com/archives/html/xen-devel/2009-01/msg00165.html
it seems to me that the guest should know about be able to flush for itself ? After all we implement the IDE flush cache command.

Ian.