Currently, collie sends read I/O requests without using gateway node but calculating the target node as the sheep daemon does internally. This is a hack to keep consistency even if the VM sends write requests to the same objects at the same time. But this enforces us to retry the collie command manually when it fails due to node membership changes. This patch uses a gateway node for collie's read I/Os, and makes them like QEMU's ones. Data consistency of QEMU is not a problem if we use SD_FLAG_CMD_WEAK_CONSISTENCY for collie's I/Os. Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp> --- collie/common.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/collie/common.c b/collie/common.c index 0653b72..8260bd2 100644 --- a/collie/common.c +++ b/collie/common.c @@ -47,18 +47,12 @@ int sd_read_object(uint64_t oid, void *data, unsigned int datalen, { struct sd_obj_req hdr; struct sd_obj_rsp *rsp = (struct sd_obj_rsp *)&hdr; - char name[128]; - int n, fd, ret; + int fd, ret; unsigned wlen = 0, rlen = datalen; - n = obj_to_sheep(vnode_list_entries, nr_vnodes, oid, 0); - - addr_to_str(name, sizeof(name), vnode_list_entries[n].addr, 0); - - fd = connect_to(name, vnode_list_entries[n].port); + fd = connect_to(sdhost, sdport); if (fd < 0) { - fprintf(stderr, "failed to connect %s:%d\n", name, - vnode_list_entries[n].port); + fprintf(stderr, "failed to connect\n"); return SD_RES_EIO; } @@ -66,8 +60,7 @@ int sd_read_object(uint64_t oid, void *data, unsigned int datalen, hdr.epoch = node_list_version; hdr.opcode = SD_OP_READ_OBJ; hdr.oid = oid; - /* use direct to avoid checking consistency */ - hdr.flags = SD_FLAG_CMD_IO_LOCAL; + hdr.flags = SD_FLAG_CMD_WEAK_CONSISTENCY; hdr.data_length = rlen; hdr.offset = offset; -- 1.7.2.5 |