dm snapshot: store pointer to target instance
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 24 Apr 2008 20:43:11 +0000 (21:43 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 25 Apr 2008 12:26:40 +0000 (13:26 +0100)
Save pointer to dm_target in dm_snapshot structure.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-snap.c
drivers/md/dm-snap.h

index 08047fb1cac9fdc4d06fbd7d113b13a1fb99447c..08a8cbddb60da20b43fe6fbc2724b17110bfa956 100644 (file)
@@ -536,7 +536,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        s->last_percent = 0;
        init_rwsem(&s->lock);
        spin_lock_init(&s->pe_lock);
-       s->table = ti->table;
+       s->ti = ti;
 
        /* Allocate hash table for COW data */
        if (init_hash_tables(s)) {
@@ -699,7 +699,7 @@ static void __invalidate_snapshot(struct dm_snapshot *s, int err)
 
        s->valid = 0;
 
-       dm_table_event(s->table);
+       dm_table_event(s->ti->table);
 }
 
 static void get_pending_exception(struct dm_snap_pending_exception *pe)
@@ -1060,7 +1060,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
                        goto next_snapshot;
 
                /* Nothing to do if writing beyond end of snapshot */
-               if (bio->bi_sector >= dm_table_get_size(snap->table))
+               if (bio->bi_sector >= dm_table_get_size(snap->ti->table))
                        goto next_snapshot;
 
                /*
index 93bce5d49742e3441fd24b5cd511483b8027c846..434d1dbe6bce33b878a4be338af0a6cd8670fc2d 100644 (file)
@@ -132,7 +132,7 @@ struct exception_store {
 
 struct dm_snapshot {
        struct rw_semaphore lock;
-       struct dm_table *table;
+       struct dm_target *ti;
 
        struct dm_dev *origin;
        struct dm_dev *cow;