From patchwork Tue Apr 23 06:03:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Yuan X-Patchwork-Id: 238761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6653E2C015F for ; Tue, 23 Apr 2013 16:04:32 +1000 (EST) Received: from localhost ([::1]:51668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUWL8-0003ck-Jo for incoming@patchwork.ozlabs.org; Tue, 23 Apr 2013 02:04:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUWKZ-0003ZY-Fw for qemu-devel@nongnu.org; Tue, 23 Apr 2013 02:03:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUWKY-0004DP-9K for qemu-devel@nongnu.org; Tue, 23 Apr 2013 02:03:55 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:43817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUWKY-0004DJ-3Q for qemu-devel@nongnu.org; Tue, 23 Apr 2013 02:03:54 -0400 Received: by mail-pd0-f176.google.com with SMTP id r11so208245pdi.7 for ; Mon, 22 Apr 2013 23:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=ARiyUq5kzuOMA1RGcm5x+slHzwO/zlUcMFXnbl7ZTA0=; b=1Jy/aKNrquSw10vodzHasnpYJRJJYPXbkbKlnzNsVQilT9PJyVrgIE7+bK/xFjuQEl J63Kp7GGjZ4sLYPxvLYonaSo7+MkiZidwV2Xfem9I+XXGREBuAbxG9IzWLjiXsZFKWzf 8GZnyny+pgZdc/hbcScA7YhVqXbuSV10ZX5mYcdUDtpSroCx6ymB14hcBdlAdd5oJmsg sEqIAl/qXNKcBzYDMZskvGcekdc5KThVH29scgPLwS3iiCwGGLb4Q4Kc2lQ94edVLe51 4IIEC7bJijrdb7MWqGHsqisZ4n4JV9Kzbf2c4fb4RtHX+nrHqi+KwpNAch1m3iyXrYUK 2opg== X-Received: by 10.68.244.5 with SMTP id xc5mr37870730pbc.66.1366697033282; Mon, 22 Apr 2013 23:03:53 -0700 (PDT) Received: from K55VM-ubuntu.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id dr4sm28147086pbb.19.2013.04.22.23.03.49 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Apr 2013 23:03:51 -0700 (PDT) From: Liu Yuan To: qemu-devel@nongnu.org Date: Tue, 23 Apr 2013 14:03:34 +0800 Message-Id: <1366697015-25121-3-git-send-email-namei.unix@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1366697015-25121-1-git-send-email-namei.unix@gmail.com> References: <1366697015-25121-1-git-send-email-namei.unix@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.192.176 Cc: Kevin Wolf , sheepdog@lists.wpkg.org, Stefan Hajnoczi , MORITA Kazutaka Subject: [Qemu-devel] [PATCH v4 2/3] sheepdog: use BDRV_SECTOR_SIZE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Liu Yuan Cc: MORITA Kazutaka Cc: Kevin Wolf Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan --- block/sheepdog.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index c3b7770..916f360 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -89,7 +89,6 @@ #define SD_NR_VDIS (1U << 24) #define SD_DATA_OBJ_SIZE (UINT64_C(1) << 22) #define SD_MAX_VDI_SIZE (SD_DATA_OBJ_SIZE * MAX_DATA_OBJS) -#define SECTOR_SIZE 512 #define SD_INODE_SIZE (sizeof(SheepdogInode)) #define CURRENT_VDI_ID 0 @@ -1219,7 +1218,7 @@ static int sd_open(BlockDriverState *bs, const char *filename, s->min_dirty_data_idx = UINT32_MAX; s->max_dirty_data_idx = 0; - bs->total_sectors = s->inode.vdi_size / SECTOR_SIZE; + bs->total_sectors = s->inode.vdi_size / BDRV_SECTOR_SIZE; pstrcpy(s->name, sizeof(s->name), vdi); qemu_co_mutex_init(&s->lock); g_free(buf); @@ -1604,10 +1603,10 @@ static int coroutine_fn sd_co_rw_vector(void *p) { SheepdogAIOCB *acb = p; int ret = 0; - unsigned long len, done = 0, total = acb->nb_sectors * SECTOR_SIZE; - unsigned long idx = acb->sector_num * SECTOR_SIZE / SD_DATA_OBJ_SIZE; + unsigned long len, done = 0, total = acb->nb_sectors * BDRV_SECTOR_SIZE; + unsigned long idx = acb->sector_num * BDRV_SECTOR_SIZE / SD_DATA_OBJ_SIZE; uint64_t oid; - uint64_t offset = (acb->sector_num * SECTOR_SIZE) % SD_DATA_OBJ_SIZE; + uint64_t offset = (acb->sector_num * BDRV_SECTOR_SIZE) % SD_DATA_OBJ_SIZE; BDRVSheepdogState *s = acb->common.bs->opaque; SheepdogInode *inode = &s->inode; AIOReq *aio_req; @@ -1726,7 +1725,7 @@ static coroutine_fn int sd_co_writev(BlockDriverState *bs, int64_t sector_num, int ret; if (bs->growable && sector_num + nb_sectors > bs->total_sectors) { - ret = sd_truncate(bs, (sector_num + nb_sectors) * SECTOR_SIZE); + ret = sd_truncate(bs, (sector_num + nb_sectors) * BDRV_SECTOR_SIZE); if (ret < 0) { return ret; }