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] g/c vbd active.

# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 5f39234a9ac433edfd4116fc973593b328edfb7e
# Parent  9dc059239e2a203c62ee2e30d113e6bc1cd019f6
g/c vbd active.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 9dc059239e2a -r 5f39234a9ac4 
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Tue Aug 23 17:51:57 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Tue Aug 23 18:09:54 2005
@@ -35,8 +35,6 @@
     unsigned char  type;        /* VDISK_xxx */
     blkif_pdev_t   pdevice;     /* phys device that this vbd maps to */
     struct block_device *bdev;
-
-    int active;
 }; 
 
 typedef struct blkif_st {
@@ -83,11 +81,9 @@
             free_blkif_callback(_b);             \
     } while (0)
 
-/* Creates inactive vbd. */
+/* Create a vbd. */
 int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, blkif_pdev_t pdevice,
               int readonly);
-int vbd_is_active(struct vbd *vbd);
-void vbd_activate(struct vbd *vbd);
 void vbd_free(struct vbd *vbd);
 
 unsigned long vbd_size(struct vbd *vbd);
diff -r 9dc059239e2a -r 5f39234a9ac4 
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Tue Aug 23 
17:51:57 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Tue Aug 23 
18:09:54 2005
@@ -116,8 +116,7 @@
     op.u.close.dom = blkif->domid;
     HYPERVISOR_event_channel_op(&op);
 
-    if (vbd_is_active(&blkif->vbd))
-       vbd_free(&blkif->vbd);
+    vbd_free(&blkif->vbd);
 
     if (blkif->evtchn)
         unbind_evtchn_from_irqhandler(blkif->evtchn, blkif);
diff -r 9dc059239e2a -r 5f39234a9ac4 
linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c    Tue Aug 23 17:51:57 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c    Tue Aug 23 18:09:54 2005
@@ -32,11 +32,6 @@
        return bdev_hardsect_size(vbd->bdev);
 }
 
-int vbd_is_active(struct vbd *vbd)
-{
-       return vbd->active;
-}
-
 int vbd_create(blkif_t *blkif, blkif_vdev_t handle,
               blkif_pdev_t pdevice, int readonly)
 {
@@ -46,7 +41,6 @@
     vbd->handle   = handle; 
     vbd->readonly = readonly;
     vbd->type     = 0;
-    vbd->active   = 0;
 
     vbd->pdevice  = pdevice;
 
@@ -62,7 +56,7 @@
     if ( (vbd->bdev->bd_disk == NULL) )
     {
         DPRINTK("vbd_creat: device %08x doesn't exist.\n", vbd->pdevice);
-        bdev_put(vbd->bdev);
+       vbd_free(vbd);
         return -ENOENT;
     }
 
@@ -76,19 +70,11 @@
     return 0;
 }
 
-void vbd_activate(struct vbd *vbd)
-{
-    BUG_ON(vbd_is_active(vbd));
-
-    /* Now we're active. */
-    vbd->active = 1;
-}
-
 void vbd_free(struct vbd *vbd)
 {
-    if (vbd_is_active(vbd))
-       vbd->active = 0;
-    bdev_put(vbd->bdev);
+    if (vbd->bdev)
+       bdev_put(vbd->bdev);
+    vbd->bdev = NULL;
 }
 
 int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation)
diff -r 9dc059239e2a -r 5f39234a9ac4 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Tue Aug 23 17:51:57 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Tue Aug 23 18:09:54 2005
@@ -69,7 +69,7 @@
                device_unregister(&be->dev->dev);
                return;
        }
-       if (vbd_is_active(&be->blkif->vbd))
+       if (be->blkif->status == CONNECTED)
                return;
 
        err = xenbus_gather(be->frontpath, "grant-id", "%lu", &sharedmfn,
@@ -82,9 +82,8 @@
        }
 
        /* Domains must use same shared frame for all vbds. */
-       if (be->blkif->status == CONNECTED &&
-           (evtchn != be->blkif->remote_evtchn ||
-            sharedmfn != be->blkif->shmem_frame)) {
+       if (evtchn != be->blkif->remote_evtchn ||
+           sharedmfn != be->blkif->shmem_frame) {
                xenbus_dev_error(be->dev, err,
                                 "Shared frame/evtchn %li/%u not same as"
                                 " old %li/%u",
@@ -125,19 +124,14 @@
                goto abort;
        }
 
-       /* First vbd?  We need to map the shared frame, irq etc. */
-       if (be->blkif->status != CONNECTED) {
-               err = blkif_map(be->blkif, sharedmfn, evtchn);
-               if (err) {
-                       xenbus_dev_error(be->dev, err,
-                                        "mapping shared-frame %lu port %u",
-                                        sharedmfn, evtchn);
-                       goto abort;
-               }
-       }
-
-       /* We're ready, activate. */
-       vbd_activate(&be->blkif->vbd);
+       /* Map the shared frame, irq etc. */
+       err = blkif_map(be->blkif, sharedmfn, evtchn);
+       if (err) {
+               xenbus_dev_error(be->dev, err,
+                                "mapping shared-frame %lu port %u",
+                                sharedmfn, evtchn);
+               goto abort;
+       }
 
        xenbus_transaction_end(0);
        xenbus_dev_ok(be->dev);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] g/c vbd active., Xen patchbot -unstable <=