/* * dm-snapshot.c * * Copyright (C) 2001-2002 Sistina Software (UK) Limited. * * This file is released under the GPL. */#include<linux/blkdev.h>#include<linux/device-mapper.h>#include<linux/delay.h>#include<linux/fs.h>#include<linux/init.h>#include<linux/kdev_t.h>#include<linux/list.h>#include<linux/mempool.h>#include<linux/module.h>#include<linux/slab.h>#include<linux/vmalloc.h>#include<linux/log2.h>#include<linux/dm-kcopyd.h>#include<linux/workqueue.h>#include"dm-exception-store.h"#define DM_MSG_PREFIX "snapshots"/* * The percentage increment we will wake up users at */#define WAKE_UP_PERCENT 5/* * kcopyd priority of snapshot operations */#define SNAPSHOT_COPY_PRIORITY 2/* * Reserve 1MB for each snapshot initially (with minimum of 1 page). */#define SNAPSHOT_PAGES (((1UL << 20) >> PAGE_SHIFT) ? : 1)/* * The size of the mempool used to track chunks in use. */#define MIN_IOS 256#define DM_TRACKED_CHUNK_HASH_SIZE 16#define DM_TRACKED_CHUNK_HASH(x) ((unsigned long)(x) & \ (DM_TRACKED_CHUNK_HASH_SIZE - 1))structexception_table{uint32_thash_mask;unsignedhash_shift;structlist_head*table;};structdm_snapshot{structrw_semaphorelock;structdm_dev