[sheepdog] [PATCH 3/6] Revert "sheep: let vdi state have parent VID"

Liu Yuan namei.unix at gmail.com
Mon Mar 16 13:49:31 CET 2015


From: Liu Yuan <liuyuan at cmss.chinamobile.com>

This reverts commit fcb91648b1a1f97c55c2a42fff1ec92b93bfea44.

Signed-off-by: Liu Yuan <liuyuan at cmss.chinamobile.com>
---
 include/internal_proto.h |  1 -
 sheep/group.c            |  3 +--
 sheep/ops.c              |  7 +++----
 sheep/plain_store.c      |  2 +-
 sheep/sheep_priv.h       |  2 +-
 sheep/vdi.c              | 15 +--------------
 6 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/include/internal_proto.h b/include/internal_proto.h
index defbe6d..791f94c 100644
--- a/include/internal_proto.h
+++ b/include/internal_proto.h
@@ -374,7 +374,6 @@ struct vdi_state {
 	uint8_t copy_policy;
 	uint8_t block_size_shift;
 	uint8_t __pad[3];
-	uint32_t parent_vid;
 
 	uint32_t lock_state;
 
diff --git a/sheep/group.c b/sheep/group.c
index 3dbec11..1d081f4 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -511,8 +511,7 @@ retry:
 		if (vs[i].deleted)
 			atomic_set_bit(vs[i].vid, sys->vdi_deleted);
 		add_vdi_state(vs[i].vid, vs[i].nr_copies, vs[i].snapshot,
-			      vs[i].copy_policy, vs[i].block_size_shift,
-			      vs[i].parent_vid);
+			      vs[i].copy_policy, vs[i].block_size_shift);
 	}
 out:
 	free(vs);
diff --git a/sheep/ops.c b/sheep/ops.c
index 5dd736c..8a0f77c 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -701,15 +701,14 @@ static int cluster_notify_vdi_add(const struct sd_req *req, struct sd_rsp *rsp,
 		add_vdi_state(req->vdi_state.old_vid,
 			      get_vdi_copy_number(req->vdi_state.old_vid),
 			      true, req->vdi_state.copy_policy,
-			      get_vdi_block_size_shift(req->vdi_state.old_vid),
-			      0);
+			      get_vdi_block_size_shift(req->vdi_state.old_vid));
 
 	if (req->vdi_state.set_bitmap)
 		atomic_set_bit(req->vdi_state.new_vid, sys->vdi_inuse);
 
 	add_vdi_state(req->vdi_state.new_vid, req->vdi_state.copies, false,
 		      req->vdi_state.copy_policy,
-		      req->vdi_state.block_size_shift, req->vdi_state.old_vid);
+		      req->vdi_state.block_size_shift);
 
 	return SD_RES_SUCCESS;
 }
@@ -810,7 +809,7 @@ static int cluster_alter_vdi_copy(const struct sd_req *req, struct sd_rsp *rsp,
 	uint32_t block_size_shift = req->vdi_state.block_size_shift;
 	struct vnode_info *vinfo;
 
-	add_vdi_state(vid, nr_copies, false, 0, block_size_shift, 0);
+	add_vdi_state(vid, nr_copies, false, 0, block_size_shift);
 
 	vinfo = get_vnode_info();
 	start_recovery(vinfo, vinfo, false);
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index 1027325..b83c9f3 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -292,7 +292,7 @@ static int init_vdi_state(uint64_t oid, const char *wd, uint32_t epoch)
 	}
 	add_vdi_state(oid_to_vid(oid), inode->nr_copies,
 		      vdi_is_snapshot(inode), inode->copy_policy,
-		      inode->block_size_shift, inode->parent_vdi_id);
+		      inode->block_size_shift);
 
 	if (inode->name[0] == '\0')
 		atomic_set_bit(oid_to_vid(oid), sys->vdi_deleted);
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 4e93b02..27f5d36 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -333,7 +333,7 @@ uint8_t get_vdi_block_size_shift(uint32_t vid);
 int get_obj_copy_number(uint64_t oid, int nr_zones);
 int get_req_copy_number(struct request *req);
 int add_vdi_state(uint32_t vid, int nr_copies, bool snapshot,
-		  uint8_t, uint8_t block_size_shift, uint32_t parent_vid);
+		  uint8_t, uint8_t block_size_shift);
 int vdi_exist(uint32_t vid);
 int vdi_create(const struct vdi_iocb *iocb, uint32_t *new_vid);
 int vdi_snapshot(const struct vdi_iocb *iocb, uint32_t *new_vid);
diff --git a/sheep/vdi.c b/sheep/vdi.c
index 982f587..dd01a20 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -18,7 +18,6 @@ struct vdi_state_entry {
 	bool snapshot;
 	bool deleted;
 	uint8_t copy_policy;
-	uint32_t parent_vid;
 	struct rb_node node;
 
 	enum lock_state lock_state;
@@ -190,7 +189,7 @@ int get_req_copy_number(struct request *req)
 }
 
 int add_vdi_state(uint32_t vid, int nr_copies, bool snapshot,
-		  uint8_t cp, uint8_t block_size_shift, uint32_t parent_vid)
+		  uint8_t cp, uint8_t block_size_shift)
 {
 	struct vdi_state_entry *entry, *old;
 
@@ -200,7 +199,6 @@ int add_vdi_state(uint32_t vid, int nr_copies, bool snapshot,
 	entry->snapshot = snapshot;
 	entry->copy_policy = cp;
 	entry->block_size_shift = block_size_shift;
-	entry->parent_vid = parent_vid;
 
 	entry->lock_state = LOCK_STATE_UNLOCKED;
 	memset(&entry->owner, 0, sizeof(struct node_id));
@@ -228,16 +226,6 @@ int add_vdi_state(uint32_t vid, int nr_copies, bool snapshot,
 		entry->snapshot = snapshot;
 		entry->copy_policy = cp;
 		entry->block_size_shift = block_size_shift;
-
-		if (parent_vid) {
-			if (!snapshot)
-				sd_warn("caution, updating parent VID of VID: %"
-					PRIx32 " (old parent VID: %" PRIx32
-					", new parent VID: %"PRIx32 ")", vid,
-					entry->parent_vid, parent_vid);
-
-			entry->parent_vid = parent_vid;
-		}
 	}
 
 	sd_rw_unlock(&vdi_state_lock);
@@ -268,7 +256,6 @@ int fill_vdi_state_list(const struct sd_req *hdr,
 		vs[last].lock_state = entry->lock_state;
 		vs[last].lock_owner = entry->owner;
 		vs[last].nr_participants = entry->nr_participants;
-		vs[last].parent_vid = entry->parent_vid;
 		for (int i = 0; i < vs[last].nr_participants; i++) {
 			vs[last].participants_state[i] =
 				entry->participants_state[i];
-- 
1.9.1




More information about the sheepdog mailing list