* [Qemu-devel] [PATCH 07/12] VMDK: vmdk_flush for extents
@ 2011-06-04 0:42 Fam Zheng
2011-06-18 16:46 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Fam Zheng @ 2011-06-04 0:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Christoph Hellwig
Vmdk flush in extent array style.
Signed-off-by: Fam Zheng <famcool@gmail.com>
---
block/vmdk.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index f1233cf..1d74b62 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1094,7 +1094,14 @@ static void vmdk_close(BlockDriverState *bs)
static int vmdk_flush(BlockDriverState *bs)
{
- return bdrv_flush(bs->file);
+ int i, ret;
+ BDRVVmdkState *s = bs->opaque;
+
+ ret = bdrv_flush(bs->file);
+ for (i = 0; i < s->num_extents; i++) {
+ ret |= bdrv_flush(s->extents[i].file);
+ }
+ return ret;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH 07/12] VMDK: vmdk_flush for extents
2011-06-04 0:42 [Qemu-devel] [PATCH 07/12] VMDK: vmdk_flush for extents Fam Zheng
@ 2011-06-18 16:46 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-06-18 16:46 UTC (permalink / raw)
To: Fam Zheng; +Cc: Kevin Wolf, qemu-devel, Christoph Hellwig
On Sat, Jun 4, 2011 at 1:42 AM, Fam Zheng <famcool@gmail.com> wrote:
> Vmdk flush in extent array style.
>
>
> Signed-off-by: Fam Zheng <famcool@gmail.com>
> ---
> block/vmdk.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/block/vmdk.c b/block/vmdk.c
> index f1233cf..1d74b62 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1094,7 +1094,14 @@ static void vmdk_close(BlockDriverState *bs)
>
> static int vmdk_flush(BlockDriverState *bs)
> {
> - return bdrv_flush(bs->file);
> + int i, ret;
> + BDRVVmdkState *s = bs->opaque;
> +
> + ret = bdrv_flush(bs->file);
> + for (i = 0; i < s->num_extents; i++) {
> + ret |= bdrv_flush(s->extents[i].file);
This could produce an invalid return code (e.g. ORing together two
different errnos).
I think the best you can do is:
for (...) {
ret = bdrv_flush(s->extents[i].file);
if (ret < 0) {
err = ret;
}
}
return err;
This loses multiple errnos but it doesn't have the potential to corrupt them.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-18 16:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-04 0:42 [Qemu-devel] [PATCH 07/12] VMDK: vmdk_flush for extents Fam Zheng
2011-06-18 16:46 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).