DM Exception Store: add resume to API
PATCH 1/1 DM Exception Store: add resume to API
Patch name: dm-exception-store-add-resume-to-API.patch
Add 'resume' to exception store API.
This is the first step to replace 'read_metadata' with 'resume'. 'resume' will populate the exception store implementation's exception cache - rather than loading the snapshot's exception cache.
Relocating the 'resume' is more in line with the way device-mapper targets (and device-mapper mirror logs) work. Additionally, with future shared exception store types, we don't duplicate the cache.
Signed-off-by Jonathan Brassow <[email protected]>
drivers/md/dm-exception-store.h +2 -0
@@ -31,6 +31,8 @@ struct dm_exception_store_type {*/ void (*dtr) (struct dm_exception_store *store); +int (*resume) (struct dm_exception_store *store); +/* * The target shouldn't read the COW device until this is * called. As exceptions are read from the COW, they are
drivers/md/dm-snap-persistent.c +92 -2
186 lines not on this page · raw message
drivers/md/dm-snap-transient.c +43 -1
85 lines not on this page · raw message
drivers/md/dm-snap.c +13 -1
@@ -1078,10 +1078,22 @@ static int snapshot_end_io(struct dm_tarstatic void snapshot_resume (struct dm_target *ti) { +int r;struct dm_snapshot *s = ti->private; +/* +* Target resumes cannot fail, which leaves us in a tight spot. +* We read the exception store, the snapshot may be invalid +* or we may have failed to resume for a different reason (EIO?). +* If invalid, mark the snapshot as such. However, if other, +* what can we do? Mark 'not active'? +*/ + r = s->store->type->resume (s->store); +if (r == -EINVAL ) + r = s->valid =0 ; +down_write (&s->lock); - s->active =1 ; + s->active = (r) ?0 :1 ;up_write (&s->lock); }