diff options
author | Alasdair G Kergon <agk@redhat.com> | 2011-10-31 20:19:04 +0000 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2011-10-31 20:19:04 +0000 |
commit | 36a0456fbf2d9680bf9af81b39daf4a8e22cb1b8 (patch) | |
tree | a19af18640d538e8357c195e6b4c77d0f6c92391 /drivers/md/dm.c | |
parent | cc6cbe141a20f6d876b161b60af38d93935bfa85 (diff) | |
download | lwn-36a0456fbf2d9680bf9af81b39daf4a8e22cb1b8.tar.gz lwn-36a0456fbf2d9680bf9af81b39daf4a8e22cb1b8.zip |
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.c | 9 |
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 { /* Protect queue and type against concurrent access. */ struct mutex type_lock; + struct target_type *immutable_target_type; + struct gendisk *disk; char name[16]; @@ -2096,6 +2098,8 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t, write_lock_irqsave(&md->map_lock, flags); old_map = md->map; md->map = t; + md->immutable_target_type = dm_table_get_immutable_target_type(t); + dm_table_set_restrictions(t, q, limits); if (merge_is_optional) set_bit(DMF_MERGE_IS_OPTIONAL, &md->flags); @@ -2166,6 +2170,11 @@ unsigned dm_get_md_type(struct mapped_device *md) return md->type; } +struct target_type *dm_get_immutable_target_type(struct mapped_device *md) +{ + return md->immutable_target_type; +} + /* * Fully initialize a request-based queue (->elevator, ->request_fn, etc). */ |