Current request names SD_OP_PREVENT_COW and SD_OP_ALLOW_COW aren't suitable, because they prevent inode update, not COW. This patch renames them and change related variable names.
Signed-off-by: Hitoshi Mitake <mitake.hito...@lab.ntt.co.jp> --- dog/vdi.c | 8 ++++---- include/internal_proto.h | 4 ++-- sheep/group.c | 4 ++-- sheep/ops.c | 44 ++++++++++++++++++++++---------------------- sheep/request.c | 33 +++++++++++++++++---------------- sheep/sheep_priv.h | 12 ++++++------ 6 files changed, 53 insertions(+), 52 deletions(-) diff --git a/dog/vdi.c b/dog/vdi.c index 6c5d5d6..49a2139 100644 --- a/dog/vdi.c +++ b/dog/vdi.c @@ -514,10 +514,10 @@ static int vdi_snapshot(int argc, char **argv) return EXIT_FAILURE; } - sd_init_req(&hdr, SD_OP_PREVENT_COW); + sd_init_req(&hdr, SD_OP_PREVENT_INODE_UPDATE); ret = dog_exec_req(&sd_nid, &hdr, NULL); if (ret < 0) { - sd_err("preventing COW failed"); + sd_err("preventing inode update failed"); return EXIT_FAILURE; } @@ -542,10 +542,10 @@ static int vdi_snapshot(int argc, char **argv) " VDI ID of newly created snapshot: %x\n", new_vid, vid); } - sd_init_req(&hdr, SD_OP_ALLOW_COW); + sd_init_req(&hdr, SD_OP_ALLOW_INODE_UPDATE); ret = dog_exec_req(&sd_nid, &hdr, NULL); if (ret < 0) { - sd_err("allowing COW failed"); + sd_err("allowing inode update failed"); return EXIT_FAILURE; } diff --git a/include/internal_proto.h b/include/internal_proto.h index 23967ba..7ec2872 100644 --- a/include/internal_proto.h +++ b/include/internal_proto.h @@ -104,8 +104,8 @@ #define SD_OP_ALTER_VDI_COPY 0xC0 #define SD_OP_DECREF_OBJ 0xC1 #define SD_OP_DECREF_PEER 0xC2 -#define SD_OP_PREVENT_COW 0xC3 -#define SD_OP_ALLOW_COW 0xC4 +#define SD_OP_PREVENT_INODE_UPDATE 0xC3 +#define SD_OP_ALLOW_INODE_UPDATE 0xC4 /* internal flags for hdr.flags, must be above 0x80 */ #define SD_FLAG_CMD_RECOVERY 0x0080 diff --git a/sheep/group.c b/sheep/group.c index c5b322c..adfd798 100644 --- a/sheep/group.c +++ b/sheep/group.c @@ -1098,8 +1098,8 @@ int create_cluster(int port, int64_t zone, int nr_vnodes, if (ret != 0) return -1; - INIT_LIST_HEAD(&sys->prevented_cow_request_queue); - INIT_LIST_HEAD(&sys->pending_prevent_cow_request_queue); + INIT_LIST_HEAD(&sys->prevented_inode_update_request_queue); + INIT_LIST_HEAD(&sys->pending_prevent_inode_update_request_queue); return 0; } diff --git a/sheep/ops.c b/sheep/ops.c index 3bf4838..c48c2aa 100644 --- a/sheep/ops.c +++ b/sheep/ops.c @@ -1198,40 +1198,40 @@ out: return ret; } -static int local_prevent_cow(const struct sd_req *req, struct sd_rsp *rsp, - void *data) +static int local_prevent_inode_update(const struct sd_req *req, + struct sd_rsp *rsp, void *data) { /* FIXME: change type of process_main() */ struct request *rq = container_of(req, struct request, rq); - sd_debug("preventing COW request, ongoing COW requests: %d", - sys->nr_ongoing_cow_request); + sd_debug("preventing inode update request, ongoing inode update" + " requests: %d", sys->nr_ongoing_inode_update_request); - sys->nr_prevent_cow++; + sys->nr_prevent_inode_update++; - if (sys->nr_ongoing_cow_request) { - list_add_tail(&rq->pending_prevent_cow_request_list, - &sys->pending_prevent_cow_request_queue); + if (sys->nr_ongoing_inode_update_request) { + list_add_tail(&rq->pending_prevent_inode_update_reqs, + &sys->pending_prevent_inode_update_request_queue); get_request(rq); } return SD_RES_SUCCESS; } -static int local_allow_cow(const struct sd_req *req, struct sd_rsp *rsp, - void *data) +static int local_allow_inode_update(const struct sd_req *req, + struct sd_rsp *rsp, void *data) { struct request *rq; - sd_debug("allowing COW request"); - sys->nr_prevent_cow--; + sd_debug("allowing inode update request"); + sys->nr_prevent_inode_update--; - if (sys->nr_prevent_cow) + if (sys->nr_prevent_inode_update) return SD_RES_SUCCESS; - list_for_each_entry(rq, &sys->prevented_cow_request_queue, - prevented_cow_request_list) { - list_del(&rq->prevented_cow_request_list); + list_for_each_entry(rq, &sys->prevented_inode_update_request_queue, + prevented_inode_update_request_list) { + list_del(&rq->prevented_inode_update_request_list); requeue_request(rq); } @@ -1577,16 +1577,16 @@ static struct sd_op_template sd_ops[] = { }, #endif - [SD_OP_PREVENT_COW] = { - .name = "PREVENT_COW", + [SD_OP_PREVENT_INODE_UPDATE] = { + .name = "PREVENT_INODE_UPDATE", .type = SD_OP_TYPE_LOCAL, - .process_main = local_prevent_cow, + .process_main = local_prevent_inode_update, }, - [SD_OP_ALLOW_COW] = { - .name = "ALLOW_COW", + [SD_OP_ALLOW_INODE_UPDATE] = { + .name = "ALLOW_INODE_UPDATE", .type = SD_OP_TYPE_LOCAL, - .process_main = local_allow_cow, + .process_main = local_allow_inode_update, }, /* gateway I/O operations */ diff --git a/sheep/request.c b/sheep/request.c index 5a251c2..dc5e5a2 100644 --- a/sheep/request.c +++ b/sheep/request.c @@ -93,16 +93,17 @@ static void gateway_op_done(struct work *work) if (hdr->opcode == SD_OP_WRITE_OBJ && is_data_vid_update(hdr)) { struct request *rq; - sys->nr_ongoing_cow_request--; - assert(0 <= sys->nr_ongoing_cow_request); - sd_debug("a number of ongoing cow request: %d", - sys->nr_ongoing_cow_request); + sys->nr_ongoing_inode_update_request--; + assert(0 <= sys->nr_ongoing_inode_update_request); + sd_debug("a number of ongoing inode update request: %d", + sys->nr_ongoing_inode_update_request); - if (!sys->nr_ongoing_cow_request) { + if (!sys->nr_ongoing_inode_update_request) { list_for_each_entry(rq, - &sys->pending_prevent_cow_request_queue, - pending_prevent_cow_request_list) { - list_del(&rq->pending_prevent_cow_request_list); + &sys->pending_prevent_inode_update_request_queue, + pending_prevent_inode_update_reqs) { + list_del( + &rq->pending_prevent_inode_update_reqs); put_request(rq); } } @@ -353,16 +354,16 @@ queue_work: } if (req->rq.opcode == SD_OP_WRITE_OBJ && is_data_vid_update(&req->rq)) { - if (sys->nr_prevent_cow) { - sd_debug("preventing COW"); - list_add_tail(&req->prevented_cow_request_list, - &sys->prevented_cow_request_queue); + if (sys->nr_prevent_inode_update) { + sd_debug("preventing inode update"); + list_add_tail(&req->prevented_inode_update_request_list, + &sys->prevented_inode_update_request_queue); return; } else { - assert(0 <= sys->nr_ongoing_cow_request); - sys->nr_ongoing_cow_request++; - sd_debug("a number of ongoing cow request: %d", - sys->nr_ongoing_cow_request); + assert(0 <= sys->nr_ongoing_inode_update_request); + sys->nr_ongoing_inode_update_request++; + sd_debug("a number of ongoing inode update request: %d", + sys->nr_ongoing_inode_update_request); } } diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h index 0c590c0..7b33f11 100644 --- a/sheep/sheep_priv.h +++ b/sheep/sheep_priv.h @@ -115,8 +115,8 @@ struct request { enum REQUST_STATUS status; bool stat; /* true if this request is during stat */ - struct list_node prevented_cow_request_list; - struct list_node pending_prevent_cow_request_list; + struct list_node prevented_inode_update_request_list; + struct list_node pending_prevent_inode_update_reqs; }; struct system_info { @@ -166,10 +166,10 @@ struct system_info { bool upgrade; struct sd_stat stat; - int nr_prevent_cow; - int nr_ongoing_cow_request; - struct list_head prevented_cow_request_queue; - struct list_head pending_prevent_cow_request_queue; + int nr_prevent_inode_update; + int nr_ongoing_inode_update_request; + struct list_head prevented_inode_update_request_queue; + struct list_head pending_prevent_inode_update_request_queue; }; struct disk { -- 1.7.1 -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog