Esempio n. 1
0
/*-----------------------------------------------------------------
 * We need to keep track of which region a bio is doing io for.
 * To avoid a memory allocation to store just 5 or 6 bits, we
 * ensure the 'struct io' pointer is aligned so enough low bits are
 * always zero and then combine it with the region number directly in
 * bi_private.
 *---------------------------------------------------------------*/
static void store_io_and_region_in_bio(struct bio *bio, struct io *io,
				       unsigned region)
{
	if (unlikely(!IS_ALIGNED((unsigned long)io, DM_IO_MAX_REGIONS))) {
		DMCRIT("Unaligned struct io pointer %p", io);
		BUG();
	}

	bio->bi_private = (void *)((unsigned long)io | region);
}
void dm_unregister_target(struct target_type *tt)
{
    down_write(&_lock);
    if (!__find_target_type(tt->name)) {
        DMCRIT("Unregistering unrecognised target: %s", tt->name);
        BUG();
    }

    list_del(&tt->list);

    up_write(&_lock);
}