From patchwork Mon Oct 5 19:00:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 51773 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 n95J0nQ8015850 for ; Mon, 5 Oct 2009 19:00:49 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 979178E06F1; Mon, 5 Oct 2009 15:00:49 -0400 (EDT) Received: from int-mx02.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 n95J0kOH009725 for ; Mon, 5 Oct 2009 15:00:46 -0400 Received: from localhost (dhcp-100-18-171.bos.redhat.com [10.16.18.171]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n95J0jLE011374; Mon, 5 Oct 2009 15:00:45 -0400 From: Mike Snitzer To: dm-devel@redhat.com Date: Mon, 5 Oct 2009 15:00:31 -0400 Message-Id: <1254769231-12053-5-git-send-email-snitzer@redhat.com> In-Reply-To: <1254769231-12053-1-git-send-email-snitzer@redhat.com> References: <1254769231-12053-1-git-send-email-snitzer@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: Mikulas Patocka Subject: [dm-devel] [PATCH 4/4] dm-exception-store-dont-read-metadata-if-going-to-handover 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-exception-store.h b/drivers/md/dm-exception-store.h index 4e8086f..5737796 100644 --- a/drivers/md/dm-exception-store.h +++ b/drivers/md/dm-exception-store.h @@ -54,11 +54,15 @@ struct dm_exception_store_type { * The target shouldn't read the COW device until this is * called. As exceptions are read from the COW, they are * reported back via the callback. + * + * will_handover means that there is another snapshot active; + * chunk size must be setup but no exceptions need to be read + * because they will be handed over from the active snapshot. */ int (*read_metadata) (struct dm_exception_store *store, int (*callback)(void *callback_context, chunk_t old, chunk_t new), - void *callback_context); + void *callback_context, int will_handover); /* * Find somewhere to store the next exception. diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c index 746602b..fbcedc3 100644 --- a/drivers/md/dm-snap-persistent.c +++ b/drivers/md/dm-snap-persistent.c @@ -518,7 +518,7 @@ static void persistent_dtr(struct dm_exception_store *store) static int persistent_read_metadata(struct dm_exception_store *store, int (*callback)(void *callback_context, chunk_t old, chunk_t new), - void *callback_context) + void *callback_context, int will_handover) { int r, uninitialized_var(new_snapshot); struct pstore *ps = get_info(store); @@ -575,7 +575,8 @@ static int persistent_read_metadata(struct dm_exception_store *store, /* * Read the metadata. */ - r = read_exceptions(ps, callback, callback_context); + if (!will_handover) + r = read_exceptions(ps, callback, callback_context); return r; } diff --git a/drivers/md/dm-snap-transient.c b/drivers/md/dm-snap-transient.c index 3d9fd91..7f4f825 100644 --- a/drivers/md/dm-snap-transient.c +++ b/drivers/md/dm-snap-transient.c @@ -30,7 +30,7 @@ static void transient_dtr(struct dm_exception_store *store) static int transient_read_metadata(struct dm_exception_store *store, int (*callback)(void *callback_context, chunk_t old, chunk_t new), - void *callback_context) + void *callback_context, int will_handover) { return 0; } diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 8d3efa0..275ae33 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -708,7 +708,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) /* Metadata must only be loaded into one table at once */ r = s->store->type->read_metadata(s->store, dm_add_exception, - (void *)s); + (void *)s, s->handover); if (r < 0) { ti->error = "Failed to read snapshot metadata"; goto bad_load_and_register;