From: Liu Yuan <tailai.ly at taobao.com> - setup_access_to_local_objects() does the job to find the if the targeted object is local, so we don't need to check it again. - SD_FLAG_CMD_RECOVERY and SD_OP_READ_OBJ should be paired by programmers, since it is just internal API, we should trust 'em. Signed-off-by: Liu Yuan <tailai.ly at taobao.com> --- sheep/sdnet.c | 33 ++++----------------------------- 1 files changed, 4 insertions(+), 29 deletions(-) diff --git a/sheep/sdnet.c b/sheep/sdnet.c index d366cd0..d258bbd 100644 --- a/sheep/sdnet.c +++ b/sheep/sdnet.c @@ -218,33 +218,6 @@ static int check_epoch(struct request *req) return ret; } -static int __is_access_to_recoverying_objects(struct request *req) -{ - if (req->rq.flags & SD_FLAG_CMD_RECOVERY) { - if (req->rq.opcode != SD_OP_READ_OBJ) - eprintf("bug\n"); - return 0; - } - - if (is_recoverying_oid(req->local_oid)) - return 1; - - return 0; -} - -static int __is_access_to_busy_objects(struct request *req) -{ - if (req->rq.flags & SD_FLAG_CMD_RECOVERY) { - if (req->rq.opcode != SD_OP_READ_OBJ) - eprintf("bug\n"); - return 0; - } - - if (is_access_to_busy_objects(req->local_oid)) - return 1; - - return 0; -} static int check_request(struct request *req) { if (!req->local_oid && !req->local_cow_oid) @@ -262,19 +235,21 @@ static int check_request(struct request *req) if (!req->local_oid) return 0; - if (__is_access_to_recoverying_objects(req)) { + if (is_recoverying_oid(req->local_oid)) { if (req->rq.flags & SD_FLAG_CMD_IO_LOCAL) { + /* Sheep peer request */ req->rp.result = SD_RES_NEW_NODE_VER; sys->nr_outstanding_io++; req->work.done(&req->work); } else { + /* Gateway request */ list_del(&req->r_wlist); list_add_tail(&req->r_wlist, &sys->req_wait_for_obj_list); } return -1; } - if (__is_access_to_busy_objects(req)) { + if (is_access_to_busy_objects(req->local_oid)) { list_del(&req->r_wlist); list_add_tail(&req->r_wlist, &sys->req_wait_for_obj_list); return -1; -- 1.7.8.2 |