aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-snap.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index cee16fadd9ee..fad84654b045 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -334,16 +334,6 @@ static int calc_max_buckets(void)
334} 334}
335 335
336/* 336/*
337 * Rounds a number down to a power of 2.
338 */
339static uint32_t round_down(uint32_t n)
340{
341 while (n & (n - 1))
342 n &= (n - 1);
343 return n;
344}
345
346/*
347 * Allocate room for a suitable hash table. 337 * Allocate room for a suitable hash table.
348 */ 338 */
349static int init_hash_tables(struct dm_snapshot *s) 339static int init_hash_tables(struct dm_snapshot *s)
@@ -361,8 +351,7 @@ static int init_hash_tables(struct dm_snapshot *s)
361 hash_size = min(origin_dev_size, cow_dev_size) >> s->chunk_shift; 351 hash_size = min(origin_dev_size, cow_dev_size) >> s->chunk_shift;
362 hash_size = min(hash_size, max_buckets); 352 hash_size = min(hash_size, max_buckets);
363 353
364 /* Round it down to a power of 2 */ 354 hash_size = rounddown_pow_of_two(hash_size);
365 hash_size = round_down(hash_size);
366 if (init_exception_table(&s->complete, hash_size)) 355 if (init_exception_table(&s->complete, hash_size))
367 return -ENOMEM; 356 return -ENOMEM;
368 357