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