[Sheepdog] [PATCH] sheepdog: change CHUNK_SIZE to SD_DATA_OBJ_SIZE

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Apr 29 17:54:03 CEST 2010


There were two same definitions, so remove CHUNK_SIZE.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 block/sheepdog.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index b0d0680..df20f09 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1034,8 +1034,6 @@ out:
 	return -1;
 }
 
-#define CHUNK_SIZE (1ULL << 22)
-
 static int do_sd_create(char *filename, char *tag, int64_t total_sectors,
 			uint64_t base_oid, uint64_t *oid, int snapshot)
 {
@@ -1208,8 +1206,8 @@ static void sd_release(BlockDriverState *bs)
 
 static inline int nr_chunks(struct sd_aiocb *acb)
 {
-	return (((acb->sector_num + acb->nb_sectors) * 512) / CHUNK_SIZE) -
-		(acb->sector_num * 512 / CHUNK_SIZE) + 1;
+	return (((acb->sector_num + acb->nb_sectors) * 512) / SD_DATA_OBJ_SIZE) -
+		(acb->sector_num * 512 / SD_DATA_OBJ_SIZE) + 1;
 }
 
 static void sd_write_done(struct sd_aiocb *acb)
@@ -1287,9 +1285,9 @@ static void sd_readv_writev_bh_cb(void *p)
 	struct sd_aiocb *acb = p;
 	int ret = 0;
 	unsigned long len, done = 0, total = acb->nb_sectors * 512;
-	unsigned long idx = acb->sector_num * 512 / CHUNK_SIZE;
+	unsigned long idx = acb->sector_num * 512 / SD_DATA_OBJ_SIZE;
 	uint64_t oid;
-	uint64_t offset = (acb->sector_num * 512) % CHUNK_SIZE;
+	uint64_t offset = (acb->sector_num * 512) % SD_DATA_OBJ_SIZE;
 	struct bdrv_sd_state *s = acb->common.bs->opaque;
 	struct sd_inode *inode = &s->inode;
 	struct aio_req *aio_req;
@@ -1312,7 +1310,7 @@ static void sd_readv_writev_bh_cb(void *p)
 
 		oid = inode->data_oid[idx];
 
-		len = min_t(unsigned long, total - done, CHUNK_SIZE - offset);
+		len = min_t(unsigned long, total - done, SD_DATA_OBJ_SIZE - offset);
 
 		if (!oid) {
 			if (!acb->write)
-- 
1.5.6.5




More information about the sheepdog mailing list