From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com, Alasdair G Kergon <agk@redhat.com>
Subject: Re: clustered snapshots
Date: Mon, 5 Oct 2009 09:38:41 -0400 [thread overview]
Message-ID: <20091005133841.GA30122@redhat.com> (raw)
In-Reply-To: <20091005043334.GA27758@redhat.com>
On Mon, Oct 05 2009 at 12:33am -0400,
Mike Snitzer <snitzer@redhat.com> wrote:
> On Sun, Oct 04 2009 at 10:25pm -0400,
> Mikulas Patocka <mpatocka@redhat.com> wrote:
>
> > Hi
> >
> > I don't understand the purpose of this patch. I think it's useless.
>
> You don't understand it, so you think it's useless.. nice to know where
> I'm starting.
>
> > - during merge, nothing except the merge process reads the on-disk
> > exceptions. So it doesn't matter when you clean them. You must clean them
> > before dropping the interlock, but the order is not important.
>
> Sure, I thought the same but quickly realized that in practice order
> does matter if you'd like to avoid failing the in-core exception cleanup
> (IFF we allow chunks to be inserted before existing chunks; aka
> "back-merges").
>
> Your original approach to cleaning all on-disk exceptions then all
> in-core has no hope of working for "back-merges". Your original
> snapshot-merge completely eliminated insertions before existing chunks.
<snip - my long-winded defensiveness>
> Lesson I learned is that the in-core dm_snap_exception's consecutive
> chunk accounting is _really_ subtle. And while I agree there should be
> no relation between the proper cleanup of on-disk and in-core
> exceptions; doing the cleanup of each in lock-step appears to be the
> only way forward (that I found).
If I just judge the location of the chunk within the in-core exception
support for back-merges works just as well. Here is a minimalist patch
the accomplishes the same:
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index bcfbe85..b271f56 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -790,17 +790,25 @@ static void merge_callback(int read_err, unsigned long write_err, void *context)
* so that dm_consecutive_chunk_count_dec() accounting works
*/
for (i = s->merge_write_interlock_n - 1; i >= 0; i--) {
- e = lookup_exception(&s->complete,
- s->merge_write_interlock + i);
+ chunk_t old_chunk = s->merge_write_interlock + i;
+ e = lookup_exception(&s->complete, old_chunk);
if (!e) {
DMERR("exception for block %llu is on "
"disk but not in memory",
- (unsigned long long)
- s->merge_write_interlock + i);
+ (unsigned long long)old_chunk);
up_write(&s->lock);
goto shut;
}
if (dm_consecutive_chunk_count(e)) {
+ if (old_chunk == e->old_chunk) {
+ e->old_chunk++;
+ e->new_chunk++;
+ } else if (old_chunk != e->old_chunk +
+ dm_consecutive_chunk_count(e)) {
+ DMERR("merge from the middle of a chunk range");
+ up_write(&s->lock);
+ goto shut;
+ }
dm_consecutive_chunk_count_dec(e);
} else {
remove_exception(e);
next prev parent reply other threads:[~2009-10-05 13:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-28 23:16 clustered snapshots Mikulas Patocka
2009-09-29 21:39 ` Mikulas Patocka
2009-09-30 16:17 ` Jonathan Brassow
2009-10-01 5:43 ` Mikulas Patocka
2009-10-02 17:26 ` Mike Snitzer
2009-10-02 17:55 ` Mikulas Patocka
2009-10-04 3:48 ` Mike Snitzer
2009-10-05 2:25 ` Mikulas Patocka
2009-10-05 4:33 ` Mike Snitzer
2009-10-05 13:38 ` Mike Snitzer [this message]
2009-10-05 15:57 ` Mikulas Patocka
2009-10-05 16:24 ` Mike Snitzer
-- strict thread matches above, loose matches on Subject: below --
2011-04-26 9:18 Christian Motschke
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=20091005133841.GA30122@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.