From patchwork Thu Mar 19 21:36:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 13154 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 n2JLahKi024146 for ; Thu, 19 Mar 2009 21:36:43 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 ADAF5619BBB; Thu, 19 Mar 2009 17:36:43 -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 n2JLafM2008101 for ; Thu, 19 Mar 2009 17:36:41 -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 n2JLacIB001347 for ; Thu, 19 Mar 2009 17:36:38 -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 n2JLadAi008132 for ; Thu, 19 Mar 2009 16:36:39 -0500 Received: (from jbrassow@localhost) by hydrogen.msp.redhat.com (8.14.1/8.14.1/Submit) id n2JLadcP008131 for dm-devel@redhat.com; Thu, 19 Mar 2009 16:36:39 -0500 Date: Thu, 19 Mar 2009 16:36:39 -0500 From: Jonathan Brassow Message-Id: <200903192136.n2JLadcP008131@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 24 of 30] DM Exception Store: add arg to lookup_exception 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 Patch name: dm-exception-store-add-arg-to-lookup_exception.patch Add the 'group' parameter to the lookup_exception function. This facilitates snapshots that use the shared exception store. When writing to the origin, we need to know that all snapshots have exception already (otherwise, we need to create a new one). We could do this one at a time, but it saves us a lot if we can tell the shared exception store to check all the snapshots it is managing at once (by specifying group=1). Signed-off-by: Jonathan Brassow --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/drivers/md/dm-exception-store.h =================================================================== --- linux-2.6.orig/drivers/md/dm-exception-store.h +++ linux-2.6/drivers/md/dm-exception-store.h @@ -67,7 +67,7 @@ struct dm_exception_store_type { */ int (*lookup_exception) (struct dm_exception_store *store, chunk_t old, chunk_t *new_chunk, - int can_block); + int group, int can_block); int (*status) (struct dm_exception_store *store, status_type_t status, char *result, unsigned int maxlen); Index: linux-2.6/drivers/md/dm-snap-persistent.c =================================================================== --- linux-2.6.orig/drivers/md/dm-snap-persistent.c +++ linux-2.6/drivers/md/dm-snap-persistent.c @@ -710,7 +710,7 @@ static void persistent_commit_exception( static int persistent_lookup_exception(struct dm_exception_store *store, chunk_t old, chunk_t *new_chunk, - int can_block) + int group, int can_block) { struct pstore *ps = get_info(store); struct dm_exception *e; Index: linux-2.6/drivers/md/dm-snap-transient.c =================================================================== --- linux-2.6.orig/drivers/md/dm-snap-transient.c +++ linux-2.6/drivers/md/dm-snap-transient.c @@ -88,7 +88,7 @@ static void transient_commit_exception(s static int transient_lookup_exception(struct dm_exception_store *store, chunk_t old, chunk_t *new_chunk, - int can_block) + int group, int can_block) { struct transient_c *tc = store->context; struct dm_exception *e; 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 @@ -921,7 +921,7 @@ static int snapshot_map(struct dm_target } /* If the block is already remapped - use that, else remap it */ - rtn = s->store->type->lookup_exception(s->store, chunk, &new_chunk, 0); + rtn = s->store->type->lookup_exception(s->store, chunk, &new_chunk, 0, 0); if (!rtn) { remap_exception(s, bio, new_chunk); goto out_unlock; @@ -1109,7 +1109,7 @@ static int __origin_write(struct list_he * won't destroy the primary_pe while we're inside this loop. */ rtn = snap->store->type->lookup_exception(snap->store, chunk, - NULL, 0); + NULL, 1, 0); if (!rtn) goto next_snapshot;