[Q] dm: Can singleton rq-based target refer to a device?

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

 



Hi, Mike, Alasdair, all,

I have out-of-tree rq-based driver. It uses dm_get_device() to acquire underlining device.
My goal is to register it as just DM_TARGET_SINGLETON without DM_TARGET_IMMUTABLE flag,
since I need a possibility to reload it with another target.

There is a check in dm_table_determine_type(), which prevents that. It's not obvious,
what the reasons of this limitation are. Could you please explain, why this is required?
Can we make the check weaker like in the patch below?

Thanks,
Kirill

---
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 0543cdf89e92..81fd45142e42 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -936,30 +936,27 @@ static int dm_table_determine_type(struct dm_table *t)
 
 	if (list_empty(devices)) {
 		int srcu_idx;
 		struct dm_table *live_table = dm_get_live_table(t->md, &srcu_idx);
 
 		/* inherit live table's type */
 		if (live_table)
 			t->type = live_table->type;
 		dm_put_live_table(t->md, srcu_idx);
 		return 0;
 	}
 
-	tgt = dm_table_get_immutable_target(t);
-	if (!tgt) {
-		DMERR("table load rejected: immutable target is required");
-		return -EINVAL;
-	} else if (tgt->max_io_len) {
-		DMERR("table load rejected: immutable target that splits IO is not supported");
+	tgt = &t->targets[0];
+	if (tgt->max_io_len) {
+		DMERR("table load rejected: singleton target that splits IO is not supported");
 		return -EINVAL;
 	}
 
 	/* Non-request-stackable devices can't be used for request-based dm */
 	if (!tgt->type->iterate_devices ||
 	    !tgt->type->iterate_devices(tgt, device_is_rq_stackable, NULL)) {
 		DMERR("table load rejected: including non-request-stackable devices");
 		return -EINVAL;
 	}
 
 	return 0;
 }

--
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