From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUAii-00077m-Dr for qemu-devel@nongnu.org; Mon, 22 Apr 2013 02:59:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUAih-00018R-88 for qemu-devel@nongnu.org; Mon, 22 Apr 2013 02:59:24 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:64011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUAih-00018I-2K for qemu-devel@nongnu.org; Mon, 22 Apr 2013 02:59:23 -0400 Received: by mail-pd0-f179.google.com with SMTP id x11so3368149pdj.10 for ; Sun, 21 Apr 2013 23:59:22 -0700 (PDT) From: Liu Yuan Date: Mon, 22 Apr 2013 14:59:09 +0800 Message-Id: <1366613950-10918-2-git-send-email-namei.unix@gmail.com> In-Reply-To: <1366613950-10918-1-git-send-email-namei.unix@gmail.com> References: <1366613950-10918-1-git-send-email-namei.unix@gmail.com> Subject: [Qemu-devel] [PATCH v2 1/2] sheepdog: use BDRV_SECTOR_SIZE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , sheepdog@lists.wpkg.org, Stefan Hajnoczi , MORITA Kazutaka 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 c099117..0b700a3 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 @@ -1220,7 +1219,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); @@ -1605,10 +1604,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; @@ -1727,7 +1726,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; } -- 1.7.9.5