[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC 4/6] rangeset_domain_destroy() refactoring



From: Andrii Anisov <andrii_anisov@xxxxxxxx>

rangeset_domain_destroy() is rather rangeset list helper and does nothing really
domain specific. So replace it with rangeset_list_destroy() helper.

Signed-off-by: Andrii Anisov <andrii_anisov@xxxxxxxx>
---
 xen/common/domain.c        |  4 ++--
 xen/common/rangeset.c      | 11 ++++-------
 xen/include/xen/rangeset.h |  9 ++-------
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 7fe69c6..47c45f2 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -420,7 +420,7 @@ struct domain *domain_create(domid_t domid, unsigned int 
domcr_flags,
         radix_tree_destroy(&d->pirq_tree, free_pirq_struct);
     }
     if ( init_status & INIT_rangeset )
-        rangeset_domain_destroy(d);
+        rangeset_list_destroy(&d->rangesets);
     if ( init_status & INIT_watchdog )
         watchdog_domain_destroy(d);
     if ( init_status & INIT_xsm )
@@ -815,7 +815,7 @@ static void complete_domain_destroy(struct rcu_head *head)
 
     watchdog_domain_destroy(d);
 
-    rangeset_domain_destroy(d);
+    rangeset_list_destroy(&d->rangesets);
 
     sched_destroy_domain(d);
 
diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index 1a13a32..a8b5a5d 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -381,20 +381,17 @@ void rangeset_limit(
     r->nr_ranges = limit;
 }
 
-void rangeset_domain_destroy(
-    struct domain *d)
+void rangeset_list_destroy(struct list_head *list)
 {
     struct rangeset *r;
 
-    while ( !list_empty(&d->rangesets) )
+    while ( !list_empty(list) )
     {
-        r = list_entry(d->rangesets.next, struct rangeset, rangeset_list);
+        r = list_entry(list->next, struct rangeset, rangeset_list);
 
-        BUG_ON(r->domain != d);
-        r->domain = NULL;
         list_del(&r->rangeset_list);
 
-        rangeset_destroy(r);
+        rangeset_destroy(r, NULL);
     }
 }
 
diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h
index e8244a0..cc795d1 100644
--- a/xen/include/xen/rangeset.h
+++ b/xen/include/xen/rangeset.h
@@ -18,14 +18,9 @@ struct spinlock;
 struct rangeset;
 
 /*
- * Destroy per-domain rangeset information.
- * 
- * It is invalid to create or destroy a rangeset belonging to a domain @d
- * before rangeset_domain_initialise(d) returns or after calling
- * rangeset_domain_destroy(d).
+ * Destroy a list of rangesets.
  */
-void rangeset_domain_destroy(
-    struct domain *d);
+void rangeset_list_destroy(struct list_head *list);
 
 /*
  * Create a rangeset. Optionally attach to a specified list @head.
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.