aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2011-10-31 16:19:04 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-10-31 16:19:04 -0400
commit36a0456fbf2d9680bf9af81b39daf4a8e22cb1b8 (patch)
treea19af18640d538e8357c195e6b4c77d0f6c92391 /drivers/md/dm.c
parentcc6cbe141a20f6d876b161b60af38d93935bfa85 (diff)
dm table: add immutable feature
Introduce DM_TARGET_IMMUTABLE to indicate that the target type cannot be mixed with any other target type, and once loaded into a device, it cannot be replaced with a table containing a different type. The thin provisioning pool device will use this. Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 2fe3017ba97c..9836324e2118 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -140,6 +140,8 @@ struct mapped_device {
140 /* Protect queue and type against concurrent access. */ 140 /* Protect queue and type against concurrent access. */
141 struct mutex type_lock; 141 struct mutex type_lock;
142 142
143 struct target_type *immutable_target_type;
144
143 struct gendisk *disk; 145 struct gendisk *disk;
144 char name[16]; 146 char name[16];
145 147
@@ -2096,6 +2098,8 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t,
2096 write_lock_irqsave(&md->map_lock, flags); 2098 write_lock_irqsave(&md->map_lock, flags);
2097 old_map = md->map; 2099 old_map = md->map;
2098 md->map = t; 2100 md->map = t;
2101 md->immutable_target_type = dm_table_get_immutable_target_type(t);
2102
2099 dm_table_set_restrictions(t, q, limits); 2103 dm_table_set_restrictions(t, q, limits);
2100 if (merge_is_optional) 2104 if (merge_is_optional)
2101 set_bit(DMF_MERGE_IS_OPTIONAL, &md->flags); 2105 set_bit(DMF_MERGE_IS_OPTIONAL, &md->flags);
@@ -2166,6 +2170,11 @@ unsigned dm_get_md_type(struct mapped_device *md)
2166 return md->type; 2170 return md->type;
2167} 2171}
2168 2172
2173struct target_type *dm_get_immutable_target_type(struct mapped_device *md)
2174{
2175 return md->immutable_target_type;
2176}
2177
2169/* 2178/*
2170 * Fully initialize a request-based queue (->elevator, ->request_fn, etc). 2179 * Fully initialize a request-based queue (->elevator, ->request_fn, etc).
2171 */ 2180 */