This patch changes the 'drop_snapshot' function in the
exception store API. Ignoring the fact that it was already
misnamed (we don't drop the snapshot, we invalidate the
exception store), there are new requirements for altering
exception stores.
In addition to invalidating an exception store, we now need
to be able to specify that a particular exception store be
permanently destroyed (useful especially for "shared"
exception store implementations).
DM_ES_INVALID: Means that the exception store is invalid.
(Perhaps due to running out of available
storage.) However, the exception store is
is to be left in-place.
DM_ES_DESTROY: Means the exception store is to be permanently
removed.
DM_ES_DESTROY furthers the case for the suspend functions
added to the API in an earlier patch. They give the
exception store implementations time to finish removing
a particular instance before being required to suspend
activity.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
+#define DM_ES_INVALID 0x1
+#define DM_ES_DESTROY 0x2
+
/*
* Abstraction to handle the meta/layout of exception stores (the
* COW device).
@@ -61,15 +64,22 @@ struct dm_exception_store_type {
chunk_t old, chunk_t *new_chunk,
int can_block);
- /*
- * The snapshot is invalid, note this in the metadata.
- */
- void (*drop_snapshot) (struct dm_exception_store *store);
-
int (*status) (struct dm_exception_store *store, status_type_t status,
char *result, unsigned int maxlen);
/*
+ * There are certain messages that are required by the (permanent)
+ * exception store implementations:
+ * "ES_INVALIDATE": exception store is now invalid (but not deleted)
+ * "ES_DESTROY" : Permanently remove store upon suspend/dtr.
+ *
+ * Exception store implementations are free to implement other
+ * functions too.
+ */
+ int (*message) (struct dm_exception_store *store,
+ unsigned argc, char **argv);
+
+ /*
* Return how full the snapshot is.
*/
void (*fraction_full) (struct dm_exception_store *store,
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
@@ -366,14 +366,17 @@ bad:
return r;
}
-static int write_header(struct pstore *ps)
+static int write_header(struct pstore *ps, int destroy)
{
struct disk_header *dh;
This patch changes the 'drop_snapshot' function in the
exception store API. Ignoring the fact that it was already
misnamed (we don't drop the snapshot, we invalidate the
exception store), there are new requirements for altering
exception stores.
In addition to invalidating an exception store, we now need
to be able to specify that a particular exception store be
permanently destroyed (useful especially for "shared"
exception store implementations).
DM_ES_INVALID: Means that the exception store is invalid.
(Perhaps due to running out of available
storage.) However, the exception store is
is to be left in-place.
DM_ES_DESTROY: Means the exception store is to be permanently
removed.
DM_ES_DESTROY furthers the case for the suspend functions
added to the API in an earlier patch. They give the
exception store implementations time to finish removing
a particular instance before being required to suspend
activity.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
+#define DM_ES_INVALID 0x1
+#define DM_ES_DESTROY 0x2
+
/*
* Abstraction to handle the meta/layout of exception stores (the
* COW device).
@@ -61,16 +64,23 @@ struct dm_exception_store_type {
chunk_t old, chunk_t *new_chunk,
int can_block);
- /*
- * The snapshot is invalid, note this in the metadata.
- */
- void (*drop_snapshot) (struct dm_exception_store *store);
-
unsigned (*status) (struct dm_exception_store *store,
status_type_t status, char *result,
unsigned maxlen);
/*
+ * There are certain messages that are required by the (permanent)
+ * exception store implementations:
+ * "ES_INVALIDATE": exception store is now invalid (but not deleted)
+ * "ES_DESTROY" : Permanently remove store upon suspend/dtr.
+ *
+ * Exception store implementations are free to implement other
+ * functions too.
+ */
+ int (*message) (struct dm_exception_store *store,
+ unsigned argc, char **argv);
+
+ /*
* Return how full the snapshot is.
*/
void (*fraction_full) (struct dm_exception_store *store,
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
@@ -366,14 +366,17 @@ bad:
return r;
}
-static int write_header(struct pstore *ps)
+static int write_header(struct pstore *ps, int destroy)
{
struct disk_header *dh;