[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/2] COW: Speed up writes
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/2] COW: Speed up writes |
Date: |
Wed, 13 Nov 2013 13:59:12 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 06.11.2013 um 16:59 hat Charlie Shepherd geschrieben:
> Process a whole sector's worth of COW bits by reading a sector, setting the
> bits after skipping
> any already set bits, then writing it out again. Make sure we only flush once
> before writing
> metadata, and only if we need to write metadata.
>
> Signed-off-by: Charlie Shepherd <address@hidden>
> ---
> block/cow.c | 87
> ++++++++++++++++++++++++++++++++++---------------------------
> 1 file changed, 49 insertions(+), 38 deletions(-)
> @@ -204,18 +182,51 @@ static int64_t coroutine_fn
> cow_co_get_block_status(BlockDriverState *bs,
> static int cow_update_bitmap(BlockDriverState *bs, int64_t sector_num,
> int nb_sectors)
> {
> - int error = 0;
> - int i;
> + int64_t bitnum = sector_num + sizeof(struct cow_header_v2) * 8;
> + uint64_t offset = (bitnum / 8) & -BDRV_SECTOR_SIZE;
> bool first = true;
>
> - for (i = 0; i < nb_sectors; i++) {
> - error = cow_set_bit(bs, sector_num + i, &first);
> - if (error) {
> - break;
> + for ( ; nb_sectors;
> + bitnum += sector_bits,
> + nb_sectors -= sector_bits,
> + offset += BDRV_SECTOR_SIZE) {
block/cow.c: In function 'cow_update_bitmap':
block/cow.c:206:23: error: 'sector_bits' undeclared (first use in this function)
Kevin