[RFC v2 PATCH 2/5] hugetlbfs: remove region_truncte() as region_del() can be used

From: Mike Kravetz
Date: Thu Apr 23 2015 - 18:14:37 EST


Now that region_del() exists, the region_truncate() routine can be
removed. Callers of region_truncate are changed to call region_del
instead with a ending value of -1.

Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
---
mm/hugetlb.c | 37 +------------------------------------
1 file changed, 1 insertion(+), 36 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 31e36cd..60a4f21 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -328,41 +328,6 @@ retry:
return chg;
}

-static long region_truncate(struct resv_map *resv, long end)
-{
- struct list_head *head = &resv->regions;
- struct file_region *rg, *trg;
- long chg = 0;
-
- spin_lock(&resv->lock);
- /* Locate the region we are either in or before. */
- list_for_each_entry(rg, head, link)
- if (end <= rg->to)
- break;
- if (&rg->link == head)
- goto out;
-
- /* If we are in the middle of a region then adjust it. */
- if (end > rg->from) {
- chg = rg->to - end;
- rg->to = end;
- rg = list_entry(rg->link.next, typeof(*rg), link);
- }
-
- /* Drop any remaining regions. */
- list_for_each_entry_safe(rg, trg, rg->link.prev, link) {
- if (&rg->link == head)
- break;
- chg += rg->to - rg->from;
- list_del(&rg->link);
- kfree(rg);
- }
-
-out:
- spin_unlock(&resv->lock);
- return chg;
-}
-
static long region_count(struct resv_map *resv, long f, long t)
{
struct list_head *head = &resv->regions;
@@ -494,7 +459,7 @@ void resv_map_release(struct kref *ref)
struct resv_map *resv_map = container_of(ref, struct resv_map, refs);

/* Clear out any active regions before we release the map. */
- region_truncate(resv_map, 0);
+ region_del(resv_map, 0, -1);
kfree(resv_map);
}

--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/