Lines Matching defs:region
9 #include <linux/dm-region-hash.h>
19 #define DM_MSG_PREFIX "region hash"
25 * region can be in one of three states: clean, dirty,
28 * In addition to being present in the hash table a region _may_
43 * io, up the recovery_count, and remove the region from the
61 /* holds persistent region state */
122 sector_t dm_rh_region_to_sector(struct dm_region_hash *rh, region_t region)
124 return region << rh->region_shift;
186 DMERR("unable to allocate region hash memory");
208 DMERR("unable to allocate region hash bucket memory");
266 static unsigned rh_hash(struct dm_region_hash *rh, region_t region)
268 return (unsigned) ((region * rh->prime) >> rh->shift) & rh->mask;
271 static struct dm_region *__rh_lookup(struct dm_region_hash *rh, region_t region)
274 struct list_head *bucket = rh->buckets + rh_hash(rh, region);
277 if (reg->key == region)
288 static struct dm_region *__rh_alloc(struct dm_region_hash *rh, region_t region)
296 nreg->state = rh->log->type->in_sync(rh->log, region, 1) ?
299 nreg->key = region;
305 reg = __rh_lookup(rh, region);
324 static struct dm_region *__rh_find(struct dm_region_hash *rh, region_t region)
328 reg = __rh_lookup(rh, region);
331 reg = __rh_alloc(rh, region);
338 int dm_rh_get_state(struct dm_region_hash *rh, region_t region, int may_block)
344 reg = __rh_lookup(rh, region);
351 * The region wasn't in the hash, so we fall back to the
354 r = rh->log->type->in_sync(rh->log, region, may_block);
390 * We can successfully endio the bio but should avoid the region being
400 region_t region = dm_rh_bio_to_region(rh, bio);
412 log->type->set_region_sync(log, region, 0);
415 reg = __rh_find(rh, region);
418 /* region hash entry should exist because write was in-flight */
428 * Either case, the region should have not been connected to list.
503 static void rh_inc(struct dm_region_hash *rh, region_t region)
508 reg = __rh_find(rh, region);
538 void dm_rh_dec(struct dm_region_hash *rh, region_t region)
545 reg = __rh_lookup(rh, region);
551 * There is no pending I/O for this region.
552 * We can move the region to corresponding list for next action.
553 * At this point, the region is not yet connected to any list.
555 * If the state is DM_RH_NOSYNC, the region should be kept off
558 * until the region is recovered or the map is reloaded.
585 * Starts quiescing a region in preparation for recovery.
590 region_t region;
596 r = rh->log->type->get_resync_work(rh->log, ®ion);
601 * Get this region, and start it quiescing by setting the
605 reg = __rh_find(rh, region);
722 MODULE_DESCRIPTION(DM_NAME " region hash");