Skip to contentSkip to conversation

linux-2.6.18/block backends: adjust protocol negotiation

PATCH New Jan Beulich 1 participant 1 message Mar 26, 2012 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.6.18/block backends: adjust protocol negotiation

The changes in c/s 1168:8940ccd0a425 resulted in the native not getting selected anymore, resulting in more involved copying of individual requests. Adjust the negotiation code so that it'll pick the native one again if the frontend matches.

The initialization code can be considerably shrunk by using a macro to abstract out the code common for all variants.

drivers/xen/blkback/xenbus.c +4 -0
@@ -497,10 +497,14 @@ static int connect_ring(struct backend_i
 	protocol = xenbus_read(XBT_NIL, dev->otherend, "protocol", NULL);
 	if (IS_ERR(protocol))
 		protocol = NULL;
+#ifndef CONFIG_X86_32
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_32;
+#endif
+#ifndef CONFIG_X86_64
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_64;
+#endif
 	else if (0 != strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) {
 		xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
 		kfree(protocol);
drivers/xen/blktap/xenbus.c +4 -0
@@ -450,10 +450,14 @@ static int connect_ring(struct backend_i
 	protocol = xenbus_read(XBT_NIL, dev->otherend, "protocol", NULL);
 	if (IS_ERR(protocol))
 		protocol = NULL;
+#ifndef CONFIG_X86_32
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_32;
+#endif
+#ifndef CONFIG_X86_64
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_64;
+#endif
 	else if (0 != strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) {
 		xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
 		kfree(protocol);

block backends: adjust protocol negotiation

The changes in c/s 1168:8940ccd0a425 resulted in the native not getting selected anymore, resulting in more involved copying of individual requests. Adjust the negotiation code so that it'll pick the native one again if the frontend matches.

The initialization code can be considerably shrunk by using a macro to abstract out the code common for all variants.

drivers/xen/blkback/xenbus.c +4 -0
@@ -497,10 +497,14 @@ static int connect_ring(struct backend_i
 	protocol = xenbus_read(XBT_NIL, dev->otherend, "protocol", NULL);
 	if (IS_ERR(protocol))
 		protocol = NULL;
+#ifndef CONFIG_X86_32
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_32;
+#endif
+#ifndef CONFIG_X86_64
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_64;
+#endif
 	else if (0 != strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) {
 		xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
 		kfree(protocol);
drivers/xen/blktap/xenbus.c +4 -0
@@ -450,10 +450,14 @@ static int connect_ring(struct backend_i
 	protocol = xenbus_read(XBT_NIL, dev->otherend, "protocol", NULL);
 	if (IS_ERR(protocol))
 		protocol = NULL;
+#ifndef CONFIG_X86_32
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_32))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_32;
+#endif
+#ifndef CONFIG_X86_64
 	else if (0 == strcmp(protocol, XEN_IO_PROTO_ABI_X86_64))
 		be->blkif->blk_protocol = BLKIF_PROTOCOL_X86_64;
+#endif
 	else if (0 != strcmp(protocol, XEN_IO_PROTO_ABI_NATIVE)) {
 		xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
 		kfree(protocol);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel