Commit 1d4989c8 authored by Jon Brassow's avatar Jon Brassow Committed by Alasdair G Kergon

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: default avatarJonathan Brassow <jbrassow@redhat.com>
Reviewed-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent d32a6ea6
...@@ -26,7 +26,7 @@ typedef sector_t chunk_t; ...@@ -26,7 +26,7 @@ typedef sector_t chunk_t;
* of chunks that follow contiguously. Remaining bits hold the number of the * of chunks that follow contiguously. Remaining bits hold the number of the
* chunk within the device. * chunk within the device.
*/ */
struct dm_snap_exception { struct dm_exception {
struct list_head hash_list; struct list_head hash_list;
chunk_t old_chunk; chunk_t old_chunk;
...@@ -64,13 +64,13 @@ struct dm_exception_store_type { ...@@ -64,13 +64,13 @@ struct dm_exception_store_type {
* Find somewhere to store the next exception. * Find somewhere to store the next exception.
*/ */
int (*prepare_exception) (struct dm_exception_store *store, int (*prepare_exception) (struct dm_exception_store *store,
struct dm_snap_exception *e); struct dm_exception *e);
/* /*
* Update the metadata with this exception. * Update the metadata with this exception.
*/ */
void (*commit_exception) (struct dm_exception_store *store, void (*commit_exception) (struct dm_exception_store *store,
struct dm_snap_exception *e, struct dm_exception *e,
void (*callback) (void *, int success), void (*callback) (void *, int success),
void *callback_context); void *callback_context);
...@@ -120,12 +120,12 @@ static inline chunk_t dm_chunk_number(chunk_t chunk) ...@@ -120,12 +120,12 @@ static inline chunk_t dm_chunk_number(chunk_t chunk)
return chunk & (chunk_t)((1ULL << DM_CHUNK_NUMBER_BITS) - 1ULL); return chunk & (chunk_t)((1ULL << DM_CHUNK_NUMBER_BITS) - 1ULL);
} }
static inline unsigned dm_consecutive_chunk_count(struct dm_snap_exception *e) static inline unsigned dm_consecutive_chunk_count(struct dm_exception *e)
{ {
return e->new_chunk >> DM_CHUNK_NUMBER_BITS; return e->new_chunk >> DM_CHUNK_NUMBER_BITS;
} }
static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e) static inline void dm_consecutive_chunk_count_inc(struct dm_exception *e)
{ {
e->new_chunk += (1ULL << DM_CHUNK_NUMBER_BITS); e->new_chunk += (1ULL << DM_CHUNK_NUMBER_BITS);
...@@ -140,12 +140,12 @@ static inline chunk_t dm_chunk_number(chunk_t chunk) ...@@ -140,12 +140,12 @@ static inline chunk_t dm_chunk_number(chunk_t chunk)
return chunk; return chunk;
} }
static inline unsigned dm_consecutive_chunk_count(struct dm_snap_exception *e) static inline unsigned dm_consecutive_chunk_count(struct dm_exception *e)
{ {
return 0; return 0;
} }
static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e) static inline void dm_consecutive_chunk_count_inc(struct dm_exception *e)
{ {
} }
......
...@@ -580,7 +580,7 @@ static int persistent_read_metadata(struct dm_exception_store *store, ...@@ -580,7 +580,7 @@ static int persistent_read_metadata(struct dm_exception_store *store,
} }
static int persistent_prepare_exception(struct dm_exception_store *store, static int persistent_prepare_exception(struct dm_exception_store *store,
struct dm_snap_exception *e) struct dm_exception *e)
{ {
struct pstore *ps = get_info(store); struct pstore *ps = get_info(store);
uint32_t stride; uint32_t stride;
...@@ -607,7 +607,7 @@ static int persistent_prepare_exception(struct dm_exception_store *store, ...@@ -607,7 +607,7 @@ static int persistent_prepare_exception(struct dm_exception_store *store,
} }
static void persistent_commit_exception(struct dm_exception_store *store, static void persistent_commit_exception(struct dm_exception_store *store,
struct dm_snap_exception *e, struct dm_exception *e,
void (*callback) (void *, int success), void (*callback) (void *, int success),
void *callback_context) void *callback_context)
{ {
......
...@@ -36,7 +36,7 @@ static int transient_read_metadata(struct dm_exception_store *store, ...@@ -36,7 +36,7 @@ static int transient_read_metadata(struct dm_exception_store *store,
} }
static int transient_prepare_exception(struct dm_exception_store *store, static int transient_prepare_exception(struct dm_exception_store *store,
struct dm_snap_exception *e) struct dm_exception *e)
{ {
struct transient_c *tc = store->context; struct transient_c *tc = store->context;
sector_t size = get_dev_size(store->cow->bdev); sector_t size = get_dev_size(store->cow->bdev);
...@@ -51,7 +51,7 @@ static int transient_prepare_exception(struct dm_exception_store *store, ...@@ -51,7 +51,7 @@ static int transient_prepare_exception(struct dm_exception_store *store,
} }
static void transient_commit_exception(struct dm_exception_store *store, static void transient_commit_exception(struct dm_exception_store *store,
struct dm_snap_exception *e, struct dm_exception *e,
void (*callback) (void *, int success), void (*callback) (void *, int success),
void *callback_context) void *callback_context)
{ {
......
...@@ -116,7 +116,7 @@ static int bdev_equal(struct block_device *lhs, struct block_device *rhs) ...@@ -116,7 +116,7 @@ static int bdev_equal(struct block_device *lhs, struct block_device *rhs)
} }
struct dm_snap_pending_exception { struct dm_snap_pending_exception {
struct dm_snap_exception e; struct dm_exception e;
/* /*
* Origin buffers waiting for this to complete are held * 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, ...@@ -371,7 +371,7 @@ static int init_exception_table(struct exception_table *et, uint32_t size,
static void exit_exception_table(struct exception_table *et, struct kmem_cache *mem) static void exit_exception_table(struct exception_table *et, struct kmem_cache *mem)
{ {
struct list_head *slot; struct list_head *slot;
struct dm_snap_exception *ex, *next; struct dm_exception *ex, *next;
int i, size; int i, size;
size = et->hash_mask + 1; size = et->hash_mask + 1;
...@@ -390,7 +390,7 @@ static uint32_t exception_hash(struct exception_table *et, chunk_t chunk) ...@@ -390,7 +390,7 @@ static uint32_t exception_hash(struct exception_table *et, chunk_t chunk)
return (chunk >> et->hash_shift) & et->hash_mask; return (chunk >> et->hash_shift) & et->hash_mask;
} }
static void remove_exception(struct dm_snap_exception *e) static void remove_exception(struct dm_exception *e)
{ {
list_del(&e->hash_list); list_del(&e->hash_list);
} }
...@@ -399,11 +399,11 @@ static void remove_exception(struct dm_snap_exception *e) ...@@ -399,11 +399,11 @@ static void remove_exception(struct dm_snap_exception *e)
* Return the exception data for a sector, or NULL if not * Return the exception data for a sector, or NULL if not
* remapped. * remapped.
*/ */
static struct dm_snap_exception *lookup_exception(struct exception_table *et, static struct dm_exception *lookup_exception(struct exception_table *et,
chunk_t chunk) chunk_t chunk)
{ {
struct list_head *slot; struct list_head *slot;
struct dm_snap_exception *e; struct dm_exception *e;
slot = &et->table[exception_hash(et, chunk)]; slot = &et->table[exception_hash(et, chunk)];
list_for_each_entry (e, slot, hash_list) list_for_each_entry (e, slot, hash_list)
...@@ -414,9 +414,9 @@ static struct dm_snap_exception *lookup_exception(struct exception_table *et, ...@@ -414,9 +414,9 @@ static struct dm_snap_exception *lookup_exception(struct exception_table *et,
return NULL; return NULL;
} }
static struct dm_snap_exception *alloc_exception(void) static struct dm_exception *alloc_exception(void)
{ {
struct dm_snap_exception *e; struct dm_exception *e;
e = kmem_cache_alloc(exception_cache, GFP_NOIO); e = kmem_cache_alloc(exception_cache, GFP_NOIO);
if (!e) if (!e)
...@@ -425,7 +425,7 @@ static struct dm_snap_exception *alloc_exception(void) ...@@ -425,7 +425,7 @@ static struct dm_snap_exception *alloc_exception(void)
return e; return e;
} }
static void free_exception(struct dm_snap_exception *e) static void free_exception(struct dm_exception *e)
{ {
kmem_cache_free(exception_cache, e); kmem_cache_free(exception_cache, e);
} }
...@@ -451,10 +451,10 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe) ...@@ -451,10 +451,10 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe)
} }
static void insert_exception(struct exception_table *eh, static void insert_exception(struct exception_table *eh,
struct dm_snap_exception *new_e) struct dm_exception *new_e)
{ {
struct list_head *l; struct list_head *l;
struct dm_snap_exception *e = NULL; struct dm_exception *e = NULL;
l = &eh->table[exception_hash(eh, new_e->old_chunk)]; l = &eh->table[exception_hash(eh, new_e->old_chunk)];
...@@ -499,7 +499,7 @@ static void insert_exception(struct exception_table *eh, ...@@ -499,7 +499,7 @@ static void insert_exception(struct exception_table *eh,
static int dm_add_exception(void *context, chunk_t old, chunk_t new) static int dm_add_exception(void *context, chunk_t old, chunk_t new)
{ {
struct dm_snapshot *s = context; struct dm_snapshot *s = context;
struct dm_snap_exception *e; struct dm_exception *e;
e = alloc_exception(); e = alloc_exception();
if (!e) if (!e)
...@@ -876,7 +876,7 @@ static struct bio *put_pending_exception(struct dm_snap_pending_exception *pe) ...@@ -876,7 +876,7 @@ static struct bio *put_pending_exception(struct dm_snap_pending_exception *pe)
static void pending_complete(struct dm_snap_pending_exception *pe, int success) static void pending_complete(struct dm_snap_pending_exception *pe, int success)
{ {
struct dm_snap_exception *e; struct dm_exception *e;
struct dm_snapshot *s = pe->snap; struct dm_snapshot *s = pe->snap;
struct bio *origin_bios = NULL; struct bio *origin_bios = NULL;
struct bio *snapshot_bios = NULL; struct bio *snapshot_bios = NULL;
...@@ -988,7 +988,7 @@ static void start_copy(struct dm_snap_pending_exception *pe) ...@@ -988,7 +988,7 @@ static void start_copy(struct dm_snap_pending_exception *pe)
static struct dm_snap_pending_exception * static struct dm_snap_pending_exception *
__lookup_pending_exception(struct dm_snapshot *s, chunk_t chunk) __lookup_pending_exception(struct dm_snapshot *s, chunk_t chunk)
{ {
struct dm_snap_exception *e = lookup_exception(&s->pending, chunk); struct dm_exception *e = lookup_exception(&s->pending, chunk);
if (!e) if (!e)
return NULL; return NULL;
...@@ -1034,7 +1034,7 @@ __find_pending_exception(struct dm_snapshot *s, ...@@ -1034,7 +1034,7 @@ __find_pending_exception(struct dm_snapshot *s,
return pe; return pe;
} }
static void remap_exception(struct dm_snapshot *s, struct dm_snap_exception *e, static void remap_exception(struct dm_snapshot *s, struct dm_exception *e,
struct bio *bio, chunk_t chunk) struct bio *bio, chunk_t chunk)
{ {
bio->bi_bdev = s->store->cow->bdev; bio->bi_bdev = s->store->cow->bdev;
...@@ -1048,7 +1048,7 @@ static void remap_exception(struct dm_snapshot *s, struct dm_snap_exception *e, ...@@ -1048,7 +1048,7 @@ static void remap_exception(struct dm_snapshot *s, struct dm_snap_exception *e,
static int snapshot_map(struct dm_target *ti, struct bio *bio, static int snapshot_map(struct dm_target *ti, struct bio *bio,
union map_info *map_context) union map_info *map_context)
{ {
struct dm_snap_exception *e; struct dm_exception *e;
struct dm_snapshot *s = ti->private; struct dm_snapshot *s = ti->private;
int r = DM_MAPIO_REMAPPED; int r = DM_MAPIO_REMAPPED;
chunk_t chunk; chunk_t chunk;
...@@ -1221,7 +1221,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio) ...@@ -1221,7 +1221,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
{ {
int r = DM_MAPIO_REMAPPED, first = 0; int r = DM_MAPIO_REMAPPED, first = 0;
struct dm_snapshot *snap; struct dm_snapshot *snap;
struct dm_snap_exception *e; struct dm_exception *e;
struct dm_snap_pending_exception *pe, *next_pe, *primary_pe = NULL; struct dm_snap_pending_exception *pe, *next_pe, *primary_pe = NULL;
chunk_t chunk; chunk_t chunk;
LIST_HEAD(pe_queue); LIST_HEAD(pe_queue);
...@@ -1500,7 +1500,7 @@ static int __init dm_snapshot_init(void) ...@@ -1500,7 +1500,7 @@ static int __init dm_snapshot_init(void)
goto bad2; goto bad2;
} }
exception_cache = KMEM_CACHE(dm_snap_exception, 0); exception_cache = KMEM_CACHE(dm_exception, 0);
if (!exception_cache) { if (!exception_cache) {
DMERR("Couldn't create exception cache."); DMERR("Couldn't create exception cache.");
r = -ENOMEM; r = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment