[sheepdog] [PATCH v5 5/5] sheep: reduce trafic produced by fill_vdi_info_range()

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Sat May 30 11:34:27 CEST 2015


Current fill_vdi_info_range() produces needlessly large read
requests. This patch reduces the size of the requests.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/vdi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index 2edecc5..49ee2f5 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -1402,7 +1402,7 @@ static int fill_vdi_info_range(uint32_t left, uint32_t right,
 	uint32_t i;
 	const char *name = iocb->name;
 
-	inode = malloc(SD_INODE_HEADER_SIZE);
+	inode = malloc(offsetof(struct sd_inode, btree_counter));
 	if (!inode) {
 		sd_err("failed to allocate memory");
 		ret = SD_RES_NO_MEM;
@@ -1414,7 +1414,8 @@ static int fill_vdi_info_range(uint32_t left, uint32_t right,
 			continue;
 
 		ret = sd_read_object(vid_to_vdi_oid(i), (char *)inode,
-				     SD_INODE_HEADER_SIZE, 0);
+				     offsetof(struct sd_inode, btree_counter),
+				     0);
 		if (ret != SD_RES_SUCCESS)
 			goto out;
 
-- 
1.9.1



More information about the sheepdog mailing list