Commit a443da37 authored by David S. Miller's avatar David S. Miller Committed by David S. Miller

[IPV4]: Use get_order instead of reimplementation.

parent b913de8c
...@@ -151,17 +151,6 @@ static rwlock_t fib_hash_lock = RW_LOCK_UNLOCKED; ...@@ -151,17 +151,6 @@ static rwlock_t fib_hash_lock = RW_LOCK_UNLOCKED;
#define FZ_MAX_DIVISOR ((PAGE_SIZE<<MAX_ORDER) / sizeof(struct fib_node *)) #define FZ_MAX_DIVISOR ((PAGE_SIZE<<MAX_ORDER) / sizeof(struct fib_node *))
static unsigned long size_to_order(unsigned long size)
{
unsigned long order;
for (order = 0; order < MAX_ORDER; order++) {
if ((PAGE_SIZE << order) >= size)
break;
}
return order;
}
static struct fib_node **fz_hash_alloc(int divisor) static struct fib_node **fz_hash_alloc(int divisor)
{ {
unsigned long size = divisor * sizeof(struct fib_node *); unsigned long size = divisor * sizeof(struct fib_node *);
...@@ -170,7 +159,7 @@ static struct fib_node **fz_hash_alloc(int divisor) ...@@ -170,7 +159,7 @@ static struct fib_node **fz_hash_alloc(int divisor)
return kmalloc(size, GFP_KERNEL); return kmalloc(size, GFP_KERNEL);
} else { } else {
return (struct fib_node **) return (struct fib_node **)
__get_free_pages(GFP_KERNEL, size_to_order(size)); __get_free_pages(GFP_KERNEL, get_order(size));
} }
} }
...@@ -201,7 +190,7 @@ static void fz_hash_free(struct fib_node **hash, int divisor) ...@@ -201,7 +190,7 @@ static void fz_hash_free(struct fib_node **hash, int divisor)
kfree(hash); kfree(hash);
else else
free_pages((unsigned long) hash, free_pages((unsigned long) hash,
size_to_order(divisor * sizeof(struct fib_node *))); get_order(divisor * sizeof(struct fib_node *)));
} }
static void fn_rehash_zone(struct fn_zone *fz) static void fn_rehash_zone(struct fn_zone *fz)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment