public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: snitzer@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/snapshot/snapshot.c Date: Tue, 05 Jan 2010 21:14:00 -0000 [thread overview] Message-ID: <20100105211405.31122.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: snitzer@sourceware.org 2010-01-05 21:14:05 Modified files: . : WHATS_NEW lib/snapshot : snapshot.c Log message: Use snapshot metadata usage to determine if snapshot is empty Version >= 1.8.0 of the DM snapshot target appends metadata sectors used to a snapshot's status. This patch allows LVM2 to accurately determine if the snapshot store is empty. Knowing when a snapshot store is empty is important in the context of snapshot-merge (means merge is complete). Also update LVM2 to be aware of the possibility for "Merge failed" in the snapshot-merge target's status. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1362&r2=1.1363 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39 --- LVM2/WHATS_NEW 2010/01/05 20:56:51 1.1362 +++ LVM2/WHATS_NEW 2010/01/05 21:14:04 1.1363 @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Use snapshot metadata usage to determine if a snapshot is empty. Add --poll flag to vgchange and lvchange. Propagate commit and revert metadata notification to other nodes in cluster. Use proper mask for VG lock mode in clvmd. --- LVM2/lib/snapshot/snapshot.c 2009/10/01 00:35:30 1.38 +++ LVM2/lib/snapshot/snapshot.c 2010/01/05 21:14:05 1.39 @@ -95,19 +95,27 @@ char *params, uint64_t *total_numerator, uint64_t *total_denominator) { - uint64_t numerator, denominator; + uint64_t total_sectors, sectors_allocated, metadata_sectors; + int r; - if (sscanf(params, "%" PRIu64 "/%" PRIu64, - &numerator, &denominator) == 2) { - *total_numerator += numerator; - *total_denominator += denominator; - if (!numerator) + /* + * snapshot target's percent format: + * <= 1.7.0: <sectors_allocated>/<total_sectors> + * >= 1.8.0: <sectors_allocated>/<total_sectors> <metadata_sectors> + */ + r = sscanf(params, "%" PRIu64 "/%" PRIu64 " %" PRIu64, + §ors_allocated, &total_sectors, &metadata_sectors); + if (r == 2 || r == 3) { + *total_numerator += sectors_allocated; + *total_denominator += total_sectors; + if (r == 3 && sectors_allocated == metadata_sectors) *percent_range = PERCENT_0; - else if (numerator == denominator) + else if (sectors_allocated == total_sectors) *percent_range = PERCENT_100; else *percent_range = PERCENT_0_TO_100; - } else if (!strcmp(params, "Invalid")) + } else if (!strcmp(params, "Invalid") || + !strcmp(params, "Merge failed")) *percent_range = PERCENT_INVALID; else return 0;
reply other threads:[~2010-01-05 21:14 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20100105211405.31122.qmail@sourceware.org \ --to=snitzer@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).