Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-17 Thread Stefan Hajnoczi
On Thu, Jun 16, 2011 at 9:10 AM, Dmitry Konishchev wrote: > On Wed, Jun 15, 2011 at 5:57 PM, Stefan Hajnoczi wrote: >> Anyway, bdrv_getlength() will return the total_sectors value instead >> of calling into raw-posix.c .bdrv_getlength().  That's why it should >> be cheap. > > Yeah, I see it now a

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-16 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 5:57 PM, Stefan Hajnoczi wrote: > Anyway, bdrv_getlength() will return the total_sectors value instead > of calling into raw-posix.c .bdrv_getlength().  That's why it should > be cheap. Yeah, I see it now after a closer look in the drivers code. It looks like I get this 9%

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
2011/6/15 Dmitry Konishchev : > On Wed, Jun 15, 2011 at 5:33 PM, Stefan Hajnoczi wrote: >> "disable caching"? > > Image geometry caching. I meant If I call bdrv_get_geometry() every > time I need image geometry instead of obtaining it from bs_geometry > variable. Haha, sorry. Too much caching: -

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 5:33 PM, Stefan Hajnoczi wrote: > "disable caching"? Image geometry caching. I meant If I call bdrv_get_geometry() every time I need image geometry instead of obtaining it from bs_geometry variable. -- Дмитрий Конищев (Dmitry Konishchev) mailto:konishc...@gmail.com

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
On Wed, Jun 15, 2011 at 2:14 PM, Dmitry Konishchev wrote: > On Wed, Jun 15, 2011 at 4:02 PM, Stefan Hajnoczi wrote: >> We need to fully understand performance before applying optimizations >> on top.  Otherwise it is possible to paper over a problem while >> leaving the root cause unsolved.  Avoi

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 4:02 PM, Stefan Hajnoczi wrote: > We need to fully understand performance before applying optimizations > on top.  Otherwise it is possible to paper over a problem while > leaving the root cause unsolved.  Avoiding lseek(2) is very important, > not just for qemu-img but als

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
On Wed, Jun 15, 2011 at 10:50 AM, Dmitry Konishchev wrote: > On Wed, Jun 15, 2011 at 12:39 PM, Stefan Hajnoczi wrote: >> Why is bdrv_get_geometry() slow? > > Mmm.. Frankly, I haven't looked so deep, but it is going to be slow at > least for raw images due to using lseek(). We need to fully under

[Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
This patch optimizes 'qemu-img convert' operation for volumes which are almost fully unallocated. Here are the results of simple tests: We have a snapshot of a volume: $ qemu-img info snapshot.qcow2 image: snapshot.qcow2 file format: qcow2 virtual size: 5.0G (5372805120 bytes) disk size: 4.0G clus

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Wed, Jun 15, 2011 at 12:39 PM, Stefan Hajnoczi wrote: > Why is bdrv_get_geometry() slow? Mmm.. Frankly, I haven't looked so deep, but it is going to be slow at least for raw images due to using lseek(). -- Dmitry Konishchev mailto:konishc...@gmail.com

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Stefan Hajnoczi
On Wed, Jun 15, 2011 at 8:38 AM, Dmitry Konishchev wrote: > On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: >> Yes, please. > > OK, I'll do it as soon I'll find time for it. > > > On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: >> For image files the block layer should be caching

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-15 Thread Dmitry Konishchev
On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: > Yes, please. OK, I'll do it as soon I'll find time for it. On Tue, Jun 14, 2011 at 7:58 PM, Stefan Hajnoczi wrote: > For image files the block layer should be caching the device capacity (size) > anyway, so you probably don't need to al

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-14 Thread Stefan Hajnoczi
On Tue, Jun 14, 2011 at 8:43 AM, Dmitry Konishchev wrote: > On Mon, Jun 13, 2011 at 1:13 PM, Dmitry Konishchev > wrote: >> I haven't done this because in this case I have to pass too lot of >> local variables to this function. Just not sure that it'll look >> better. But if you mind I surely can

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-14 Thread Dmitry Konishchev
On Mon, Jun 13, 2011 at 1:13 PM, Dmitry Konishchev wrote: > I haven't done this because in this case I have to pass too lot of > local variables to this function. Just not sure that it'll look > better. But if you mind I surely can do this. Should I? -- Dmitry Konishchev mailto:konishc...@gmail.

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-13 Thread Dmitry Konishchev
On Mon, Jun 13, 2011 at 12:26 PM, Stefan Hajnoczi wrote: > The optimization is to check allocation metadata instead of > unconditionally reading and then checking for all zeroes? Yeah, exactly. On Mon, Jun 13, 2011 at 12:26 PM, Stefan Hajnoczi wrote: > Why introduce a new constant instead of usi

Re: [Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-13 Thread Stefan Hajnoczi
On Wed, Jun 08, 2011 at 06:50:25PM +0400, Dmitry Konishchev wrote: > This patch optimizes 'qemu-img convert' operation for volumes which are > almost fully unallocated. Here are the results of simple tests: The optimization is to check allocation metadata instead of unconditionally reading and the

[Qemu-devel] [PATCH] CPU consumption optimization of 'qemu-img convert' using bdrv_is_allocated()

2011-06-08 Thread Dmitry Konishchev
This patch optimizes 'qemu-img convert' operation for volumes which are almost fully unallocated. Here are the results of simple tests: We have a snapshot of a volume: $ qemu-img info snapshot.qcow2 image: snapshot.qcow2 file format: qcow2 virtual size: 5.0G (5372805120 bytes) disk size: 4.0G clus