[sheepdog] [PATCH 1/4] sheepdog proto: a new field type in vdi request for locking

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Tue Aug 5 06:53:50 CEST 2014


The iSCSI multipath feature is implemented as an expansion of the vdi
locking. This patch introduces a type of locking. Existing ordinal
lock (used by QEMU) is typed as "normal", and new one for iSCSI
multipath is typed as "shared". This patch adds a new field type to
vdi request struct and let sheep know which type of lock is required
by client.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 include/sheepdog_proto.h | 4 ++++
 sheep/ops.c              | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index d21e7a0..df0667f 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -129,6 +129,9 @@
 #define SD_REQ_SIZE 48
 #define SD_RSP_SIZE 48
 
+#define LOCK_TYPE_NORMAL 1
+#define LOCK_TYPE_SHARED 2	/* for iSCSI multipath */
+
 struct sd_req {
 	uint8_t		proto_ver;
 	uint8_t		opcode;
@@ -156,6 +159,7 @@ struct sd_req {
 			uint8_t		store_policy;
 			uint8_t		reserved;
 			uint32_t	snapid;
+			uint32_t        type;
 		} vdi;
 
 		/* sheepdog-internal */
diff --git a/sheep/ops.c b/sheep/ops.c
index db792de..c050ed6 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -1342,7 +1342,9 @@ static int cluster_lock_vdi_main(const struct sd_req *req, struct sd_rsp *rsp,
 		return SD_RES_SUCCESS;
 	}
 
-	sd_info("node: %s is locking VDI: %"PRIx32, node_to_str(sender), vid);
+	sd_info("node: %s is locking VDI (type: %s): %"PRIx32,
+		node_to_str(sender),
+		req->vdi.type == LOCK_TYPE_NORMAL ? "normal" : "shared", vid);
 
 	if (!vdi_lock(vid, &sender->nid)) {
 		sd_err("locking %"PRIx32 "failed", vid);
-- 
1.8.3.2




More information about the sheepdog mailing list