From patchwork Tue Mar 17 14:03:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 12608 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 n2HE3OeI018470 for ; Tue, 17 Mar 2009 14:03:25 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 88DE56199A3; Tue, 17 Mar 2009 10:03:25 -0400 (EDT) Received: from int-mx2.corp.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 n2HE3NL2023117 for ; Tue, 17 Mar 2009 10:03:23 -0400 Received: from hydrogen.msp.redhat.com (hydrogen.msp.redhat.com [10.15.80.1]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2HE3Ljv011133 for ; Tue, 17 Mar 2009 10:03:22 -0400 Received: from hydrogen.msp.redhat.com (localhost.localdomain [127.0.0.1]) by hydrogen.msp.redhat.com (8.14.1/8.14.1) with ESMTP id n2HE3LkM017378 for ; Tue, 17 Mar 2009 09:03:21 -0500 Received: (from jbrassow@localhost) by hydrogen.msp.redhat.com (8.14.1/8.14.1/Submit) id n2HE3LpW017376 for dm-devel@redhat.com; Tue, 17 Mar 2009 09:03:21 -0500 Date: Tue, 17 Mar 2009 09:03:21 -0500 From: Jonathan Brassow Message-Id: <200903171403.n2HE3LpW017376@hydrogen.msp.redhat.com> To: dm-devel@redhat.com X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 7 of 29] dm-snap-exception-function-changes-2.patch 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 -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm-snap.c =================================================================== --- linux-2.6.orig/drivers/md/dm-snap.c +++ linux-2.6/drivers/md/dm-snap.c @@ -436,7 +436,7 @@ static void free_completed_exception(str kmem_cache_free(exception_cache, e); } -static struct dm_snap_pending_exception *alloc_pending_exception(void *context) +static struct dm_exception *alloc_pending_exception(void *context) { struct dm_snapshot *s = context; struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool, @@ -445,12 +445,16 @@ static struct dm_snap_pending_exception atomic_inc(&s->pending_exceptions_count); pe->snap = s; - return pe; + return &pe->e; } -static void free_pending_exception(struct dm_snap_pending_exception *pe, void *unused) +static void free_pending_exception(struct dm_exception *e, void *unused) { - struct dm_snapshot *s = pe->snap; + struct dm_snap_pending_exception *pe; + struct dm_snapshot *s; + + pe = container_of(e, struct dm_snap_pending_exception, e); + s = pe->snap; mempool_free(pe, s->pending_pool); smp_mb__before_atomic_dec(); @@ -906,7 +910,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, NULL); + free_pending_exception(&primary_pe->e, NULL); } /* @@ -914,7 +918,7 @@ static struct bio *put_pending_exception * it's not itself a primary pe. */ if (!primary_pe || primary_pe != pe) - free_pending_exception(pe, NULL); + free_pending_exception(&pe->e, NULL); return origin_bios; } @@ -1041,7 +1045,7 @@ static void start_copy(struct dm_snap_pe static struct dm_snap_pending_exception * __find_pending_exception(struct dm_snapshot *s, struct bio *bio) { - struct dm_exception *e; + struct dm_exception *e, *tmp_e; struct dm_snap_pending_exception *pe; chunk_t chunk = sector_to_chunk(s->store, bio->bi_sector); @@ -1060,17 +1064,18 @@ __find_pending_exception(struct dm_snaps * to hold the lock while we do this. */ up_write(&s->lock); - pe = alloc_pending_exception(s); + tmp_e = alloc_pending_exception(s); + pe = container_of(tmp_e, struct dm_snap_pending_exception, e); down_write(&s->lock); if (!s->valid) { - free_pending_exception(pe, NULL); + free_pending_exception(&pe->e, NULL); return NULL; } e = dm_lookup_exception(s->pending, chunk); if (e) { - free_pending_exception(pe, NULL); + free_pending_exception(&pe->e, NULL); pe = container_of(e, struct dm_snap_pending_exception, e); goto out; } @@ -1083,7 +1088,7 @@ __find_pending_exception(struct dm_snaps pe->started = 0; if (s->store->type->prepare_exception(s->store, &pe->e)) { - free_pending_exception(pe, NULL); + free_pending_exception(&pe->e, NULL); return NULL; } @@ -1326,7 +1331,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, NULL); + free_pending_exception(&primary_pe->e, NULL); /* If we got here, pe_queue is necessarily empty. */ return r; }