diff options
author | Mike Snitzer <snitzer@redhat.com> | 2011-01-13 14:59:59 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2011-01-13 14:59:59 -0500 |
commit | b83b2f295aec418c7501c05df4dfd168a79d165a (patch) | |
tree | 55249c09281930055439c449f55f156784d0bb68 /drivers/md/dm-snap.c | |
parent | 239c8dd533e74de4a7f3c85c4f9f430eb08867c1 (diff) |
dm snapshot: avoid storing private suspended state
Use dm_suspended() rather than having each snapshot target maintain a
private 'suspended' flag in struct dm_snapshot.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r-- | drivers/md/dm-snap.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 0f47698beafa..fdde53cd12b7 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -79,9 +79,6 @@ struct dm_snapshot { | |||
79 | /* Origin writes don't trigger exceptions until this is set */ | 79 | /* Origin writes don't trigger exceptions until this is set */ |
80 | int active; | 80 | int active; |
81 | 81 | ||
82 | /* Whether or not owning mapped_device is suspended */ | ||
83 | int suspended; | ||
84 | |||
85 | atomic_t pending_exceptions_count; | 82 | atomic_t pending_exceptions_count; |
86 | 83 | ||
87 | mempool_t *pending_pool; | 84 | mempool_t *pending_pool; |
@@ -1102,7 +1099,6 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
1102 | s->ti = ti; | 1099 | s->ti = ti; |
1103 | s->valid = 1; | 1100 | s->valid = 1; |
1104 | s->active = 0; | 1101 | s->active = 0; |
1105 | s->suspended = 0; | ||
1106 | atomic_set(&s->pending_exceptions_count, 0); | 1102 | atomic_set(&s->pending_exceptions_count, 0); |
1107 | init_rwsem(&s->lock); | 1103 | init_rwsem(&s->lock); |
1108 | INIT_LIST_HEAD(&s->list); | 1104 | INIT_LIST_HEAD(&s->list); |
@@ -1733,15 +1729,6 @@ static void snapshot_merge_presuspend(struct dm_target *ti) | |||
1733 | stop_merge(s); | 1729 | stop_merge(s); |
1734 | } | 1730 | } |
1735 | 1731 | ||
1736 | static void snapshot_postsuspend(struct dm_target *ti) | ||
1737 | { | ||
1738 | struct dm_snapshot *s = ti->private; | ||
1739 | |||
1740 | down_write(&s->lock); | ||
1741 | s->suspended = 1; | ||
1742 | up_write(&s->lock); | ||
1743 | } | ||
1744 | |||
1745 | static int snapshot_preresume(struct dm_target *ti) | 1732 | static int snapshot_preresume(struct dm_target *ti) |
1746 | { | 1733 | { |
1747 | int r = 0; | 1734 | int r = 0; |
@@ -1756,7 +1743,7 @@ static int snapshot_preresume(struct dm_target *ti) | |||
1756 | DMERR("Unable to resume snapshot source until " | 1743 | DMERR("Unable to resume snapshot source until " |
1757 | "handover completes."); | 1744 | "handover completes."); |
1758 | r = -EINVAL; | 1745 | r = -EINVAL; |
1759 | } else if (!snap_src->suspended) { | 1746 | } else if (!dm_suspended(snap_src->ti)) { |
1760 | DMERR("Unable to perform snapshot handover until " | 1747 | DMERR("Unable to perform snapshot handover until " |
1761 | "source is suspended."); | 1748 | "source is suspended."); |
1762 | r = -EINVAL; | 1749 | r = -EINVAL; |
@@ -1789,7 +1776,6 @@ static void snapshot_resume(struct dm_target *ti) | |||
1789 | 1776 | ||
1790 | down_write(&s->lock); | 1777 | down_write(&s->lock); |
1791 | s->active = 1; | 1778 | s->active = 1; |
1792 | s->suspended = 0; | ||
1793 | up_write(&s->lock); | 1779 | up_write(&s->lock); |
1794 | } | 1780 | } |
1795 | 1781 | ||
@@ -2167,7 +2153,7 @@ static int origin_iterate_devices(struct dm_target *ti, | |||
2167 | 2153 | ||
2168 | static struct target_type origin_target = { | 2154 | static struct target_type origin_target = { |
2169 | .name = "snapshot-origin", | 2155 | .name = "snapshot-origin", |
2170 | .version = {1, 7, 0}, | 2156 | .version = {1, 7, 1}, |
2171 | .module = THIS_MODULE, | 2157 | .module = THIS_MODULE, |
2172 | .ctr = origin_ctr, | 2158 | .ctr = origin_ctr, |
2173 | .dtr = origin_dtr, | 2159 | .dtr = origin_dtr, |
@@ -2180,13 +2166,12 @@ static struct target_type origin_target = { | |||
2180 | 2166 | ||
2181 | static struct target_type snapshot_target = { | 2167 | static struct target_type snapshot_target = { |
2182 | .name = "snapshot", | 2168 | .name = "snapshot", |
2183 | .version = {1, 9, 0}, | 2169 | .version = {1, 10, 0}, |
2184 | .module = THIS_MODULE, | 2170 | .module = THIS_MODULE, |
2185 | .ctr = snapshot_ctr, | 2171 | .ctr = snapshot_ctr, |
2186 | .dtr = snapshot_dtr, | 2172 | .dtr = snapshot_dtr, |
2187 | .map = snapshot_map, | 2173 | .map = snapshot_map, |
2188 | .end_io = snapshot_end_io, | 2174 | .end_io = snapshot_end_io, |
2189 | .postsuspend = snapshot_postsuspend, | ||
2190 | .preresume = snapshot_preresume, | 2175 | .preresume = snapshot_preresume, |
2191 | .resume = snapshot_resume, | 2176 | .resume = snapshot_resume, |
2192 | .status = snapshot_status, | 2177 | .status = snapshot_status, |
@@ -2195,14 +2180,13 @@ static struct target_type snapshot_target = { | |||
2195 | 2180 | ||
2196 | static struct target_type merge_target = { | 2181 | static struct target_type merge_target = { |
2197 | .name = dm_snapshot_merge_target_name, | 2182 | .name = dm_snapshot_merge_target_name, |
2198 | .version = {1, 0, 0}, | 2183 | .version = {1, 1, 0}, |
2199 | .module = THIS_MODULE, | 2184 | .module = THIS_MODULE, |
2200 | .ctr = snapshot_ctr, | 2185 | .ctr = snapshot_ctr, |
2201 | .dtr = snapshot_dtr, | 2186 | .dtr = snapshot_dtr, |
2202 | .map = snapshot_merge_map, | 2187 | .map = snapshot_merge_map, |
2203 | .end_io = snapshot_end_io, | 2188 | .end_io = snapshot_end_io, |
2204 | .presuspend = snapshot_merge_presuspend, | 2189 | .presuspend = snapshot_merge_presuspend, |
2205 | .postsuspend = snapshot_postsuspend, | ||
2206 | .preresume = snapshot_preresume, | 2190 | .preresume = snapshot_preresume, |
2207 | .resume = snapshot_merge_resume, | 2191 | .resume = snapshot_merge_resume, |
2208 | .status = snapshot_status, | 2192 | .status = snapshot_status, |