]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Add a target feature flag to indicate that a target does not work in
authorAlasdair G Kergon <agk@redhat.com>
Tue, 9 Aug 2011 23:13:34 +0000 (09:13 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 9 Aug 2011 23:17:57 +0000 (09:17 +1000)
read-only mode.

The thin provisioning target uses this.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-table.c
include/linux/device-mapper.h

index dd1f60972d3108f6beaaaded55c32a17d1feb35c..1594562d59167ebd7a4943522da53b152e8d7194 100644 (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;
index 294e78a7fccdded7c176988fe89daa807e277423..e46e91080f8608f1d5c09eeee186028899c8c570 100644 (file)
@@ -166,6 +166,10 @@ struct target_type {
 #define DM_TARGET_SINGLETON            0x00000001
 #define dm_target_needs_singleton(type)        ((type)->features & DM_TARGET_SINGLETON)
 
+#define DM_TARGET_ALWAYS_WRITEABLE     0x00000002
+#define dm_target_always_writeable(type) \
+               ((type)->features & DM_TARGET_ALWAYS_WRITEABLE)
+
 struct dm_target {
        struct dm_table *table;
        struct target_type *type;