===================================================================
@@ -419,7 +419,7 @@ static struct dm_exception *dm_lookup_ex
return NULL;
}
-static struct dm_exception *alloc_completed_exception(void)
+static struct dm_exception *alloc_completed_exception(void *unused)
{
struct dm_exception *e;
@@ -430,13 +430,14 @@ static struct dm_exception *alloc_comple
return e;
}
-static void free_completed_exception(struct dm_exception *e)
+static void free_completed_exception(struct dm_exception *e, void *unused)
{
kmem_cache_free(exception_cache, e);
}
-static struct dm_snap_pending_exception *alloc_pending_exception(struct dm_snapshot *s)
+static struct dm_snap_pending_exception *alloc_pending_exception(void *context)
{
+ struct dm_snapshot *s = context;
struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool,
GFP_NOIO);
@@ -446,7 +447,8 @@ static struct dm_snap_pending_exception
return pe;
}
-static void free_pending_exception(struct dm_snap_pending_exception *pe)
+static void free_pending_exception(struct dm_snap_pending_exception *pe,
+ void *unused)
{
struct dm_snapshot *s = pe->snap;
@@ -475,7 +477,7 @@ static void dm_insert_exception(struct d
new_e->new_chunk == (dm_chunk_number(e->new_chunk) +
dm_consecutive_chunk_count(e) + 1)) {
dm_consecutive_chunk_count_inc(e);
- free_completed_exception(new_e);
+ free_completed_exception(new_e, NULL);
return;
}
@@ -485,7 +487,7 @@ static void dm_insert_exception(struct d
dm_consecutive_chunk_count_inc(e);
e->old_chunk--;
e->new_chunk--;
- free_completed_exception(new_e);
+ free_completed_exception(new_e, NULL);
return;
}
@@ -506,7 +508,7 @@ static int dm_add_exception(void *contex
struct dm_snapshot *s = context;
struct dm_exception *e;
- e = alloc_completed_exception();
+ e = alloc_completed_exception(NULL);
if (!e)
return -ENOMEM;
@@ -904,7 +906,7 @@ static struct bio *put_pending_exception
if (primary_pe &&
atomic_dec_and_test(&primary_pe->ref_count)) {
origin_bios = bio_list_get(&primary_pe->origin_bios);
- free_pending_exception(primary_pe);
+ free_pending_exception(primary_pe, NULL);
}
/*
@@ -912,7 +914,7 @@ static struct bio *put_pending_exception
* it's not itself a primary pe.
*/
if (!primary_pe || primary_pe != pe)
- free_pending_exception(pe);
+ free_pending_exception(pe, NULL);
return origin_bios;
}
@@ -933,7 +935,7 @@ static void pending_complete(struct dm_s
goto out;
}
- e = alloc_completed_exception();
+ e = alloc_completed_exception(NULL);
if (!e) {
down_write(&s->lock);
__invalidate_snapshot(s, -ENOMEM);
@@ -944,7 +946,7 @@ static void pending_complete(struct dm_s
down_write(&s->lock);
if (!s->valid) {
- free_completed_exception(e);
+ free_completed_exception(e, NULL);
error = 1;
goto out;
}
@@ -1055,7 +1057,7 @@ __find_pending_exception(struct dm_snaps
pe2 = __lookup_pending_exception(s, chunk);
if (pe2) {
- free_pending_exception(pe);
+ free_pending_exception(pe, NULL);
return pe2;
}
@@ -1067,7 +1069,7 @@ __find_pending_exception(struct dm_snaps
pe->started = 0;
if (s->store->type->prepare_exception(s->store, &pe->e)) {
- free_pending_exception(pe);
+ free_pending_exception(pe, NULL);
return NULL;
}
@@ -1133,14 +1135,14 @@ static int snapshot_map(struct dm_target
down_write(&s->lock);
if (!s->valid) {
- free_pending_exception(pe);
+ free_pending_exception(pe, NULL);
r = -EIO;
goto out_unlock;
}
e = dm_lookup_exception(&s->complete, chunk);
if (e) {
- free_pending_exception(pe);
+ free_pending_exception(pe, NULL);
remap_exception(s, e, bio, chunk);
goto out_unlock;
}
@@ -1287,13 +1289,13 @@ static int __origin_write(struct list_he
down_write(&snap->lock);
if (!snap->valid) {
- free_pending_exception(pe);
+ free_pending_exception(pe, NULL);
goto next_snapshot;
}
e = dm_lookup_exception(&snap->complete, chunk);
if (e) {
- free_pending_exception(pe);
+ free_pending_exception(pe, NULL);
goto next_snapshot;
}
@@ -1347,7 +1349,7 @@ static int __origin_write(struct list_he
if (first && atomic_dec_and_test(&primary_pe->ref_count)) {
flush_bios(bio_list_get(&primary_pe->origin_bios));
- free_pending_exception(primary_pe);
+ free_pending_exception(primary_pe, NULL);
/* If we got here, pe_queue is necessarily empty. */
return r;
}
Patch name: dm-snap-exception-function-changes-1.patch This patch moves towards a generalized interface for functions that allocate and deallocate exceptions. So, we add an additional parameter for context pointers. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel