qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [sheepdog] [PATCH] sheepdog: do not blindly memset all


From: MORITA Kazutaka
Subject: Re: [Qemu-devel] [sheepdog] [PATCH] sheepdog: do not blindly memset all read buffers
Date: Thu, 28 Jun 2012 16:06:24 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/22.2 (x86_64-pc-linux-gnu) MULE/5.0 (SAKAKI)

At Wed, 27 Jun 2012 18:22:58 +0200,
Christoph Hellwig wrote:
> 
> Only buffers that map to unallocated blocks need to be zeroed.
> 
> Signed-off-by: Christoph Hellwig <address@hidden>
> 
> Index: qemu/block/sheepdog.c
> ===================================================================
> --- qemu.orig/block/sheepdog.c        2012-06-27 18:02:41.849867899 +0200
> +++ qemu/block/sheepdog.c     2012-06-27 18:08:35.929865783 +0200
> @@ -1556,18 +1556,24 @@ static int coroutine_fn sd_co_rw_vector(
>  
>          len = MIN(total - done, SD_DATA_OBJ_SIZE - offset);
>  
> -        if (!inode->data_vdi_id[idx]) {
> -            if (acb->aiocb_type == AIOCB_READ_UDATA) {
> +
> +        switch (acb->aiocb_type) {
> +        case AIOCB_READ_UDATA:
> +            if (!inode->data_vdi_id[idx]) {
> +                qemu_iovec_memset_skip(acb->qiov, 0, len, offset);

'offset' is the offset of the sheepdog object.  I think it should be
'done' since we need to pass the number of skip bytes.

>                  goto done;
>              }
> -
> -            create = 1;
> -        } else if (acb->aiocb_type == AIOCB_WRITE_UDATA
> -                   && !is_data_obj_writable(inode, idx)) {
> -            /* Copy-On-Write */
> -            create = 1;
> -            old_oid = oid;
> -            flags = SD_FLAG_CMD_COW;
> +            break;
> +         case AIOCB_WRITE_UDATA:

Wrong indentation.

Thanks,

Kazutaka



reply via email to

[Prev in Thread] Current Thread [Next in Thread]