All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com, Mikulas Patocka <mpatocka@redhat.com>
Subject: Re: [PATCH v5 03/13] dm exception store: snapshot-merge usage accounting
Date: Mon, 7 Dec 2009 18:53:01 -0500	[thread overview]
Message-ID: <20091207235300.GA31492@redhat.com> (raw)
In-Reply-To: <20091207234453.GE30941@agk-dp.fab.redhat.com>

On Mon, Dec 07 2009 at  6:44pm -0500,
Alasdair G Kergon <agk@redhat.com> wrote:

> On Mon, Dec 07, 2009 at 04:10:53PM -0500, Mike Snitzer wrote:
> > Subject: dm exception store: snapshot-merge usage accounting
> 
> Comments updated a bit and folded into
> dm-exception-store-add-merge-specific-methods.patch # 64745

OK, I did the following based on our chat.. but haven't looked at your
version yet (ftp://sources.redhat.com appears to be down?).

Mike
---

From: Mike Snitzer <snitzer@redhat.com>
Subject: dm exception store: snapshot-merge usage accounting

Adjust the persistent exception store's next_free to the last chunk that
was processed in persistent_commit_merge().  prepare_merge() may change
ps->current_area but not before commit_merge() processes 'nr_merged'
chunks from it.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>
---
 drivers/md/dm-snap-persistent.c |   33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

Index: linux-rhel6/drivers/md/dm-snap-persistent.c
===================================================================
--- linux-rhel6.orig/drivers/md/dm-snap-persistent.c
+++ linux-rhel6/drivers/md/dm-snap-persistent.c
@@ -119,7 +119,24 @@ struct pstore {
 	chunk_t current_area;
 
 	/*
-	 * The next free chunk for an exception.
+	 * 'next_free' can have two meanings.
+	 *
+	 * When creating exceptions:
+	 * The next free chunk for an exception.  'next_free' means all
+	 * the slots here and above are free.  Though there may be
+	 * holes in the exception store because chunks can be committed
+	 * out of order -- if the system halts abruptly it could
+	 * leave a hole.
+	 *
+	 * When merging exceptions:
+	 * The last chunk that was merged from a linear extent of
+	 * chunks [returned from persistent_prepare_merge()].
+	 * When merging 'next_free' does _not_ mean all the slots here
+	 * and above are free.  It holds the value it would have held
+	 * if all chunks in an area had been committed in order.  So
+	 * the value may occasionally be slightly inaccurate, because
+	 * chunks can be committed out of order, but since it's only
+	 * used for 'status' this doesn't matter.
 	 */
 	chunk_t next_free;
 
@@ -753,10 +770,16 @@ static int persistent_commit_merge(struc
 	ps->current_committed -= nr_merged;
 
 	/*
-	 * Note that we make no attempt to keep ps->next_free up-to-date
-	 * as exceptions may have been allocated out-of-order.
-	 * Once a snapshot has become merging, nothing further uses it.
-	 */
+	 * Update ps->next_free so persistent_usage() is accurate
+	 * - it may be less than the actual 'next_free' chunk but we
+	 *   will not allocate exceptions again so this doesn't matter
+	 * - must account for the first two metadata chunks
+	 * - prepare_merge() may change ps->current_area but not before
+	 *   commit_merge() processes 'nr_merged' from the current_area
+	 */
+	ps->next_free =
+		(area_location(ps, ps->current_area) - 1 +
+		 ps->current_committed + 2);
 
 	return 0;
 }

  reply	other threads:[~2009-12-07 23:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04  2:23 [PATCH v5 00/13] snapshot-merge target Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 01/13] dm snapshot: rework writing to snapshot origin Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 02/13] dm exception store: add snapshot-merge specific methods Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 03/13] dm exception store: snapshot-merge usage accounting Mike Snitzer
2009-12-07 21:10   ` Mike Snitzer
2009-12-07 23:44     ` Alasdair G Kergon
2009-12-07 23:53       ` Mike Snitzer [this message]
2009-12-08  0:00         ` Alasdair G Kergon
2009-12-08  2:46         ` Mikulas Patocka
2009-12-04  2:23 ` [PATCH v5 04/13] dm snapshot: add snapshot-merge target Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 05/13] dm snapshot: merge target should not allocate new exceptions Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 06/13] dm snapshot: do not allow more than one merging snapshot Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 07/13] dm snapshot: the merge procedure Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 08/13] dm snapshot: queue writes to an area that is actively being merged Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 09/13] dm snapshot: do not merge a chunk until active writes to it finish Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 10/13] dm snapshot: make exceptions in other snapshots when merging Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 11/13] dm snapshot: redirect accesses to origin if merging snap invalidated Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 12/13] dm snapshot: merge a linear region of chunks using one large IO Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 13/13] dm snapshot: report merge failure in status Mike Snitzer
2009-12-05 18:44   ` Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091207235300.GA31492@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.