aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJon Brassow <jbrassow@redhat.com>2009-12-10 18:52:10 -0500
committerAlasdair G Kergon <agk@redhat.com>2009-12-10 18:52:10 -0500
commit1d4989c858093bda0426be536fc7f9c415857836 (patch)
treef3d831048cb65b39d5fb89178d2a6de599518a2b /drivers
parentd32a6ea65fbc33621f9c790da3dff10201640b2a (diff)
dm snapshot: rename dm_snap_exception to dm_exception
The exception structure is not necessarily just a snapshot element (especially after we pull it out of dm-snap.c). Renaming appropriately. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-exception-store.h14
-rw-r--r--drivers/md/dm-snap-persistent.c4
-rw-r--r--drivers/md/dm-snap-transient.c4
-rw-r--r--drivers/md/dm-snap.c34
4 files changed, 28 insertions, 28 deletions
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index 5f9315b32a42..92749696e359 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -26,7 +26,7 @@ typedef sector_t chunk_t;
26 * of chunks that follow contiguously. Remaining bits hold the number of the 26 * of chunks that follow contiguously. Remaining bits hold the number of the
27 * chunk within the device. 27 * chunk within the device.
28 */ 28 */
29struct dm_snap_exception { 29struct dm_exception {
30 struct list_head hash_list; 30 struct list_head hash_list;
31 31
32 chunk_t old_chunk; 32 chunk_t old_chunk;
@@ -64,13 +64,13 @@ struct dm_exception_store_type {
64 * Find somewhere to store the next exception. 64 * Find somewhere to store the next exception.
65 */ 65 */
66 int (*prepare_exception) (struct dm_exception_store *store, 66 int (*prepare_exception) (struct dm_exception_store *store,
67 struct dm_snap_exception *e); 67 struct dm_exception *e);
68 68
69 /* 69 /*
70 * Update the metadata with this exception. 70 * Update the metadata with this exception.
71 */ 71 */
72 void (*commit_exception) (struct dm_exception_store *store, 72 void (*commit_exception) (struct dm_exception_store *store,
73 struct dm_snap_exception *e, 73 struct dm_exception *e,
74 void (*callback) (void *, int success), 74 void (*callback) (void *, int success),
75 void *callback_context); 75 void *callback_context);
76 76
@@ -120,12 +120,12 @@ static inline chunk_t dm_chunk_number(chunk_t chunk)
120 return chunk & (chunk_t)((1ULL << DM_CHUNK_NUMBER_BITS) - 1ULL); 120 return chunk & (chunk_t)((1ULL << DM_CHUNK_NUMBER_BITS) - 1ULL);
121} 121}
122 122
123static inline unsigned dm_consecutive_chunk_count(struct dm_snap_exception *e) 123static inline unsigned dm_consecutive_chunk_count(struct dm_exception *e)
124{ 124{
125 return e->new_chunk >> DM_CHUNK_NUMBER_BITS; 125 return e->new_chunk >> DM_CHUNK_NUMBER_BITS;
126} 126}
127 127
128static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e) 128static inline void dm_consecutive_chunk_count_inc(struct dm_exception *e)
129{ 129{
130 e->new_chunk += (1ULL << DM_CHUNK_NUMBER_BITS); 130 e->new_chunk += (1ULL << DM_CHUNK_NUMBER_BITS);
131 131
@@ -140,12 +140,12 @@ static inline chunk_t dm_chunk_number(chunk_t chunk)
140 return chunk; 140 return chunk;
141} 141}
142 142
143static inline unsigned dm_consecutive_chunk_count(struct dm_snap_exception *e) 143static inline unsigned dm_consecutive_chunk_count(struct dm_exception *e)
144{ 144{
145 return 0; 145 return 0;
146} 146}
147 147
148static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e) 148static inline void dm_consecutive_chunk_count_inc(struct dm_exception *e)
149{ 149{
150} 150}
151 151
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index 7e855fbeb22e..24b8acd1be83 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -580,7 +580,7 @@ static int persistent_read_metadata(struct dm_exception_store *store,
580} 580}
581 581
582static int persistent_prepare_exception(struct dm_exception_store *store, 582static int persistent_prepare_exception(struct dm_exception_store *store,
583 struct dm_snap_exception *e) 583 struct dm_exception *e)
584{ 584{
585 struct pstore *ps = get_info(store); 585 struct pstore *ps = get_info(store);
586 uint32_t stride; 586 uint32_t stride;
@@ -607,7 +607,7 @@ static int persistent_prepare_exception(struct dm_exception_store *store,
607} 607}
608 608
609static void persistent_commit_exception(struct dm_exception_store *store, 609static void persistent_commit_exception(struct dm_exception_store *store,
610 struct dm_snap_exception *e, 610 struct dm_exception *e,
611 void (*callback) (void *, int success), 611 void (*callback) (void *, int success),
612 void *callback_context) 612 void *callback_context)
613{ 613{
diff --git a/drivers/md/dm-snap-transient.c b/drivers/md/dm-snap-transient.c
index cde5aa558e6d..267801b34ff6 100644
--- a/drivers/md/dm-snap-transient.c
+++ b/drivers/md/dm-snap-transient.c
@@ -36,7 +36,7 @@ static int transient_read_metadata(struct dm_exception_store *store,
36} 36}
37 37
38static int transient_prepare_exception(struct dm_exception_store *store, 38static int transient_prepare_exception(struct dm_exception_store *store,
39 struct dm_snap_exception *e) 39 struct dm_exception *e)
40{ 40{
41 struct transient_c *tc = store->context; 41 struct transient_c *tc = store->context;
42 sector_t size = get_dev_size(store->cow->bdev); 42 sector_t size = get_dev_size(store->cow->bdev);
@@ -51,7 +51,7 @@ static int transient_prepare_exception(struct dm_exception_store *store,
51} 51}
52 52
53static void transient_commit_exception(struct dm_exception_store *store, 53static void transient_commit_exception(struct dm_exception_store *store,
54 struct dm_snap_exception *e, 54 struct dm_exception *e,
55 void (*callback) (void *, int success), 55 void (*callback) (void *, int success),
56 void *callback_context) 56 void *callback_context)
57{ 57{
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 9135498213ef..a7d60f644063 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -116,7 +116,7 @@ static int bdev_equal(struct block_device *lhs, struct block_device *rhs)
116} 116}
117 117
118struct dm_snap_pending_exception { 118struct dm_snap_pending_exception {
119 struct dm_snap_exception e; 119 struct dm_exception e;
120 120
121 /* 121 /*
122 * Origin buffers waiting for this to complete are held 122 * Origin buffers waiting for this to complete are held
@@ -371,7 +371,7 @@ static int init_exception_table(struct exception_table *et, uint32_t size,
371static void exit_exception_table(struct exception_table *et, struct kmem_cache *mem) 371static void exit_exception_table(struct exception_table *et, struct kmem_cache *mem)
372{ 372{
373 struct list_head *slot; 373 struct list_head *slot;
374 struct dm_snap_exception *ex, *next; 374 struct dm_exception *ex, *next;
375 int i, size; 375 int i, size;
376 376
377 size = et->hash_mask + 1; 377 size = et->hash_mask + 1;
@@ -390,7 +390,7 @@ static uint32_t exception_hash(struct exception_table *et, chunk_t chunk)
390 return (chunk >> et->hash_shift) & et->hash_mask; 390 return (chunk >> et->hash_shift) & et->hash_mask;
391} 391}
392 392
393static void remove_exception(struct dm_snap_exception *e) 393static void remove_exception(struct dm_exception *e)
394{ 394{
395 list_del(&e->hash_list); 395 list_del(&e->hash_list);
396} 396}
@@ -399,11 +399,11 @@ static void remove_exception(struct dm_snap_exception *e)
399 * Return the exception data for a sector, or NULL if not 399 * Return the exception data for a sector, or NULL if not
400 * remapped. 400 * remapped.
401 */ 401 */
402static struct dm_snap_exception *lookup_exception(struct exception_table *et, 402static struct dm_exception *lookup_exception(struct exception_table *et,
403 chunk_t chunk) 403 chunk_t chunk)
404{ 404{
405 struct list_head *slot; 405 struct list_head *slot;
406 struct dm_snap_exception *e; 406 struct dm_exception *e;
407 407
408 slot = &et->table[exception_hash(et, chunk)]; 408 slot = &et->table[exception_hash(et, chunk)];
409 list_for_each_entry (e, slot, hash_list) 409 list_for_each_entry (e, slot, hash_list)
@@ -414,9 +414,9 @@ static struct dm_snap_exception *lookup_exception(struct exception_table *et,
414 return NULL; 414 return NULL;
415} 415}
416 416
417static struct dm_snap_exception *alloc_exception(void) 417static struct dm_exception *alloc_exception(void)
418{ 418{
419 struct dm_snap_exception *e; 419 struct dm_exception *e;
420 420
421 e = kmem_cache_alloc(exception_cache, GFP_NOIO); 421 e = kmem_cache_alloc(exception_cache, GFP_NOIO);
422 if (!e) 422 if (!e)
@@ -425,7 +425,7 @@ static struct dm_snap_exception *alloc_exception(void)
425 return e; 425 return e;
426} 426}
427 427
428static void free_exception(struct dm_snap_exception *e) 428static void free_exception(struct dm_exception *e)
429{ 429{
430 kmem_cache_free(exception_cache, e); 430 kmem_cache_free(exception_cache, e);
431} 431}
@@ -451,10 +451,10 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe)
451} 451}
452 452
453static void insert_exception(struct exception_table *eh, 453static void insert_exception(struct exception_table *eh,
454 struct dm_snap_exception *new_e) 454 struct dm_exception *new_e)
455{ 455{
456 struct list_head *l; 456 struct list_head *l;
457 struct dm_snap_exception *e = NULL; 457 struct dm_exception *e = NULL;
458 458
459 l = &eh->table[exception_hash(eh, new_e->old_chunk)]; 459 l = &eh->table[exception_hash(eh, new_e->old_chunk)];
460 460
@@ -499,7 +499,7 @@ out:
499static int dm_add_exception(void *context, chunk_t old, chunk_t new) 499static int dm_add_exception(void *context, chunk_t old, chunk_t new)
500{ 500{
501 struct dm_snapshot *s = context; 501 struct dm_snapshot *s = context;
502 struct dm_snap_exception *e; 502 struct dm_exception *e;
503 503
504 e = alloc_exception(); 504 e = alloc_exception();
505 if (!e) 505 if (!e)
@@ -876,7 +876,7 @@ static struct bio *put_pending_exception(struct dm_snap_pending_exception *pe)
876 876
877static void pending_complete(struct dm_snap_pending_exception *pe, int success) 877static void pending_complete(struct dm_snap_pending_exception *pe, int success)
878{ 878{
879 struct dm_snap_exception *e; 879 struct dm_exception *e;
880 struct dm_snapshot *s = pe->snap; 880 struct dm_snapshot *s = pe->snap;
881 struct bio *origin_bios = NULL; 881 struct bio *origin_bios = NULL;
882 struct bio *snapshot_bios = NULL; 882 struct bio *snapshot_bios = NULL;
@@ -988,7 +988,7 @@ static void start_copy(struct dm_snap_pending_exception *pe)
988static struct dm_snap_pending_exception * 988static struct dm_snap_pending_exception *
989__lookup_pending_exception(struct dm_snapshot *s, chunk_t chunk) 989__lookup_pending_exception(struct dm_snapshot *s, chunk_t chunk)
990{ 990{
991 struct dm_snap_exception *e = lookup_exception(&s->pending, chunk); 991 struct dm_exception *e = lookup_exception(&s->pending, chunk);
992 992
993 if (!e) 993 if (!e)
994 return NULL; 994 return NULL;
@@ -1034,7 +1034,7 @@ __find_pending_exception(struct dm_snapshot *s,
1034 return pe; 1034 return pe;
1035} 1035}
1036 1036
1037static void remap_exception(struct dm_snapshot *s, struct dm_snap_exception *e, 1037static void remap_exception(struct dm_snapshot *s, struct dm_exception *e,
1038 struct bio *bio, chunk_t chunk) 1038 struct bio *bio, chunk_t chunk)
1039{ 1039{
1040 bio->bi_bdev = s->store->cow->bdev; 1040 bio->bi_bdev = s->store->cow->bdev;
@@ -1048,7 +1048,7 @@ static void remap_exception(struct dm_snapshot *s, struct dm_snap_exception *e,
1048static int snapshot_map(struct dm_target *ti, struct bio *bio, 1048static int snapshot_map(struct dm_target *ti, struct bio *bio,
1049 union map_info *map_context) 1049 union map_info *map_context)
1050{ 1050{
1051 struct dm_snap_exception *e; 1051 struct dm_exception *e;
1052 struct dm_snapshot *s = ti->private; 1052 struct dm_snapshot *s = ti->private;
1053 int r = DM_MAPIO_REMAPPED; 1053 int r = DM_MAPIO_REMAPPED;
1054 chunk_t chunk; 1054 chunk_t chunk;
@@ -1221,7 +1221,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
1221{ 1221{
1222 int r = DM_MAPIO_REMAPPED, first = 0; 1222 int r = DM_MAPIO_REMAPPED, first = 0;
1223 struct dm_snapshot *snap; 1223 struct dm_snapshot *snap;
1224 struct dm_snap_exception *e; 1224 struct dm_exception *e;
1225 struct dm_snap_pending_exception *pe, *next_pe, *primary_pe = NULL; 1225 struct dm_snap_pending_exception *pe, *next_pe, *primary_pe = NULL;
1226 chunk_t chunk; 1226 chunk_t chunk;
1227 LIST_HEAD(pe_queue); 1227 LIST_HEAD(pe_queue);
@@ -1500,7 +1500,7 @@ static int __init dm_snapshot_init(void)
1500 goto bad2; 1500 goto bad2;
1501 } 1501 }
1502 1502
1503 exception_cache = KMEM_CACHE(dm_snap_exception, 0); 1503 exception_cache = KMEM_CACHE(dm_exception, 0);
1504 if (!exception_cache) { 1504 if (!exception_cache) {
1505 DMERR("Couldn't create exception cache."); 1505 DMERR("Couldn't create exception cache.");
1506 r = -ENOMEM; 1506 r = -ENOMEM;