aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJie Liu <jeff.liu@oracle.com>2013-11-13 07:59:58 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2014-01-06 10:07:29 -0500
commit9346c2a8defab777d1fba6bcc284f6ada181fe96 (patch)
tree4597a6c868c0e106dc19058df0efaaea1a6b2eb0
parent02bcf053e9c5dfbb541b8e27a8eeb962a54d577b (diff)
xen: simplify balloon_first_page() with list_first_entry_or_null()
Replace the code logic at balloon_first_page() by calling list_first_entry_or_null() directly. since here is only one user of that routine, therefore we can just remove it. Signed-off-by: Jie Liu <jeff.liu@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: David Vrabel <david.vrabel@citrix.com>
-rw-r--r--drivers/xen/balloon.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 4c02e2b94103..37d06ea624aa 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -157,13 +157,6 @@ static struct page *balloon_retrieve(bool prefer_highmem)
157 return page; 157 return page;
158} 158}
159 159
160static struct page *balloon_first_page(void)
161{
162 if (list_empty(&ballooned_pages))
163 return NULL;
164 return list_entry(ballooned_pages.next, struct page, lru);
165}
166
167static struct page *balloon_next_page(struct page *page) 160static struct page *balloon_next_page(struct page *page)
168{ 161{
169 struct list_head *next = page->lru.next; 162 struct list_head *next = page->lru.next;
@@ -328,7 +321,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
328 if (nr_pages > ARRAY_SIZE(frame_list)) 321 if (nr_pages > ARRAY_SIZE(frame_list))
329 nr_pages = ARRAY_SIZE(frame_list); 322 nr_pages = ARRAY_SIZE(frame_list);
330 323
331 page = balloon_first_page(); 324 page = list_first_entry_or_null(&ballooned_pages, struct page, lru);
332 for (i = 0; i < nr_pages; i++) { 325 for (i = 0; i < nr_pages; i++) {
333 if (!page) { 326 if (!page) {
334 nr_pages = i; 327 nr_pages = i;