|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen/page_alloc: Distinguish different errors from assign_pages()
commit 8cf167595f4e5db8cbc223c1ff6e109d6daad5ff
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jun 28 18:42:15 2016 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Jun 30 12:31:30 2016 +0100
xen/page_alloc: Distinguish different errors from assign_pages()
assign_pages() has a return type of int, but only returns 0 or -1. As there
are two distinct failure cases, return a more meaningful error.
All caller currently use its boolean nature, so there is no resulting
change (yet).
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/common/page_alloc.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 98e30e5..48cf90d 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1740,6 +1740,7 @@ int assign_pages(
unsigned int order,
unsigned int memflags)
{
+ int rc = 0;
unsigned long i;
spin_lock(&d->page_alloc_lock);
@@ -1748,7 +1749,8 @@ int assign_pages(
{
gdprintk(XENLOG_INFO, "Cannot assign page to domain%d -- dying.\n",
d->domain_id);
- goto fail;
+ rc = -EINVAL;
+ goto out;
}
if ( !(memflags & MEMF_no_refcount) )
@@ -1759,7 +1761,8 @@ int assign_pages(
gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
"%u > %u\n", d->domain_id,
d->tot_pages + (1 << order), d->max_pages);
- goto fail;
+ rc = -E2BIG;
+ goto out;
}
if ( unlikely(d->tot_pages == 0) )
@@ -1778,12 +1781,9 @@ int assign_pages(
page_list_add_tail(&pg[i], &d->page_list);
}
+ out:
spin_unlock(&d->page_alloc_lock);
- return 0;
-
- fail:
- spin_unlock(&d->page_alloc_lock);
- return -1;
+ return rc;
}
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |