[sheepdog] [PATCH] sheepdog: do not blindly memset all read buffers
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Thu Jun 28 09:06:24 CEST 2012
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 <hch at lst.de>
>
> 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
More information about the sheepdog
mailing list