dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [dm-devel] [Q] dm: Can singleton rq-based target refer to a device?
@ 2021-08-19 12:26 Kirill Tkhai
  0 siblings, 0 replies; only message in thread
From: Kirill Tkhai @ 2021-08-19 12:26 UTC (permalink / raw)
  To: Mike Snitzer, Alasdair Kergon, dm-devel, Kirill Tkhai

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@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-23  6:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 12:26 [dm-devel] [Q] dm: Can singleton rq-based target refer to a device? Kirill Tkhai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).