Made a mistake while trying to fix-up warnings from checkpatch.pl.
This repost fixes the introduced error.
brassow
Patch name: dm-snap-introduce-snapshare.patch
This patch introduces the dm_snapshare structure - the structure that
will be used to share the dm_snapshot structure. While each user-visible
snapshot will have a snapshare, if the back-end exception store is shared,
there will be sharing of the main dm_snapshot structure. This allows us
to consume less space, make fewer exception store calls, and generally
reduce the amount of processing down per snapshot.
This patch creates the initial ties between the snapshare and snapshot
structures, sets up the constructor/destructor functions, and moves the
exception store to the snapshare structure.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
/* Add snapshot to the list of snapshots for this origin */
/* Exceptions aren't triggered till snapshot_resume() is called */
@@ -598,8 +622,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 +963,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, 0);
+ rtn = ss->store->type->lookup_exception(ss->store, chunk, &new_chunk, 0, 0);
if (!rtn) {
remap_exception(s, bio, new_chunk);
goto out_unlock;
@@ -950,7 +982,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 +1015,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 +1038,50 @@ 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);
+ r = ss->store->type->resume(ss->store);
+ down_write(&s->lock);
if (r == -EINVAL)
r = s->valid = 0;
+ else
+ s->active = (r) ? 0 : 1;
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 +1097,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 +1109,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);