[dm-devel] [PATCH 1 of 2] DM Exception Store: return zero when empty
Jonathan Brassow
jbrassow at redhat.com
Wed Sep 23 15:24:58 UTC 2009
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 at redhat.com>
Reviewed-by: Mike Snitzer <snitzer at redhat.com>
Reviewed-by: Jonathan Brassow <jbrassow at 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)
More information about the dm-devel
mailing list