[PATCH 1 of 2] DM Exception Store: return zero when empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Reviewed-by: Mike Snitzer <snitzer@xxxxxxxxxx>
Reviewed-by: Jonathan Brassow <jbrassow@xxxxxxxxxx>
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)

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux