[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/11] sheepdog: use BDRV_SECTOR_SIZE
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 03/11] sheepdog: use BDRV_SECTOR_SIZE |
Date: |
Fri, 26 Apr 2013 13:44:26 +0200 |
From: Liu Yuan <address@hidden>
Cc: MORITA Kazutaka <address@hidden>
Cc: Kevin Wolf <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Signed-off-by: Liu Yuan <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/sheepdog.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 6a72c1e..2772e8e 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
@@ -1246,7 +1245,7 @@ static int sd_open(BlockDriverState *bs, QDict *options,
int flags)
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);
qemu_opts_del(opts);
@@ -1633,10 +1632,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;
@@ -1755,7 +1754,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.8.1.4
- [Qemu-devel] [PATCH 10/11] iotests: Add 'check -ssh' option to test Secure Shell block device., (continued)
- [Qemu-devel] [PATCH 10/11] iotests: Add 'check -ssh' option to test Secure Shell block device., Stefan Hajnoczi, 2013/04/15
- [Qemu-devel] [PATCH 09/11] block: ssh: Use libssh2_sftp_fsync (if supported by libssh2) to flush to disk., Stefan Hajnoczi, 2013/04/15
- [Qemu-devel] [PATCH 08/11] block: Add support for Secure Shell (ssh) block device., Stefan Hajnoczi, 2013/04/15
- [Qemu-devel] [PATCH 11/11] rbd: add an asynchronous flush, Stefan Hajnoczi, 2013/04/15
- [Qemu-devel] [PULL 00/11] Block patches, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 01/11] block: Introduce bdrv_writev_vmstate, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 01/11] block/ssh: Require libssh2 >= 1.2.8., Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 02/11] savevm: Implement block_writev_buffer(), Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 03/11] block: Introduce bdrv_pwritev() for qcow2_save_vmstate, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 02/11] sheepdog: add discard/trim support for sheepdog, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 03/11] sheepdog: use BDRV_SECTOR_SIZE,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 04/11] qemu-iotests: A few more bdrv_pread/pwrite tests, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 04/11] sheepdog: implement .bdrv_co_is_allocated(), Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 05/11] block: Disable driver-specific options for 1.5, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 05/11] qemu-iotests: Add test for -drive options, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 06/11] rbd: Fix use after free in rbd_open(), Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 06/11] qemu-iotests: filter QEMU_PROG in 051.out, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 07/11] ide: refuse WIN_READ_NATIVE_MAX on empty device, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 07/11] sheepdog: cleanup find_vdi_name, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 08/11] sheepdog: add SD_RES_READONLY result code, Stefan Hajnoczi, 2013/04/26
- [Qemu-devel] [PATCH 09/11] block: ssh: Use libssh2_sftp_fsync (if supported by libssh2) to flush to disk., Stefan Hajnoczi, 2013/04/26