From patchwork Tue Sep 29 22:53:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 50628 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8TMsGSi017373 for ; Tue, 29 Sep 2009 22:54:16 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id B772C61B173; Tue, 29 Sep 2009 18:53:58 -0400 (EDT) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n8TMrqBZ030547 for ; Tue, 29 Sep 2009 18:53:52 -0400 Received: from localhost (dhcp-100-18-171.bos.redhat.com [10.16.18.171]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8TMrqqq007964; Tue, 29 Sep 2009 18:53:52 -0400 From: Mike Snitzer To: dm-devel@redhat.com Date: Tue, 29 Sep 2009 18:53:37 -0400 Message-Id: <1254264823-11538-13-git-send-email-snitzer@redhat.com> In-Reply-To: <1254264823-11538-1-git-send-email-snitzer@redhat.com> References: <1254264823-11538-1-git-send-email-snitzer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: Subject: [dm-devel] [PATCH 12/18] dm-snapshot-exception-function-changes-5 X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 2ec51b6..fabf833 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -443,6 +443,25 @@ static struct dm_exception *dm_lookup_exception(struct dm_exception_table *et, return NULL; } +static struct dm_exception *dm_alloc_exception(struct dm_exception_table *et) +{ + struct dm_exception_table_internal *eti; + + eti = container_of(et, struct dm_exception_table_internal, et); + + return eti->alloc_exception(eti->alloc_context); +} + +static void dm_free_exception(struct dm_exception_table *et, + struct dm_exception *e) +{ + struct dm_exception_table_internal *eti; + + eti = container_of(et, struct dm_exception_table_internal, et); + + return eti->free_exception(e, eti->free_context); +} + static struct dm_exception *alloc_completed_exception(void *unused) { struct dm_exception *e; @@ -504,7 +523,7 @@ static void dm_insert_exception(struct dm_exception_table *eh, 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, NULL); + dm_free_exception(eh, new_e); return; } @@ -535,7 +554,7 @@ static int dm_add_exception(void *context, chunk_t old, chunk_t new) struct dm_snapshot *s = context; struct dm_exception *e; - e = alloc_completed_exception(NULL); + e = dm_alloc_exception(s->complete); if (!e) return -ENOMEM; @@ -985,7 +1004,7 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success) goto out; } - e = alloc_completed_exception(NULL); + e = dm_alloc_exception(s->complete); if (!e) { down_write(&s->lock); __invalidate_snapshot(s, -ENOMEM); @@ -996,7 +1015,7 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success) down_write(&s->lock); if (!s->valid) { - free_completed_exception(e, NULL); + dm_free_exception(s->complete, e); error = 1; goto out; }