[Devel] [PATCH RHEL7 COMMIT] ploop: push_backup: factor rb_erase() out
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 131f63e8fedcd9aeb4e64f2729857f7ca0a1258b
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date: Mon Jun 27 11:11:22 2016 +0400
ploop: push_backup: factor rb_erase() out
Future patches will need to do more work every time we remove preq from
pending/reported tree. So, it's useful to have one function to add that
(future) functionality.
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
drivers/block/ploop/push_backup.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/block/ploop/push_backup.c b/drivers/block/ploop/push_backup.c
index c9b07ba..5b32fca6 100644
--- a/drivers/block/ploop/push_backup.c
+++ b/drivers/block/ploop/push_backup.c
@@ -413,6 +413,13 @@ static void ploop_pb_add_req_to_reported(struct ploop_pushbackup_desc *pbd,
ploop_pb_add_req_to_tree(preq, &pbd->reported_set);
}
+static void remove_req_from_pbs(struct pb_set *pbs,
+ struct ploop_request *preq)
+{
+ rb_erase(&preq->reloc_link, &pbs->tree);
+}
+
+
static inline bool preq_match(struct ploop_request *preq, cluster_t clu,
cluster_t len)
{
@@ -444,7 +451,7 @@ static struct ploop_request *ploop_pb_get_req_from_tree(struct pb_set *pbs,
if (n)
*npreq = rb_entry(n, struct ploop_request,
reloc_link);
- rb_erase(&p->reloc_link, tree);
+ remove_req_from_pbs(pbs, p);
return p;
}
}
@@ -460,7 +467,7 @@ static struct ploop_request *ploop_pb_get_req_from_tree(struct pb_set *pbs,
n = rb_next(&p->reloc_link);
if (n)
*npreq = rb_entry(n, struct ploop_request, reloc_link);
- rb_erase(&p->reloc_link, tree);
+ remove_req_from_pbs(pbs, p);
return p;
}
@@ -488,7 +495,7 @@ ploop_pb_get_first_req_from_tree(struct pb_set *pbs,
}
p = rb_entry(n, struct ploop_request, reloc_link);
- rb_erase(&p->reloc_link, tree);
+ remove_req_from_pbs(pbs, p);
return p;
}
@@ -648,7 +655,7 @@ int ploop_pb_get_pending(struct ploop_pushbackup_desc *pbd,
else
npreq = NULL;
- rb_erase(&preq->reloc_link, &pbd->pending_set.tree);
+ remove_req_from_pbs(&pbd->pending_set, preq);
ploop_pb_add_req_to_reported(pbd, preq);
(*len_p)++;
@@ -737,7 +744,6 @@ static void ploop_pb_process_extent(struct pb_set *pbs, cluster_t clu,
cluster_t len, struct list_head *ready_list,
int *n_found)
{
- struct rb_root *tree = &pbs->tree;
struct ploop_request *preq, *npreq;
preq = ploop_pb_get_req_from_tree(pbs, clu, len, &npreq);
@@ -760,7 +766,7 @@ static void ploop_pb_process_extent(struct pb_set *pbs, cluster_t clu,
npreq = rb_entry(n, struct ploop_request, reloc_link);
else
npreq = NULL;
- rb_erase(&preq->reloc_link, tree);
+ remove_req_from_pbs(pbs, preq);
}
}
More information about the Devel
mailing list