Re: [Qemu-devel] [PATCH] qcow2: Add bdrv_discard support

2011-01-28 Thread Stefan Hajnoczi
On Thu, Jan 27, 2011 at 01:40:21PM +0100, Kevin Wolf wrote: +/* + * This discards as many clusters of nb_clusters as possible at once (i.e. + * all clusters in the same L2 table) and returns the number of discarded + * clusters. + */ +static int discard_single_l2(BlockDriverState *bs,

Re: [Qemu-devel] [PATCH] qcow2: Add bdrv_discard support

2011-01-28 Thread Stefan Hajnoczi
On Fri, Jan 28, 2011 at 9:57 AM, Stefan Hajnoczi stefa...@gmail.com wrote: On Thu, Jan 27, 2011 at 01:40:21PM +0100, Kevin Wolf wrote: +/* + * This discards as many clusters of nb_clusters as possible at once (i.e. + * all clusters in the same L2 table) and returns the number of discarded + *

[Qemu-devel] [PATCH] qcow2: Add bdrv_discard support

2011-01-27 Thread Kevin Wolf
This adds a bdrv_discard function to qcow2 that frees the discarded clusters. It does not yet pass the discard on to the underlying file system driver, but the space can be reused by future writes to the image. Signed-off-by: Kevin Wolf kw...@redhat.com --- block/qcow2-cluster.c | 78