aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorJonathan Brassow <jbrassow@redhat.com>2009-04-02 14:55:32 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-04-02 14:55:32 -0400
commit0cea9c78270cdf1d2ad74ce0e083d5555a0842e8 (patch)
tree783785811de9ed558ec1179a6bc201dd6161cae6 /drivers/md
parent493df71c6420b211a68ae82b889c1e8a5fe701be (diff)
dm exception store: move dm_target pointer
Move target pointer from snapshot to exception store. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-exception-store.c3
-rw-r--r--drivers/md/dm-exception-store.h3
-rw-r--r--drivers/md/dm-snap.c7
-rw-r--r--drivers/md/dm-snap.h1
4 files changed, 7 insertions, 7 deletions
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 8912a3637cae..fe0cfa677139 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -137,7 +137,7 @@ int dm_exception_store_type_unregister(struct dm_exception_store_type *type)
137} 137}
138EXPORT_SYMBOL(dm_exception_store_type_unregister); 138EXPORT_SYMBOL(dm_exception_store_type_unregister);
139 139
140int dm_exception_store_create(const char *type_name, 140int dm_exception_store_create(const char *type_name, struct dm_target *ti,
141 struct dm_exception_store **store) 141 struct dm_exception_store **store)
142{ 142{
143 int r = 0; 143 int r = 0;
@@ -155,6 +155,7 @@ int dm_exception_store_create(const char *type_name,
155 } 155 }
156 156
157 tmp_store->type = type; 157 tmp_store->type = type;
158 tmp_store->ti = ti;
158 159
159 r = type->ctr(tmp_store, 0, NULL); 160 r = type->ctr(tmp_store, 0, NULL);
160 if (r) { 161 if (r) {
diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
index 31377150080e..4b7f7d441f5f 100644
--- a/drivers/md/dm-exception-store.h
+++ b/drivers/md/dm-exception-store.h
@@ -95,6 +95,7 @@ struct dm_exception_store_type {
95 95
96struct dm_exception_store { 96struct dm_exception_store {
97 struct dm_exception_store_type *type; 97 struct dm_exception_store_type *type;
98 struct dm_target *ti;
98 99
99 struct dm_snapshot *snap; 100 struct dm_snapshot *snap;
100 101
@@ -147,7 +148,7 @@ static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e)
147int dm_exception_store_type_register(struct dm_exception_store_type *type); 148int dm_exception_store_type_register(struct dm_exception_store_type *type);
148int dm_exception_store_type_unregister(struct dm_exception_store_type *type); 149int dm_exception_store_type_unregister(struct dm_exception_store_type *type);
149 150
150int dm_exception_store_create(const char *type_name, 151int dm_exception_store_create(const char *type_name, struct dm_target *ti,
151 struct dm_exception_store **store); 152 struct dm_exception_store **store);
152void dm_exception_store_destroy(struct dm_exception_store *store); 153void dm_exception_store_destroy(struct dm_exception_store *store);
153 154
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index be698f3a4ae4..4429c2a1d6fb 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -615,7 +615,6 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
615 atomic_set(&s->pending_exceptions_count, 0); 615 atomic_set(&s->pending_exceptions_count, 0);
616 init_rwsem(&s->lock); 616 init_rwsem(&s->lock);
617 spin_lock_init(&s->pe_lock); 617 spin_lock_init(&s->pe_lock);
618 s->ti = ti;
619 618
620 /* Allocate hash table for COW data */ 619 /* Allocate hash table for COW data */
621 if (init_hash_tables(s)) { 620 if (init_hash_tables(s)) {
@@ -624,7 +623,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
624 goto bad3; 623 goto bad3;
625 } 624 }
626 625
627 r = dm_exception_store_create(argv[2], &s->store); 626 r = dm_exception_store_create(argv[2], ti, &s->store);
628 if (r) { 627 if (r) {
629 ti->error = "Couldn't create exception store"; 628 ti->error = "Couldn't create exception store";
630 r = -EINVAL; 629 r = -EINVAL;
@@ -820,7 +819,7 @@ static void __invalidate_snapshot(struct dm_snapshot *s, int err)
820 819
821 s->valid = 0; 820 s->valid = 0;
822 821
823 dm_table_event(s->ti->table); 822 dm_table_event(s->store->ti->table);
824} 823}
825 824
826static void get_pending_exception(struct dm_snap_pending_exception *pe) 825static void get_pending_exception(struct dm_snap_pending_exception *pe)
@@ -1196,7 +1195,7 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
1196 goto next_snapshot; 1195 goto next_snapshot;
1197 1196
1198 /* Nothing to do if writing beyond end of snapshot */ 1197 /* Nothing to do if writing beyond end of snapshot */
1199 if (bio->bi_sector >= dm_table_get_size(snap->ti->table)) 1198 if (bio->bi_sector >= dm_table_get_size(snap->store->ti->table))
1200 goto next_snapshot; 1199 goto next_snapshot;
1201 1200
1202 /* 1201 /*
diff --git a/drivers/md/dm-snap.h b/drivers/md/dm-snap.h
index 627be0f52c32..93cd8ee8997f 100644
--- a/drivers/md/dm-snap.h
+++ b/drivers/md/dm-snap.h
@@ -25,7 +25,6 @@ struct exception_table {
25 25
26struct dm_snapshot { 26struct dm_snapshot {
27 struct rw_semaphore lock; 27 struct rw_semaphore lock;
28 struct dm_target *ti;
29 28
30 struct dm_dev *origin; 29 struct dm_dev *origin;
31 struct dm_dev *cow; 30 struct dm_dev *cow;