[PATCH v9 4/4] Using dm_get_device_ex() instead of dm_get_device()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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(-)

diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 541c45027cc8..885a6fde1b9b 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -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;
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index 2628a832787b..1b051a023a5d 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -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;
diff --git a/drivers/md/dm-dust.c b/drivers/md/dm-dust.c
index cbe1058ee589..5eb930ea8034 100644
--- a/drivers/md/dm-dust.c
+++ b/drivers/md/dm-dust.c
@@ -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;
diff --git a/drivers/md/dm-era-target.c b/drivers/md/dm-era-target.c
index d9ac7372108c..db8791981605 100644
--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -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);
diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index b7fee9936f05..89bb77545757 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -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;
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
index 92db0f5e7f28..1301b11dd2af 100644
--- a/drivers/md/dm-linear.c
+++ b/drivers/md/dm-linear.c
@@ -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;
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c
index 57882654ffee..32a389ea4eb1 100644
--- a/drivers/md/dm-log-writes.c
+++ b/drivers/md/dm-log-writes.c
@@ -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;
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 11890db71f3f..eab96db253e1 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -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;
diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 4f72b6f66c3a..bb0801fe4c63 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -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;
-- 
2.20.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux