All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1 of 2] DM Exception Store: return zero when empty
@ 2009-09-23 15:24 Jonathan Brassow
  2009-09-24 12:51 ` Alasdair G Kergon
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Brassow @ 2009-09-23 15:24 UTC (permalink / raw)
  To: dm-devel; +Cc: mpatocka, snitzer, agk

Patch name: dm-exception-store-return-zero-when-empty.patch

When the snapshot is empty, return 0 as the number of allocated sectors.
This will be needed to properly notify userspace that merging is finished.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Jonathan Brassow <jbrassow@redhat.com>
Index: linux-2.6/drivers/md/dm-snap-persistent.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-snap-persistent.c
+++ linux-2.6/drivers/md/dm-snap-persistent.c
@@ -492,8 +492,12 @@ static struct pstore *get_info(struct dm
 static void persistent_fraction_full(struct dm_exception_store *store,
 				     sector_t *numerator, sector_t *denominator)
 {
-	*numerator = get_info(store)->next_free * store->chunk_size;
-	*denominator = get_dev_size(store->cow->bdev);
+	/*
+	 * Compensate for the first two chunks that are always allocated.
+	 * Make sure that we return 0 when there are no exceptions.
+	 */
+	*numerator = (get_info(store)->next_free - 2) * store->chunk_size;
+	*denominator = get_dev_size(store->cow->bdev) - 2 * store->chunk_size;
 }
 
 static void persistent_dtr(struct dm_exception_store *store)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1 of 2] DM Exception Store: return zero when empty
  2009-09-23 15:24 [PATCH 1 of 2] DM Exception Store: return zero when empty Jonathan Brassow
@ 2009-09-24 12:51 ` Alasdair G Kergon
  2009-09-29 15:38   ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: Alasdair G Kergon @ 2009-09-24 12:51 UTC (permalink / raw)
  To: Jonathan Brassow; +Cc: dm-devel, mpatocka, snitzer

On Wed, Sep 23, 2009 at 10:24:58AM -0500, Jon Brassow wrote:
> When the snapshot is empty, return 0 as the number of allocated sectors.
> This will be needed to properly notify userspace that merging is finished.

A kernel/userspace interface change and visible to the user in their tools.
Needs discussion.
 
Alasdair

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1 of 2] DM Exception Store: return zero when empty
  2009-09-24 12:51 ` Alasdair G Kergon
@ 2009-09-29 15:38   ` Mike Snitzer
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2009-09-29 15:38 UTC (permalink / raw)
  To: Alasdair G Kergon; +Cc: dm-devel, Mikulas Patocka

On Thu, Sep 24 2009 at  8:51am -0400,
Alasdair G Kergon <agk@redhat.com> wrote:

> On Wed, Sep 23, 2009 at 10:24:58AM -0500, Jon Brassow wrote:
> > When the snapshot is empty, return 0 as the number of allocated sectors.
> > This will be needed to properly notify userspace that merging is finished.
> 
> A kernel/userspace interface change and visible to the user in their tools.
> Needs discussion.

I'd be quite surprised if any users' scripts had the intelligence that
the persistent exception store always used the first 2 chunks.

I view this patch as a fix and would like to see it pushed for
2.6.32-rcX

This patch is also a prerequisite for some patches I just posted to
lvm-devel:
http://www.redhat.com/archives/lvm-devel/2009-September/msg00145.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-29 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-23 15:24 [PATCH 1 of 2] DM Exception Store: return zero when empty Jonathan Brassow
2009-09-24 12:51 ` Alasdair G Kergon
2009-09-29 15:38   ` Mike Snitzer

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.