Lines Matching full:region

10 #include <linux/dm-region-hash.h>
20 #define DM_MSG_PREFIX "region hash"
24 * Region hash
27 * region can be in one of three states: clean, dirty,
30 * In addition to being present in the hash table a region _may_
45 * io, up the recovery_count, and remove the region from the
64 /* holds persistent region state */
125 sector_t dm_rh_region_to_sector(struct dm_region_hash *rh, region_t region) in dm_rh_region_to_sector() argument
127 return region << rh->region_shift; in dm_rh_region_to_sector()
189 DMERR("unable to allocate region hash memory"); in dm_region_hash_create()
211 DMERR("unable to allocate region hash bucket memory"); in dm_region_hash_create()
269 static unsigned int rh_hash(struct dm_region_hash *rh, region_t region) in rh_hash() argument
271 return (unsigned int) ((region * rh->prime) >> rh->shift) & rh->mask; in rh_hash()
274 static struct dm_region *__rh_lookup(struct dm_region_hash *rh, region_t region) in __rh_lookup() argument
277 struct list_head *bucket = rh->buckets + rh_hash(rh, region); in __rh_lookup()
280 if (reg->key == region) in __rh_lookup()
291 static struct dm_region *__rh_alloc(struct dm_region_hash *rh, region_t region) in __rh_alloc() argument
299 nreg->state = rh->log->type->in_sync(rh->log, region, 1) ? in __rh_alloc()
302 nreg->key = region; in __rh_alloc()
308 reg = __rh_lookup(rh, region); in __rh_alloc()
327 static struct dm_region *__rh_find(struct dm_region_hash *rh, region_t region) in __rh_find() argument
331 reg = __rh_lookup(rh, region); in __rh_find()
334 reg = __rh_alloc(rh, region); in __rh_find()
341 int dm_rh_get_state(struct dm_region_hash *rh, region_t region, int may_block) in dm_rh_get_state() argument
347 reg = __rh_lookup(rh, region); in dm_rh_get_state()
354 * The region wasn't in the hash, so we fall back to the in dm_rh_get_state()
357 r = rh->log->type->in_sync(rh->log, region, may_block); in dm_rh_get_state()
393 * We can successfully endio the bio but should avoid the region being
403 region_t region = dm_rh_bio_to_region(rh, bio); in dm_rh_mark_nosync() local
415 log->type->set_region_sync(log, region, 0); in dm_rh_mark_nosync()
418 reg = __rh_find(rh, region); in dm_rh_mark_nosync()
421 /* region hash entry should exist because write was in-flight */ in dm_rh_mark_nosync()
431 * Either case, the region should have not been connected to list. in dm_rh_mark_nosync()
506 static void rh_inc(struct dm_region_hash *rh, region_t region) in rh_inc() argument
511 reg = __rh_find(rh, region); in rh_inc()
541 void dm_rh_dec(struct dm_region_hash *rh, region_t region) in dm_rh_dec() argument
548 reg = __rh_lookup(rh, region); in dm_rh_dec()
554 * There is no pending I/O for this region. in dm_rh_dec()
555 * We can move the region to corresponding list for next action. in dm_rh_dec()
556 * At this point, the region is not yet connected to any list. in dm_rh_dec()
558 * If the state is DM_RH_NOSYNC, the region should be kept off in dm_rh_dec()
561 * until the region is recovered or the map is reloaded. in dm_rh_dec()
588 * Starts quiescing a region in preparation for recovery.
593 region_t region; in __rh_recovery_prepare() local
599 r = rh->log->type->get_resync_work(rh->log, &region); in __rh_recovery_prepare()
604 * Get this region, and start it quiescing by setting the in __rh_recovery_prepare()
608 reg = __rh_find(rh, region); in __rh_recovery_prepare()
725 MODULE_DESCRIPTION(DM_NAME " region hash");