diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2009-12-10 18:52:29 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-12-10 18:52:29 -0500 |
commit | 4454a6216f75a9ef8c4bd0a65e34b101f725ef1e (patch) | |
tree | 25b97b629954702692397072dd6cd20f34221b5c /drivers/md/dm-exception-store.h | |
parent | 615d1eb9cad9b34ed17c18c604254e8db533ac6f (diff) |
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>
Diffstat (limited to 'drivers/md/dm-exception-store.h')
-rw-r--r-- | drivers/md/dm-exception-store.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h index bb8874653de1..c53e08935b42 100644 --- a/drivers/md/dm-exception-store.h +++ b/drivers/md/dm-exception-store.h | |||
@@ -75,6 +75,23 @@ struct dm_exception_store_type { | |||
75 | void *callback_context); | 75 | void *callback_context); |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Returns 0 if the exception store is empty. | ||
79 | * | ||
80 | * If there are exceptions still to be merged, sets | ||
81 | * *last_old_chunk and *last_new_chunk to the most recent | ||
82 | * still-to-be-merged chunk and returns the number of | ||
83 | * consecutive previous ones. | ||
84 | */ | ||
85 | int (*prepare_merge) (struct dm_exception_store *store, | ||
86 | chunk_t *last_old_chunk, chunk_t *last_new_chunk); | ||
87 | |||
88 | /* | ||
89 | * Clear the last n exceptions. | ||
90 | * nr_merged must be <= the value returned by prepare_merge. | ||
91 | */ | ||
92 | int (*commit_merge) (struct dm_exception_store *store, int nr_merged); | ||
93 | |||
94 | /* | ||
78 | * The snapshot is invalid, note this in the metadata. | 95 | * The snapshot is invalid, note this in the metadata. |
79 | */ | 96 | */ |
80 | void (*drop_snapshot) (struct dm_exception_store *store); | 97 | void (*drop_snapshot) (struct dm_exception_store *store); |