diff options
author | Toshi Kani <toshi.kani@hpe.com> | 2016-06-28 15:37:15 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-07-20 23:49:52 -0400 |
commit | b5ab4a9ba5574430870391e93b125ada31217c4c (patch) | |
tree | 658d76b461e4d7d4e064068e82aa0550d61deb70 /drivers/md/dm-ioctl.c | |
parent | f6e629bd2379dceb547be93915314307871a7f6c (diff) |
dm: allow bio-based table to be upgraded to bio-based with DAX support
Allow table type DM_TYPE_BIO_BASED to extend with DM_TYPE_DAX_BIO_BASED
since DM_TYPE_DAX_BIO_BASED supports bio-based requests.
This is needed to allow a snapshot of an LV with DAX support to be
removed. One of the intermediate table reloads that lvm2 does switches
from DM_TYPE_BIO_BASED to DM_TYPE_DAX_BIO_BASED. No known reason to
disallow this so...
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r-- | drivers/md/dm-ioctl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 96df89a31f42..966eb4b61aed 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -1267,6 +1267,15 @@ static int populate_table(struct dm_table *table, | |||
1267 | return dm_table_complete(table); | 1267 | return dm_table_complete(table); |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | static bool is_valid_type(unsigned cur, unsigned new) | ||
1271 | { | ||
1272 | if (cur == new || | ||
1273 | (cur == DM_TYPE_BIO_BASED && new == DM_TYPE_DAX_BIO_BASED)) | ||
1274 | return true; | ||
1275 | |||
1276 | return false; | ||
1277 | } | ||
1278 | |||
1270 | static int table_load(struct dm_ioctl *param, size_t param_size) | 1279 | static int table_load(struct dm_ioctl *param, size_t param_size) |
1271 | { | 1280 | { |
1272 | int r; | 1281 | int r; |
@@ -1309,7 +1318,7 @@ static int table_load(struct dm_ioctl *param, size_t param_size) | |||
1309 | DMWARN("unable to set up device queue for new table."); | 1318 | DMWARN("unable to set up device queue for new table."); |
1310 | goto err_unlock_md_type; | 1319 | goto err_unlock_md_type; |
1311 | } | 1320 | } |
1312 | } else if (dm_get_md_type(md) != dm_table_get_type(t)) { | 1321 | } else if (!is_valid_type(dm_get_md_type(md), dm_table_get_type(t))) { |
1313 | DMWARN("can't change device type after initial table load."); | 1322 | DMWARN("can't change device type after initial table load."); |
1314 | r = -EINVAL; | 1323 | r = -EINVAL; |
1315 | goto err_unlock_md_type; | 1324 | goto err_unlock_md_type; |