qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] block: tell drivers about an image resize


From: Christoph Hellwig
Subject: [Qemu-devel] [PATCH 2/3] block: tell drivers about an image resize
Date: Fri, 14 Jan 2011 17:21:04 +0100
User-agent: Mutt/1.3.28i

Add a new size_changed flag in the BlockDriverState and call the
change_cb callback to notify drivers about a size change.

Signed-off-by: Christoph Hellwig <address@hidden>

Index: qemu/block.c
===================================================================
--- qemu.orig/block.c   2011-01-14 17:05:49.527003363 +0100
+++ qemu/block.c        2011-01-14 17:07:23.206255143 +0100
@@ -1135,6 +1135,10 @@ int bdrv_truncate(BlockDriverState *bs,
     ret = drv->bdrv_truncate(bs, offset);
     if (ret == 0) {
         ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
+        if (bs->change_cb) {
+            bs->size_changed = 1;
+            bs->change_cb(bs->change_opaque);
+        }
     }
     return ret;
 }
Index: qemu/block_int.h
===================================================================
--- qemu.orig/block_int.h       2011-01-14 17:05:49.537004411 +0100
+++ qemu/block_int.h    2011-01-14 17:06:02.539004271 +0100
@@ -167,6 +167,7 @@ struct BlockDriverState {
     char backing_format[16]; /* if non-zero and backing_file exists */
     int is_temporary;
     int media_changed;
+    int size_changed;
 
     BlockDriverState *backing_hd;
     BlockDriverState *file;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]