diff options
Diffstat (limited to 'drivers/md/dm-region-hash.c')
| -rw-r--r-- | drivers/md/dm-region-hash.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c index 1f760451e6f4..e9b47b659976 100644 --- a/drivers/md/dm-region-hash.c +++ b/drivers/md/dm-region-hash.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2003 Sistina Software Limited. * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. @@ -18,7 +19,8 @@ #define DM_MSG_PREFIX "region hash" -/*----------------------------------------------------------------- +/* + *------------------------------------------------------------------ * Region hash * * The mirror splits itself up into discrete regions. Each @@ -53,20 +55,21 @@ * lists in the region_hash, with the 'state', 'list' and * 'delayed_bios' fields of the regions. This is used from irq * context, so all other uses will have to suspend local irqs. - *---------------------------------------------------------------*/ + *------------------------------------------------------------------ + */ struct dm_region_hash { uint32_t region_size; - unsigned region_shift; + unsigned int region_shift; /* holds persistent region state */ struct dm_dirty_log *log; /* hash table */ rwlock_t hash_lock; - unsigned mask; - unsigned nr_buckets; - unsigned prime; - unsigned shift; + unsigned int mask; + unsigned int nr_buckets; + unsigned int prime; + unsigned int shift; struct list_head *buckets; /* @@ -74,7 +77,7 @@ struct dm_region_hash { */ int flush_failure; - unsigned max_recovery; /* Max # of regions to recover in parallel */ + unsigned int max_recovery; /* Max # of regions to recover in parallel */ spinlock_t region_lock; atomic_t recovery_in_flight; @@ -163,12 +166,12 @@ struct dm_region_hash *dm_region_hash_create( struct bio_list *bios), void (*wakeup_workers)(void *context), void (*wakeup_all_recovery_waiters)(void *context), - sector_t target_begin, unsigned max_recovery, + sector_t target_begin, unsigned int max_recovery, struct dm_dirty_log *log, uint32_t region_size, region_t nr_regions) { struct dm_region_hash *rh; - unsigned nr_buckets, max_buckets; + unsigned int nr_buckets, max_buckets; size_t i; int ret; @@ -203,7 +206,7 @@ struct dm_region_hash *dm_region_hash_create( rh->shift = RH_HASH_SHIFT; rh->prime = RH_HASH_MULT; - rh->buckets = vmalloc(array_size(nr_buckets, sizeof(*rh->buckets))); + rh->buckets = vmalloc_array(nr_buckets, sizeof(*rh->buckets)); if (!rh->buckets) { DMERR("unable to allocate region hash bucket memory"); kfree(rh); @@ -236,7 +239,7 @@ EXPORT_SYMBOL_GPL(dm_region_hash_create); void dm_region_hash_destroy(struct dm_region_hash *rh) { - unsigned h; + unsigned int h; struct dm_region *reg, *nreg; BUG_ON(!list_empty(&rh->quiesced_regions)); @@ -263,9 +266,9 @@ struct dm_dirty_log *dm_rh_dirty_log(struct dm_region_hash *rh) } EXPORT_SYMBOL_GPL(dm_rh_dirty_log); -static unsigned rh_hash(struct dm_region_hash *rh, region_t region) +static unsigned int rh_hash(struct dm_region_hash *rh, region_t region) { - return (unsigned) ((region * rh->prime) >> rh->shift) & rh->mask; + return (unsigned int) ((region * rh->prime) >> rh->shift) & rh->mask; } static struct dm_region *__rh_lookup(struct dm_region_hash *rh, region_t region) @@ -720,5 +723,5 @@ void dm_rh_start_recovery(struct dm_region_hash *rh) EXPORT_SYMBOL_GPL(dm_rh_start_recovery); MODULE_DESCRIPTION(DM_NAME " region hash"); -MODULE_AUTHOR("Joe Thornber/Heinz Mauelshagen <dm-devel@redhat.com>"); +MODULE_AUTHOR("Joe Thornber/Heinz Mauelshagen <dm-devel@lists.linux.dev>"); MODULE_LICENSE("GPL"); |
