From patchwork Fri May 1 14:20:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonthan Brassow X-Patchwork-Id: 21441 X-Patchwork-Delegate: agk@redhat.com 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 n41EKLd4016476 for ; Fri, 1 May 2009 14:20:21 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 974D261A789; Fri, 1 May 2009 10:20:20 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n41EKJF0010766 for ; Fri, 1 May 2009 10:20:19 -0400 Received: from hydrogen.msp.redhat.com (hydrogen.msp.redhat.com [10.15.80.1]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n41EKFB1007843 for ; Fri, 1 May 2009 10:20:18 -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 n41EKFSm030160 for ; Fri, 1 May 2009 09:20:15 -0500 Received: (from jbrassow@localhost) by hydrogen.msp.redhat.com (8.14.1/8.14.1/Submit) id n41EKFMC030159 for dm-devel@redhat.com; Fri, 1 May 2009 09:20:15 -0500 Date: Fri, 1 May 2009 09:20:15 -0500 From: Jonathan Brassow Message-Id: <200905011420.n41EKFMC030159@hydrogen.msp.redhat.com> To: dm-devel@redhat.com X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 23 of 33] DM Exception Store: add suspend to API 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-suspend-to-API.patch Add [pre|post]suspend functions to the exception store API. These will become important for future exception stores. Current exception store implementations will not alter metadata after a 'commit_exception' completes. However, future stores may do journaling or other actions. They might return from 'commit_exception' when the request hits the journal, but continue flushing after. This could be bad, because we expect them to not do anything once a 'suspend' is issued. Adding these functions to the API allows them to finish what they are doing and conform to device-mapper requirements. (The above was just one example... Cluster-aware exception stores will also require the notification of when they need to suspend their activity.) 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 @@ -32,6 +32,8 @@ struct dm_exception_store_type { void (*dtr) (struct dm_exception_store *store); int (*resume) (struct dm_exception_store *store); + void (*presuspend) (struct dm_exception_store *store); + void (*postsuspend) (struct dm_exception_store *store); /* * Find somewhere to store the next exception. 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 @@ -1008,6 +1008,22 @@ static void snapshot_resume(struct dm_ta up_write(&s->lock); } +static void snapshot_presuspend(struct dm_target *ti) +{ + struct dm_snapshot *s = ti->private; + + if (s->store->type->presuspend) + s->store->type->presuspend(s->store); +} + +static void snapshot_postsuspend(struct dm_target *ti) +{ + struct dm_snapshot *s = ti->private; + + if (s->store->type->postsuspend) + s->store->type->postsuspend(s->store); +} + static int snapshot_status(struct dm_target *ti, status_type_t type, char *result, unsigned int maxlen) { @@ -1310,6 +1326,8 @@ static struct target_type snapshot_targe .map = snapshot_map, .end_io = snapshot_end_io, .resume = snapshot_resume, + .presuspend = snapshot_presuspend, + .postsuspend = snapshot_postsuspend, .status = snapshot_status, };