/* On successful return, the caller must not attempt to acquire _hash_lock without first calling dm_table_put, because dm_table_destroy waits for this dm_table_put and could be called under this lock.  */
static struct dm_table* dm_get_inactive_table(struct mapped_device *md)
/* On successful return, the caller must not attempt to acquire _hash_lock without first calling dm_table_put, because dm_table_destroy waits for this dm_table_put and could be called under this lock.  */
static struct dm_table* dm_get_inactive_table(struct mapped_device *md)
{
	struct hash_cell *hc;
	struct dm_table *table = NULL;
	down_read(&_hash_lock);
	hc = dm_get_mdptr(md);
	if (!hc || hc->md != md) {
		DMWARN("device has been removed from the dev hash table.");
		goto out;
	}
	table = hc->new_map;
	if (table)
		dm_table_get(table);
out:
	up_read(&_hash_lock);
	return table;
}