/* Add snapshot to the list of snapshots for this origin */
/* Exceptions aren't triggered till snapshot_resume() is called */
@@ -598,8 +619,8 @@ static int snapshot_ctr(struct dm_target
goto bad_load_and_register;
}
/* Full snapshots are not usable */
/* To get here the table must be live so s->active is always set. */
@@ -931,7 +960,7 @@ static int snapshot_map(struct dm_target
}
/* If the block is already remapped - use that, else remap it */
- rtn = s->store->type->lookup_exception(s->store, chunk, &new_chunk, 0);
+ rtn = ss->store->type->lookup_exception(ss->store, chunk, &new_chunk, 0);
if (!rtn) {
remap_exception(s, bio, new_chunk);
goto out_unlock;
@@ -950,7 +979,7 @@ static int snapshot_map(struct dm_target
* writeable.
*/
if (bio_rw(bio) == WRITE) {
- pe = __find_pending_exception(s, bio, 0);
+ pe = __find_pending_exception(s, bio, ss);
if (!pe) {
__invalidate_snapshot(s, -ENOMEM);
r = -EIO;
@@ -983,7 +1012,8 @@ out:
static int snapshot_end_io(struct dm_target *ti, struct bio *bio,
int error, union map_info *map_context)
{
- struct dm_snapshot *s = ti->private;
+ struct dm_snapshare *ss = ti->private;
+ struct dm_snapshot *s = ss->snap;
struct dm_snap_tracked_chunk *c = map_context->ptr;
/*
* Target resumes cannot fail, which leaves us in a tight spot.
@@ -1004,47 +1035,48 @@ static void snapshot_resume(struct dm_ta
* 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;
-
+ r = ss->store->type->resume(ss->store);
down_write(&s->lock);
- s->active = (r) ? 0 : 1;
+ if (r == -EINVAL)
+ s->valid = 0;
+ else
+ s->active = (r) ? 0 : 1;
up_write(&s->lock);
}
switch (type) {
case STATUSTYPE_INFO:
- if (!snap->valid)
+ if (!s->valid)
DMEMIT("Invalid");
else {
- if (snap->store->type->fraction_full) {
+ if (ss->store->type->fraction_full) {
sector_t numerator, denominator;
- snap->store->type->fraction_full(snap->store,
- &numerator,
- &denominator);
+ ss->store->type->fraction_full(ss->store,
+ &numerator,
+ &denominator);
DMEMIT("%llu/%llu",
(unsigned long long)numerator,
(unsigned long long)denominator);
@@ -1060,9 +1092,9 @@ static int snapshot_status(struct dm_tar
* to make private copies if the output is to
* make sense.
*/
- DMEMIT("%s ", snap->origin->name);
- snap->store->type->status(snap->store, type,
- result+sz, maxlen-sz);
+ DMEMIT("%s ", s->origin->name);
+ ss->store->type->status(ss->store, type,
+ result+sz, maxlen-sz);
break;
}
@@ -1072,10 +1104,10 @@ static int snapshot_status(struct dm_tar
static int snapshot_message(struct dm_target *ti, unsigned argc, char **argv)
{
int r = 0;
- struct dm_snapshot *s = ti->private;
+ struct dm_snapshare *ss = ti->private;
- if (s->store->type->message)
- r = s->store->type->message(s->store, argc, argv);
+ if (ss->store->type->message)
+ r = ss->store->type->message(ss->store, argc, argv);