Re: [Qemu-devel] [PATCH] block: Change bdrv_commit to handle multiple sectors at once

2010-07-19 Thread Kevin Wolf
Am 16.07.2010 20:16, schrieb Christoph Hellwig: > On Fri, Jul 16, 2010 at 06:17:36PM +0200, Kevin Wolf wrote: >> +buf = qemu_malloc(2048 * BDRV_SECTOR_SIZE); > > Please add a COMMIT_BUF_SIZE #define instead of the hardcoded 2048 in > various places. > >> for (i = 0; i < total_sectors;) {

Re: [Qemu-devel] [PATCH] block: Change bdrv_commit to handle multiple sectors at once

2010-07-17 Thread Stefan Hajnoczi
On Fri, Jul 16, 2010 at 5:17 PM, Kevin Wolf wrote: > bdrv_commit copies the image to its backing file sector by sector, which > is (surprise!) relatively slow. Let's take a larger buffer and handle more > sectors at once if possible. > > With a 1G qcow2 file, this brought the time bdrv_commit take

Re: [Qemu-devel] [PATCH] block: Change bdrv_commit to handle multiple sectors at once

2010-07-16 Thread Christoph Hellwig
On Fri, Jul 16, 2010 at 06:17:36PM +0200, Kevin Wolf wrote: > +buf = qemu_malloc(2048 * BDRV_SECTOR_SIZE); Please add a COMMIT_BUF_SIZE #define instead of the hardcoded 2048 in various places. > for (i = 0; i < total_sectors;) { > +if (drv->bdrv_is_allocated(bs, i, 2048, &n)) { >

[Qemu-devel] [PATCH] block: Change bdrv_commit to handle multiple sectors at once

2010-07-16 Thread Kevin Wolf
bdrv_commit copies the image to its backing file sector by sector, which is (surprise!) relatively slow. Let's take a larger buffer and handle more sectors at once if possible. With a 1G qcow2 file, this brought the time bdrv_commit takes down from 5:06 min to 1:14 min for me. Signed-off-by: Kevi