Add the 'group' paramenter to the prepare_exception function. This
is used to facilitate shared exception stores. When writing to
a snapshot, an exception is created for only that snapshot (group=0).
When writing to the origin, all snapshots are affected, so rather
than preparing_exceptions for all snapshots one at a time, we can
use the group=1 to indicate that all snapshots managed by the shared
exception store be updated.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
/*
* Find somewhere to store the next exception.
+ * If the exception store implementation is shared,
+ * the 'group' field signifies whether to operate on
+ * the group sharing one exception store, or whether
+ * to operate on just one of those in the shared
+ * exception store.
*/
int (*prepare_exception) (struct dm_exception_store *store,
- struct dm_exception *e);
+ struct dm_exception *e, int group);
/*
* Update the metadata with this exception.
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
@@ -604,7 +604,7 @@ read_metadata:
}
Add the 'group' paramenter to the prepare_exception function. This
is used to facilitate shared exception stores. When writing to
a snapshot, an exception is created for only that snapshot (group=0).
When writing to the origin, all snapshots are affected, so rather
than preparing_exceptions for all snapshots one at a time, we can
use the group=1 to indicate that all snapshots managed by the shared
exception store be updated.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
/*
* Find somewhere to store the next exception.
+ * If the exception store implementation is shared,
+ * the 'group' field signifies whether to operate on
+ * the group sharing one exception store, or whether
+ * to operate on just one of those in the shared
+ * exception store.
*/
int (*prepare_exception) (struct dm_exception_store *store,
- struct dm_exception *e);
+ struct dm_exception *e, int group);
/*
* Update the metadata with this exception.
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
@@ -604,7 +604,7 @@ read_metadata:
}
/*
+ * __find_pending_exception
+ * @s
+ * @pe
+ * @chunk
+ * @group
+ *
* Looks to see if this snapshot already has a pending exception
* for this chunk, otherwise it allocates a new one and inserts
* it into the pending table.
@@ -845,7 +851,8 @@ __lookup_pending_exception(struct dm_sna
*/
static struct dm_snap_pending_exception *
__find_pending_exception(struct dm_snapshot *s,
- struct dm_snap_pending_exception *pe, chunk_t chunk)
+ struct dm_snap_pending_exception *pe,
+ chunk_t chunk, int group)
{
struct dm_snap_pending_exception *pe2;