From: Mike Snitzer <snitzer@xxxxxxxxxx> Subject: dm exception store: snapshot-merge usage accounting Adjust the persistent exception store's next_free to the last chunk that was processed in persistent_commit_merge(). prepare_merge() may change ps->current_area but not before commit_merge() processes 'nr_merged' chunks from it. Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> Cc: Mikulas Patocka <mpatocka@xxxxxxxxxx> --- NOTE: this is a replacement for the following patch: http://patchwork.kernel.org/patch/64746/ --- drivers/md/dm-snap-persistent.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 @@ -753,10 +753,14 @@ static int persistent_commit_merge(struc ps->current_committed -= nr_merged; /* - * Note that we make no attempt to keep ps->next_free up-to-date - * as exceptions may have been allocated out-of-order. - * Once a snapshot has become merging, nothing further uses it. + * Update ps->next_free so persistent_usage() is accurate + * - must account for the first two metadata chunks + * - prepare_merge() may change ps->current_area but not before + * commit_merge() processes 'nr_merged' from the current_area */ + ps->next_free = + (area_location(ps, ps->current_area) - 1 + + ps->current_committed + 2); return 0; } -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel