aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-snap.h
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2008-07-21 07:00:32 -0400
committerAlasdair G Kergon <agk@redhat.com>2008-07-21 07:00:32 -0400
commitcd45daffd1f7b53aac0835b23e97f814ec3f10dc (patch)
tree17d35682a8a97f3a73f513531f08ba7e0c8cd718 /drivers/md/dm-snap.h
parentdef052d21c4e77975bb75cf212f018ec913f8e2f (diff)
dm snapshot: track snapshot reads
Whenever a snapshot read gets mapped through to the origin, track it in a per-snapshot hash table indexed by chunk number, using memory allocated from a new per-snapshot mempool. We need to track these reads to avoid race conditions which will be fixed by patches that follow. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap.h')
-rw-r--r--drivers/md/dm-snap.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/md/dm-snap.h b/drivers/md/dm-snap.h
index 24f9fb73b98..70dc961f40d 100644
--- a/drivers/md/dm-snap.h
+++ b/drivers/md/dm-snap.h
@@ -130,6 +130,10 @@ struct exception_store {
130 void *context; 130 void *context;
131}; 131};
132 132
133#define DM_TRACKED_CHUNK_HASH_SIZE 16
134#define DM_TRACKED_CHUNK_HASH(x) ((unsigned long)(x) & \
135 (DM_TRACKED_CHUNK_HASH_SIZE - 1))
136
133struct dm_snapshot { 137struct dm_snapshot {
134 struct rw_semaphore lock; 138 struct rw_semaphore lock;
135 struct dm_target *ti; 139 struct dm_target *ti;
@@ -174,6 +178,11 @@ struct dm_snapshot {
174 /* Queue of snapshot writes for ksnapd to flush */ 178 /* Queue of snapshot writes for ksnapd to flush */
175 struct bio_list queued_bios; 179 struct bio_list queued_bios;
176 struct work_struct queued_bios_work; 180 struct work_struct queued_bios_work;
181
182 /* Chunks with outstanding reads */
183 mempool_t *tracked_chunk_pool;
184 spinlock_t tracked_chunk_lock;
185 struct hlist_head tracked_chunk_hash[DM_TRACKED_CHUNK_HASH_SIZE];
177}; 186};
178 187
179/* 188/*