DM Exception Store: return zero when empty
PATCH 1/1 DM Exception Store: return zero when empty
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.
drivers/md/dm-snap-persistent.c +6 -2
@@ -492,8 +492,12 @@ static struct pstore *get_info(struct dmstatic 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)
Alasdair G Kergon
maintainerQuoted 2 lines · Jon Brassow
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
Quoted 6 lines · Alasdair G Kergon
Quoted 2 lines · Jon Brassow
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