WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add support for multiple devices when using grant tables

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add support for multiple devices when using grant tables.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Aug 2005 08:22:12 -0400
Delivery-date: Fri, 19 Aug 2005 12:22:46 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID f22bbccf64ff3ebe781b96e2bad11c06583a10fb
# Parent  7570087c2552e221af20c27e4a9e143636dce236
Add support for multiple devices when using grant tables.
Also better support non-transactional store updates.
Also remove some extra printks.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 7570087c2552 -r f22bbccf64ff 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Aug 19 
10:46:21 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Aug 19 
10:47:48 2005
@@ -84,6 +84,7 @@
 #define MAXIMUM_OUTSTANDING_BLOCK_REQS \
     (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLKIF_RING_SIZE)
 #define GRANTREF_INVALID (1<<15)
+static int shmem_ref;
 #endif
 
 static struct blk_shadow {
@@ -1168,6 +1169,16 @@
        SHARED_RING_INIT(sring);
        FRONT_RING_INIT(&blk_ring, sring, PAGE_SIZE);
 
+#ifdef CONFIG_XEN_BLKDEV_GRANT
+       shmem_ref = gnttab_claim_grant_reference(&gref_head,
+                                                gref_terminal);
+       ASSERT(shmem_ref != -ENOSPC);
+       gnttab_grant_foreign_access_ref(shmem_ref,
+                                       backend_id,
+                                       virt_to_machine(blk_ring.sring)
+                                       >> PAGE_SHIFT, 0);
+#endif
+
        op.u.alloc_unbound.dom = backend_id;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
@@ -1191,14 +1202,22 @@
        backend = xenbus_read(dev->nodename, "backend", NULL);
        if (IS_ERR(backend)) {
                err = PTR_ERR(backend);
+               if (err == -ENOENT)
+                       goto out;
                xenbus_dev_error(dev, err, "reading %s/backend",
                                 dev->nodename);
                goto out;
        }
+       if (strlen(backend) == 0) {
+               err = -ENOENT;
+               goto free_backend;
+       }
 
        /* FIXME: This driver can't handle backends on different
         * domains.  Check and fail gracefully. */
        err = xenbus_scanf(dev->nodename, "backend-id", "%i", &backend_id);
+       if (err == -ENOENT)
+               goto free_backend;
        if (err < 0) {
                xenbus_dev_error(dev, err, "reading %s/backend-id",
                                 dev->nodename);
@@ -1219,20 +1238,10 @@
        }
 
 #ifdef CONFIG_XEN_BLKDEV_GRANT
-       {
-               int shmem_ref;
-               shmem_ref = gnttab_claim_grant_reference(&gref_head,
-                                                        gref_terminal);
-               ASSERT(shmem_ref != -ENOSPC);
-               gnttab_grant_foreign_access_ref(shmem_ref,
-                                               backend_id,
-                                               virt_to_machine(blk_ring.sring)
-                                               >> PAGE_SHIFT, 0);
-               err = xenbus_printf(dev->nodename, "grant-id","%u", shmem_ref);
-               if (err) {
-                       message = "writing grant-id";
-                       goto abort_transaction;
-               }
+       err = xenbus_printf(dev->nodename, "grant-id","%u", shmem_ref);
+       if (err) {
+               message = "writing grant-id";
+               goto abort_transaction;
        }
 #else
        err = xenbus_printf(dev->nodename, "shared-frame", "%lu",
@@ -1292,6 +1301,8 @@
 
        /* FIXME: Use dynamic device id if this is not set. */
        err = xenbus_scanf(dev->nodename, "virtual-device", "%i", &vdevice);
+       if (err == -ENOENT)
+               return err;
        if (err < 0) {
                xenbus_dev_error(dev, err, "reading virtual-device");
                return err;
@@ -1325,7 +1336,6 @@
 {
        struct blkfront_info *info = dev->data;
 
-       printk("blkfront_remove %s\n", dev->dev.bus_id);
        if (info->backend)
                unregister_xenbus_watch(&info->watch);
 
@@ -1339,7 +1349,6 @@
        if (--blkif_vbds == 0)
                blkif_free();
 
-       printk("blkfront_remove done\n");
        return 0;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add support for multiple devices when using grant tables., Xen patchbot -unstable <=