Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157083

[PATCH 2/3] driver: xen-blkfront: move talk_to_blkback to a more suitable place

Path csiph.com!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Bob Liu <bob.liu@oracle.com>
Newsgroups linux.kernel
Subject [PATCH 2/3] driver: xen-blkfront: move talk_to_blkback to a more suitable place
Date Wed, 03 Jun 2015 07:50:02 +0200
Message-ID <px9IS-8ch-9@gated-at.bofh.it> (permalink)
References <px9IS-8ch-11@gated-at.bofh.it>
X-Original-To xen-devel@lists.xen.org
X-Mailer git-send-email 1.7.10.4
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Source-IP aserv0022.oracle.com [141.146.126.234]
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 77
Organization linux.* mail to news gateway
X-Original-Cc david.vrabel@citrix.com, justing@spectralogic.com, konrad.wilk@oracle.com, roger.pau@citrix.com, paul.durrant@citrix.com, julien.grall@citrix.com, linux-kernel@vger.kernel.org, Bob Liu <bob.liu@oracle.com>
X-Original-Date Wed, 3 Jun 2015 13:40:02 +0800
X-Original-Message-ID <1433310003-13089-2-git-send-email-bob.liu@oracle.com>
X-Original-References <1433310003-13089-1-git-send-email-bob.liu@oracle.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1157083

Show key headers only | View raw


The major responsibility of talk_to_blkback() is allocate and initialize
the request ring and write the ring info to xenstore.
But this work should be done after backend entered 'XenbusStateInitWait' as
defined in the protocol file.
See xen/include/public/io/blkif.h in XEN git tree:
Front                                Back
=================================    =====================================
XenbusStateInitialising              XenbusStateInitialising
 o Query virtual device               o Query backend device identification
   properties.                          data.
 o Setup OS device instance.          o Open and validate backend device.
                                      o Publish backend features and
                                        transport parameters.
                                                     |
                                                     |
                                                     V
                                     XenbusStateInitWait

o Query backend features and
  transport parameters.
o Allocate and initialize the
  request ring.

There is no problem with this yet, but it is an violation of the design and
furthermore it would not allow frontend/backend to negotiate 'multi-page'
and 'multi-queue' features.

Changes in v2:
 - Re-write the commit message to be more clear.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 drivers/block/xen-blkfront.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 2c61cf8..88e23fd 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1430,13 +1430,6 @@ static int blkfront_probe(struct xenbus_device *dev,
 	info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
 	dev_set_drvdata(&dev->dev, info);
 
-	err = talk_to_blkback(dev, info);
-	if (err) {
-		kfree(info);
-		dev_set_drvdata(&dev->dev, NULL);
-		return err;
-	}
-
 	return 0;
 }
 
@@ -1906,8 +1899,13 @@ static void blkback_changed(struct xenbus_device *dev,
 	dev_dbg(&dev->dev, "blkfront:blkback_changed to state %d.\n", backend_state);
 
 	switch (backend_state) {
-	case XenbusStateInitialising:
 	case XenbusStateInitWait:
+		if (talk_to_blkback(dev, info)) {
+			kfree(info);
+			dev_set_drvdata(&dev->dev, NULL);
+			break;
+		}
+	case XenbusStateInitialising:
 	case XenbusStateInitialised:
 	case XenbusStateReconfiguring:
 	case XenbusStateReconfigured:
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 2/3] driver: xen-blkfront: move talk_to_blkback to a more suitable place Bob Liu <bob.liu@oracle.com> - 2015-06-03 07:50 +0200

csiph-web