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>
This commit is contained in:
parent
cc6cbe141a
commit
36a0456fbf
6 changed files with 52 additions and 2 deletions
|
@ -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).
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue