Hi, Mitake-san.

Thank you to improve the process that did not have enough of consideration.

I tried the check this patch, and node additional test.
it's very desirable results were obtained.
and patch looks good to me.

Then I'll shows the results.

tested procedure is below.
#sorry for has become a different test condition,
#but I think that it is sufficient conditions for.

1. create 1000 snapshot
2. delete  999 snapshot

3. add new node at -p 7003
 # sheep -p 7003 -z 3 /var/lib/sheepdog/data3
( wait for complete recovery )

4. test vdi list to original node
 # dog vdi list -p 7000 -T
===> [test-case-1]
5. test vdi list to additional node
 # dog vdi list -p 7003 -T
===> [test-case-2]

before patch applied
[test-case-1]  Elapsed time: 0.083 seconds
[test-case-2] Elapsed time: 1.134 seconds

after patch applied
[test-case-1]  Elapsed time: 0.070seconds
[test-case-2]  Elapsed time: 0.167 seconds

Reviewed-by: Masaki Saeki <[email protected]>
Tested-by: Masaki Saeki <[email protected]>

Best regards,
Saeki.
(2014/11/26 16:54), Hitoshi Mitake wrote:
At Wed, 26 Nov 2014 16:53:53 +0900,
Hitoshi Mitake wrote:

The commit f68feab7edc0de introduced significant optimization for dog
vdi list. But the deleted vid bitmap cannot be copied to newly joining
sheep. This patch let new sheeps copy the information via
SD_OP_GET_VDI_COPIES during joining process.

Cc: Masaki Saeki <[email protected]>
Signed-off-by: Hitoshi Mitake <[email protected]>
---
  include/internal_proto.h |  1 +
  sheep/group.c            |  2 ++
  sheep/ops.c              |  4 +++-
  sheep/sheep_priv.h       |  1 +
  sheep/vdi.c              | 18 ++++++++++++++++++
  5 files changed, 25 insertions(+), 1 deletion(-)

Saeki-san, could you test and review the patch if you have time?

Thanks,
Hitoshi


diff --git a/include/internal_proto.h b/include/internal_proto.h
index faed3f6..ad2f3ed 100644
--- a/include/internal_proto.h
+++ b/include/internal_proto.h
@@ -353,6 +353,7 @@ struct vdi_state {
        uint32_t vid;
        uint8_t nr_copies;
        uint8_t snapshot;
+       uint8_t deleted;
        uint8_t copy_policy;

        uint32_t lock_state;
diff --git a/sheep/group.c b/sheep/group.c
index a45904e..2b98a9b 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -507,6 +507,8 @@ retry:
        count = rsp->data_length / sizeof(*vs);
        for (i = 0; i < count; i++) {
                atomic_set_bit(vs[i].vid, sys->vdi_inuse);
+               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);
        }
diff --git a/sheep/ops.c b/sheep/ops.c
index 4b54780..e645e04 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -188,8 +188,10 @@ static int post_cluster_del_vdi(const struct sd_req *req, 
struct sd_rsp *rsp,
        struct cache_deletion_work *dw;
        int ret = rsp->result;

-       if (ret == SD_RES_SUCCESS)
+       if (ret == SD_RES_SUCCESS) {
                atomic_set_bit(vid, sys->vdi_deleted);
+               vdi_mark_deleted(vid);
+       }

        if (!sys->enable_object_cache)
                return ret;
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index 3e6adc2..5fc6b90 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -333,6 +333,7 @@ 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);
  int vdi_delete(const struct vdi_iocb *iocb, struct request *req);
+void vdi_mark_deleted(uint32_t vid);
  int vdi_lookup(const struct vdi_iocb *iocb, struct vdi_info *info);
  void clean_vdi_state(void);
  int sd_delete_vdi(const char *name);
diff --git a/sheep/vdi.c b/sheep/vdi.c
index b03421a..1c8fb36 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -15,6 +15,7 @@ struct vdi_state_entry {
        uint32_t vid;
        unsigned int nr_copies;
        bool snapshot;
+       bool deleted;
        uint8_t copy_policy;
        struct rb_node node;

@@ -248,6 +249,7 @@ static struct vdi_state *fill_vdi_state_list_with_alloc(int 
*result_nr)
                vs[i].vid = entry->vid;
                vs[i].nr_copies = entry->nr_copies;
                vs[i].snapshot = entry->snapshot;
+               vs[i].deleted = entry->deleted;
                vs[i].copy_policy = entry->copy_policy;
                vs[i].lock_state = entry->lock_state;
                vs[i].lock_owner = entry->owner;
@@ -1576,6 +1578,22 @@ out:
        return ret;
  }

+void vdi_mark_deleted(uint32_t vid)
+{
+       struct vdi_state_entry *entry;
+
+       sd_write_lock(&vdi_state_lock);
+       entry = vdi_state_search(&vdi_state_root, vid);
+       if (!entry) {
+               sd_err("VID: %"PRIx32" not found", vid);
+               goto out;
+       }
+
+       entry->deleted = true;
+out:
+       sd_rw_unlock(&vdi_state_lock);
+}
+
  /* Calculate a vdi attribute id from sheepdog_vdi_attr. */
  static uint32_t hash_vdi_attr(const struct sheepdog_vdi_attr *attr)
  {
--
1.8.3.2


--


--
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to