[Sheepdog] [PATCH 2/3] collie: avoid reading entire vdi object

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Jan 31 18:46:44 CET 2011


We don't touch a data oids field at all, so it is better to read only
header fields for performance.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/collie.c          |    3 ++-
 include/sheepdog_proto.h |    2 ++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/collie/collie.c b/collie/collie.c
index 493d492..85814ff 100644
--- a/collie/collie.c
+++ b/collie/collie.c
@@ -293,7 +293,8 @@ static int parse_vdi(vdi_parser_func_t func, void *data)
 		}
 
 		wlen = 0;
-		rlen = sizeof(i);
+		rlen = SD_INODE_HEADER_SIZE;
+		memset(&i, 0, sizeof(i));
 
 		memset(&hdr, 0, sizeof(hdr));
 		hdr.opcode = SD_OP_READ_OBJ;
diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index 0602ff5..6385c9a 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -79,6 +79,8 @@
 #define SD_DATA_OBJ_SIZE (UINT64_C(1) << 22)
 
 #define SD_INODE_SIZE (sizeof(struct sheepdog_inode))
+#define SD_INODE_HEADER_SIZE (sizeof(struct sheepdog_inode) - \
+			      sizeof(uint32_t) * MAX_DATA_OBJS)
 #define CURRENT_VDI_ID 0
 
 struct sd_req {
-- 
1.5.6.5




More information about the sheepdog mailing list