@@ -2140,8 +2140,9 @@ static int parse_origin_dev(struct cache_args *ca, struct dm_arg_set *as,
if (!at_least_one_arg(as, error))
return -EINVAL;
- r = dm_get_device(ca->ti, dm_shift_arg(as), FMODE_READ | FMODE_WRITE,
- &ca->origin_dev);
+ r = dm_get_device_ex(ca->ti, dm_shift_arg(as), FMODE_READ | FMODE_WRITE,
+ dm_table_is_interposer(ca->ti->table),
+ &ca->origin_dev);
if (r) {
*error = "Error opening origin device";
return r;
@@ -153,7 +153,8 @@ static int delay_class_ctr(struct dm_target *ti, struct delay_class *c, char **a
return -EINVAL;
}
- ret = dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &c->dev);
+ ret = dm_get_device_ex(ti, argv[0], dm_table_get_mode(ti->table),
+ dm_table_is_interposer(ti->table), &c->dev);
if (ret) {
ti->error = "Device lookup failed";
return ret;
@@ -366,7 +366,8 @@ static int dust_ctr(struct dm_target *ti, unsigned int argc, char **argv)
return -ENOMEM;
}
- if (dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &dd->dev)) {
+ if (dm_get_device_ex(ti, argv[0], dm_table_get_mode(ti->table),
+ dm_table_is_interposer(ti->table), &dd->dev)) {
ti->error = "Device lookup failed";
kfree(dd);
return -EINVAL;
@@ -1462,7 +1462,9 @@ static int era_ctr(struct dm_target *ti, unsigned argc, char **argv)
return -EINVAL;
}
- r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &era->origin_dev);
+ r = dm_get_device_ex(ti, argv[1], FMODE_READ | FMODE_WRITE,
+ dm_table_is_interposer(ti->table),
+ &era->origin_dev);
if (r) {
ti->error = "Error opening data device";
era_destroy(era);
@@ -243,7 +243,8 @@ static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
if (r)
goto bad;
- r = dm_get_device(ti, devname, dm_table_get_mode(ti->table), &fc->dev);
+ r = dm_get_device_ex(ti, devname, dm_table_get_mode(ti->table),
+ dm_table_is_interposer(ti->table), &fc->dev);
if (r) {
ti->error = "Device lookup failed";
goto bad;
@@ -51,7 +51,8 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv)
}
lc->start = tmp;
- ret = dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &lc->dev);
+ ret = dm_get_device_ex(ti, argv[0], dm_table_get_mode(ti->table),
+ dm_table_is_interposer(ti->table), &lc->dev);
if (ret) {
ti->error = "Device lookup failed";
goto bad;
@@ -554,7 +554,8 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv)
atomic_set(&lc->pending_blocks, 0);
devname = dm_shift_arg(&as);
- ret = dm_get_device(ti, devname, dm_table_get_mode(ti->table), &lc->dev);
+ ret = dm_get_device_ex(ti, devname, dm_table_get_mode(ti->table),
+ dm_table_is_interposer(ti->table), &lc->dev);
if (ret) {
ti->error = "Device lookup failed";
goto bad;
@@ -2646,7 +2646,8 @@ static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto bad_alloc;
}
- r = dm_get_device(ti, argv[0], dm_table_get_mode(ti->table), &o->dev);
+ r = dm_get_device_ex(ti, argv[0], dm_table_get_mode(ti->table),
+ dm_table_is_interposer(ti->table), &o->dev);
if (r) {
ti->error = "Cannot get target device";
goto bad_open;
@@ -2169,7 +2169,8 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
string = dm_shift_arg(&as);
if (!string)
goto bad_arguments;
- r = dm_get_device(ti, string, dm_table_get_mode(ti->table), &wc->dev);
+ r = dm_get_device_ex(ti, string, dm_table_get_mode(ti->table),
+ dm_table_is_interposer(ti->table), &wc->dev);
if (r) {
ti->error = "Origin data device lookup failed";
goto bad;
Not every DM target needs the ability to attach via blk_interposer. A DM target can attach and detach 'on the fly' only if the DM target works as a filter without changing the location of the blocks on the block device. Signed-off-by: Sergei Shtepa <sergei.shtepa@veeam.com> --- drivers/md/dm-cache-target.c | 5 +++-- drivers/md/dm-delay.c | 3 ++- drivers/md/dm-dust.c | 3 ++- drivers/md/dm-era-target.c | 4 +++- drivers/md/dm-flakey.c | 3 ++- drivers/md/dm-linear.c | 3 ++- drivers/md/dm-log-writes.c | 3 ++- drivers/md/dm-snap.c | 3 ++- drivers/md/dm-writecache.c | 3 ++- 9 files changed, 20 insertions(+), 10 deletions(-)