From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEYNf-00053q-C5 for qemu-devel@nongnu.org; Fri, 23 Jan 2015 02:10:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEYNb-0006Fr-9q for qemu-devel@nongnu.org; Fri, 23 Jan 2015 02:10:11 -0500 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]:42199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEYNa-00063f-T1 for qemu-devel@nongnu.org; Fri, 23 Jan 2015 02:10:07 -0500 Message-ID: <54C1F3BC.10007@lab.ntt.co.jp> Date: Fri, 23 Jan 2015 16:09:48 +0900 From: Teruaki Ishizaki MIME-Version: 1.0 References: <1421738068-3252-1-git-send-email-ishizaki.teruaki@lab.ntt.co.jp> <87iofzie37.wl%mitake.hitoshi@lab.ntt.co.jp> In-Reply-To: <87iofzie37.wl%mitake.hitoshi@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [sheepdog] [PATCH v2] sheepdog: selectable object size support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hitoshi Mitake Cc: kwolf@redhat.com, namei.unix@gmail.com, sheepdog@lists.wpkg.org, qemu-devel@nongnu.org, stefanha@redhat.com Hi, Hitoshi Thanks for your review! (2015/01/22 14:22), Hitoshi Mitake wrote: > At Tue, 20 Jan 2015 16:14:28 +0900, > Teruaki Ishizaki wrote: >> >> Previously, qemu block driver of sheepdog used hard-coded VDI object size. >> This patch enables users to handle "block_size_shift" value for >> calculating VDI object size. >> >> When you start qemu, you don't need to specify additional command option. >> >> But when you create the VDI which doesn't have default object size >> with qemu-img command, you specify block_size_shift option. >> >> If you want to create a VDI of 8MB(1 << 23) object size, >> you need to specify following command option. >> >> # qemu-img create -o block_size_shift=23 sheepdog:test1 100M >> >> In addition, when you don't specify qemu-img command option, >> a default value of sheepdog cluster is used for creating VDI. >> >> # qemu-img create sheepdog:test2 100M >> >> Signed-off-by: Teruaki Ishizaki >> --- >> V2: >> - Fix coding style problem (white space). >> - Add members, store_policy and block_size_shift to struct SheepdogVdiReq >> - Initialize request header to use block_size_shift specified by user. >> --- >> block/sheepdog.c | 142 ++++++++++++++++++++++++++++++++++++++------- >> include/block/block_int.h | 1 + >> 2 files changed, 121 insertions(+), 22 deletions(-) >> > >> @@ -1757,6 +1800,48 @@ static int sd_create(const char *filename, QemuOpts *opts, >> } >> >> s->aio_context = qemu_get_aio_context(); >> + >> + /* if block_size_shift is not specified, get cluster default value */ >> + if (s->inode.block_size_shift == 0) { >> + SheepdogVdiReq hdr; >> + SheepdogClusterRsp *rsp = (SheepdogClusterRsp *)&hdr; >> + Error *local_err = NULL; >> + int fd; >> + unsigned int wlen = 0, rlen = 0; >> + >> + fd = connect_to_sdog(s, &local_err); >> + if (fd < 0) { >> + error_report("%s", error_get_pretty(local_err)); >> + error_free(local_err); >> + ret = -EIO; >> + goto out; >> + } >> + >> + memset(&hdr, 0, sizeof(hdr)); > > SD_OP_GET_CLUSTER_DEFAULT doesn't require succeeding data, so the below memset() for buf and > >> + memset(&buf, 0, sizeof(buf)); >> + hdr.opcode = SD_OP_GET_CLUSTER_DEFAULT; >> + hdr.proto_ver = SD_PROTO_VER; > > the below two statements aren't required. > >> + hdr.data_length = wlen; >> + hdr.flags = SD_FLAG_CMD_WRITE; I comprehend above things you pointed out. I'll fix the patch! Thanks, Teruaki Ishizaki