dm table: add always writeable feature

Add a target feature flag DM_TARGET_ALWAYS_WRITEABLE to indicate that a target
does not support read-only mode.

The initial implementation of the thin provisioning target uses this.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
Alasdair G Kergon
2011-10-31 20:19:02 +00:00
parent 3791e2fc0e
commit cc6cbe141a
2 changed files with 13 additions and 0 deletions

View File

@@ -774,6 +774,12 @@ int dm_table_add_target(struct dm_table *t, const char *type,
t->singleton = 1;
}
if (dm_target_always_writeable(tgt->type) && !(t->mode & FMODE_WRITE)) {
DMERR("%s: target type %s may not be included in read-only tables",
dm_device_name(t->md), type);
return -EINVAL;
}
tgt->table = t;
tgt->begin = start;
tgt->len = len;