From patchwork Wed Mar 25 21:36:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 14429 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 n2PLad2m004970 for ; Wed, 25 Mar 2009 21:36:39 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 CB18161A1C9; Wed, 25 Mar 2009 17:36:39 -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 n2PLacZR027557 for ; Wed, 25 Mar 2009 17:36:38 -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 n2PLaVu2014278 for ; Wed, 25 Mar 2009 17:36:31 -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 n2PLaZMs021872 for ; Wed, 25 Mar 2009 16:36:35 -0500 Received: (from jbrassow@localhost) by hydrogen.msp.redhat.com (8.14.1/8.14.1/Submit) id n2PLaZAR021871 for dm-devel@redhat.com; Wed, 25 Mar 2009 16:36:35 -0500 Date: Wed, 25 Mar 2009 16:36:35 -0500 From: Jonathan Brassow Message-Id: <200903252136.n2PLaZAR021871@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 18 of 33] DM Exception Store: populate cache on commit 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-populate-cache-on-commit.patch The 'resume' exception store function is now in place to load the exception store type's caches on startup. However, we still need to continue to populate the caches as new exceptions are committed. This patch takes care of that. 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-snap-persistent.c =================================================================== --- linux-2.6.orig/drivers/md/dm-snap-persistent.c +++ linux-2.6/drivers/md/dm-snap-persistent.c @@ -665,6 +665,15 @@ static void persistent_commit_exception( write_exception(ps, ps->current_committed++, &de); /* + * We are safe to add the exception to our cache before we + * issue the callbacks. If we fail to allocate the memory + * to put it in the cache though, the callbacks will have to + * report the failure. + */ + if (add_exception(store, de.old_chunk, de.new_chunk)) + ps->valid = 0; + + /* * Add the callback to the back of the array. This code * is the only place where the callback array is * manipulated, and we know that it will never be called 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 @@ -77,7 +77,20 @@ static void transient_commit_exception(s void (*callback) (void *, int success), void *callback_context) { - /* Just succeed */ + struct transient_c *tc = store->context; + struct dm_exception *new; + + new = dm_alloc_exception(tc->table); + if (!new) { + callback(callback_context, 0); + return; + } + + new->old_chunk = e->old_chunk; + new->new_chunk = e->new_chunk; + + dm_insert_exception(tc->table, new); + callback(callback_context, 1); }