Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-21 Thread Paolo Bonzini
Il 21/08/2013 12:31, Charlie Shepherd ha scritto: > On 21/08/2013 10:19, Paolo Bonzini wrote: >> Il 21/08/2013 11:11, Charlie Shepherd ha scritto: >>> It still seems >>> worthwhile to me to be as efficient as possible, I guess that means >>> processing a sector's worth of metadata at a time? >> Yes

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-21 Thread Charlie Shepherd
On 21/08/2013 10:19, Paolo Bonzini wrote: Il 21/08/2013 11:11, Charlie Shepherd ha scritto: It still seems worthwhile to me to be as efficient as possible, I guess that means processing a sector's worth of metadata at a time? Yes, that's what my patches do. My is_allocated and flushing strateg

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-21 Thread Paolo Bonzini
Il 21/08/2013 11:11, Charlie Shepherd ha scritto: >>> >> For cow_co_is_allocated, you have the luxury of returning information >> only for the fewer than nb_sectors. That is, you can set *num_same to a >> smaller value than nb_sectors, even if sector_num + *num_same has the >> same state as the [s

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-21 Thread Charlie Shepherd
On 21/08/2013 09:14, Paolo Bonzini wrote: Il 21/08/2013 00:53, Charlie Shepherd ha scritto: What if nb_sectors > 512 * 8? For cow_co_is_allocated, you have the luxury of returning information only for the fewer than nb_sectors. That is, you can set *num_same to a smaller value than nb_sectors,

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-21 Thread Paolo Bonzini
Il 21/08/2013 00:53, Charlie Shepherd ha scritto: > On 20/08/2013 21:48, Paolo Bonzini wrote: >> Il 20/08/2013 20:34, Charlie Shepherd ha scritto: >>> /* Return true if first block has been changed (ie. current version is >>> @@ -146,40 +114,82 @@ static inline int is_bit_set(BlockDriverState >>>

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
On 20/08/2013 21:48, Paolo Bonzini wrote: Il 20/08/2013 20:34, Charlie Shepherd ha scritto: /* Return true if first block has been changed (ie. current version is @@ -146,40 +114,82 @@ static inline int is_bit_set(BlockDriverState *bs, int64_t bitnum) static int coroutine_fn cow_co_is_alloc

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Paolo Bonzini
Il 20/08/2013 20:34, Charlie Shepherd ha scritto: > cow_co_is_allocated and cow_update_bitmap set bits by reading the relevant > word, setting the specific bit in it and writing it back. These functions set > a number of contiguous bits however, so this is an extremely inefficient way > of doing th

Re: [Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
Sorry, this is not only NOT 1/2, but it should say v2, as this is also based on merging in Paolo's similar patch in his get_block_status series. On 20/08/2013 19:34, Charlie Shepherd wrote: cow_co_is_allocated and cow_update_bitmap set bits by reading the relevant word, setting the specific bit

[Qemu-devel] [PATCH 1/2] Make cow_co_is_allocated and cow_update_bitmap more efficient

2013-08-20 Thread Charlie Shepherd
cow_co_is_allocated and cow_update_bitmap set bits by reading the relevant word, setting the specific bit in it and writing it back. These functions set a number of contiguous bits however, so this is an extremely inefficient way of doing this. This patch converts them to read the whole bitmap they