[sheepdog] [PATCH 1/2] sheep: clean up nr_copies usage
Liu Yuan
namei.unix at gmail.com
Thu Jun 28 11:57:39 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
For now, only forward_read/write_obj_req() need nr_copies and can get it from
vnode info.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/gateway.c | 6 +-----
sheep/object_cache.c | 2 --
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/sheep/gateway.c b/sheep/gateway.c
index a97b72c..98dfc91 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -34,11 +34,7 @@ static int forward_read_obj_req(struct request *req)
memcpy(&fwd_hdr, &req->rq, sizeof(fwd_hdr));
fwd_hdr.flags |= SD_FLAG_CMD_IO_LOCAL;
- if (fwd_hdr.obj.copies)
- nr_copies = fwd_hdr.obj.copies;
- else
- nr_copies = get_nr_copies(req->vnodes);
-
+ nr_copies = get_nr_copies(req->vnodes);
oid_to_vnodes(req->vnodes, oid, nr_copies, obj_vnodes);
for (i = 0; i < nr_copies; i++) {
v = obj_vnodes[i];
diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index 208636c..ecceba8 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -584,10 +584,8 @@ static int push_cache_object(uint32_t vid, uint32_t idx, uint64_t bmap,
memset(&hdr, 0, sizeof(hdr));
hdr.opcode = create ? SD_OP_CREATE_AND_WRITE_OBJ : SD_OP_WRITE_OBJ;
hdr.flags = SD_FLAG_CMD_WRITE;
-
hdr.obj.oid = oid;
hdr.obj.offset = offset;
- hdr.obj.copies = sys->nr_copies;
ret = exec_local_req(&hdr, buf, data_length);
if (ret != SD_RES_SUCCESS)
--
1.7.10.2
More information about the sheepdog
mailing list