dm exception store: add merge specific methods
Add functions that decide how many consecutive chunks of snapshot to merge back into the origin next and to update the metadata afterwards. prepare_merge provides a pointer to the most recent still-to-be-merged chunk and returns how many previous ones are consecutive and can be processed together. commit_merge removes the nr_merged most-recent chunks permanently from the exception store. The number must not exceed that returned by prepare_merge. Introduce NUM_SNAPSHOT_HDR_CHUNKS to show where the snapshot header chunk is accounted for. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
committed by
Alasdair G Kergon
parent
615d1eb9ca
commit
4454a6216f
@@ -74,6 +74,23 @@ struct dm_exception_store_type {
|
||||
void (*callback) (void *, int success),
|
||||
void *callback_context);
|
||||
|
||||
/*
|
||||
* Returns 0 if the exception store is empty.
|
||||
*
|
||||
* If there are exceptions still to be merged, sets
|
||||
* *last_old_chunk and *last_new_chunk to the most recent
|
||||
* still-to-be-merged chunk and returns the number of
|
||||
* consecutive previous ones.
|
||||
*/
|
||||
int (*prepare_merge) (struct dm_exception_store *store,
|
||||
chunk_t *last_old_chunk, chunk_t *last_new_chunk);
|
||||
|
||||
/*
|
||||
* Clear the last n exceptions.
|
||||
* nr_merged must be <= the value returned by prepare_merge.
|
||||
*/
|
||||
int (*commit_merge) (struct dm_exception_store *store, int nr_merged);
|
||||
|
||||
/*
|
||||
* The snapshot is invalid, note this in the metadata.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user