When the snapshot is empty, return 0 as the number of allocated sectors. This will be needed for userspace to notify it that merging is finished. Signed-off-by: Mikulas Patocka --- drivers/md/dm-exception-store.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) Index: linux-2.6.28-rc2-devel/drivers/md/dm-exception-store.c =================================================================== --- linux-2.6.28-rc2-devel.orig/drivers/md/dm-exception-store.c 2008-10-27 20:31:04.000000000 +0100 +++ linux-2.6.28-rc2-devel/drivers/md/dm-exception-store.c 2008-10-27 20:31:05.000000000 +0100 @@ -472,8 +472,12 @@ static struct pstore *get_info(struct ex static void persistent_fraction_full(struct exception_store *store, sector_t *numerator, sector_t *denominator) { - *numerator = get_info(store)->next_free * store->snap->chunk_size; - *denominator = get_dev_size(store->snap->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->snap->chunk_size; + *denominator = get_dev_size(store->snap->cow->bdev) - 2 * store->snap->chunk_size; } static void persistent_destroy(struct exception_store *store)