[Devel] [PATCH RHEL7 COMMIT] ploop: push_backup: extend pb_set
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Jun 27 00:11:22 PDT 2016
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.20
------>
commit d3035b25f3f752bfe27f134d848fd8cca7bb4979
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date: Mon Jun 27 11:11:22 2016 +0400
ploop: push_backup: extend pb_set
The patch adds more fields to pb_set: list, timer and name.
The list keeps ploop requests ordered by the time of arrival
to the tree: the first preq in the list is the oldest.
The patch only initializes "timer" and "name" fields. They
will be used by future patches.
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
drivers/block/ploop/push_backup.c | 40 ++++++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/drivers/block/ploop/push_backup.c b/drivers/block/ploop/push_backup.c
index 5b32fca6..5058ec1 100644
--- a/drivers/block/ploop/push_backup.c
+++ b/drivers/block/ploop/push_backup.c
@@ -24,7 +24,11 @@
#define BITS_PER_PAGE (1UL << (PAGE_SHIFT + 3))
struct pb_set {
- struct rb_root tree;
+ struct rb_root tree;
+ struct list_head list;
+ struct timer_list timer;
+ char *name;
+ struct ploop_pushbackup_desc *pbd; /* points to parent pbd */
};
struct ploop_pushbackup_desc {
@@ -121,6 +125,26 @@ int ploop_pb_cbt_map_release(struct ploop_pushbackup_desc *pbd, bool do_merge)
return ret;
}
+static void ploop_pb_timeout_func(unsigned long data);
+
+static void ploop_pbs_init(struct pb_set *pbs,
+ struct ploop_pushbackup_desc *pbd, char *name)
+{
+ pbs->pbd = pbd;
+ pbs->name = name;
+ pbs->tree = RB_ROOT;
+ INIT_LIST_HEAD(&pbs->list);
+
+ init_timer(&pbs->timer);
+ pbs->timer.function = ploop_pb_timeout_func;
+ pbs->timer.data = (unsigned long)pbs;
+}
+
+static void ploop_pbs_fini(struct pb_set *pbs)
+{
+ del_timer_sync(&pbs->timer);
+}
+
struct ploop_pushbackup_desc *ploop_pb_alloc(struct ploop_device *plo)
{
struct ploop_pushbackup_desc *pbd;
@@ -147,8 +171,8 @@ struct ploop_pushbackup_desc *ploop_pb_alloc(struct ploop_device *plo)
spin_lock_init(&pbd->ppb_lock);
init_completion(&pbd->ppb_comp);
- pbd->pending_set.tree = RB_ROOT;
- pbd->reported_set.tree = RB_ROOT;
+ ploop_pbs_init(&pbd->pending_set, pbd, "pending");
+ ploop_pbs_init(&pbd->reported_set, pbd, "reported");
pbd->plo = plo;
return pbd;
@@ -397,6 +421,8 @@ static void ploop_pb_add_req_to_tree(struct ploop_request *preq,
p = &(*p)->rb_right;
}
+ list_add_tail(&preq->list, &pbs->list);
+
rb_link_node(&preq->reloc_link, parent, p);
rb_insert_color(&preq->reloc_link, tree);
}
@@ -417,6 +443,7 @@ static void remove_req_from_pbs(struct pb_set *pbs,
struct ploop_request *preq)
{
rb_erase(&preq->reloc_link, &pbs->tree);
+ list_del_init(&preq->list);
}
@@ -554,6 +581,9 @@ unsigned long ploop_pb_stop(struct ploop_pushbackup_desc *pbd, bool do_merge)
if (pbd == NULL)
return 0;
+ ploop_pbs_fini(&pbd->pending_set);
+ ploop_pbs_fini(&pbd->reported_set);
+
merge_status = ploop_pb_cbt_map_release(pbd, do_merge);
spin_lock(&pbd->ppb_lock);
@@ -827,3 +857,7 @@ int ploop_pb_destroy(struct ploop_device *plo, __u32 *status)
return 0;
}
+
+static void ploop_pb_timeout_func(unsigned long data)
+{
+}
More information about the Devel
mailing list