From: cl349@firebug.cl.cam.ac.uk Date: Tue, 23 Aug 2005 18:09:54 +0000 (+0000) Subject: g/c vbd active. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16871^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c09b5c91c244a790240548c4fd7a0dff5bc8649c;p=xen.git g/c vbd active. Signed-off-by: Christian Limpach --- diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h index 4af91f8aa6..784fd9a020 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h @@ -35,8 +35,6 @@ struct vbd { 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 @@ int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn); 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 --git a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c index 3f5eda76b3..014e9ea34c 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c @@ -116,8 +116,7 @@ static void free_blkif(void *arg) 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 --git a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c index a8df6b9558..f3b73cdec0 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c @@ -32,11 +32,6 @@ unsigned long vbd_secsize(struct vbd *vbd) 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 @@ int vbd_create(blkif_t *blkif, blkif_vdev_t handle, vbd->handle = handle; vbd->readonly = readonly; vbd->type = 0; - vbd->active = 0; vbd->pdevice = pdevice; @@ -62,7 +56,7 @@ int vbd_create(blkif_t *blkif, blkif_vdev_t handle, 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 @@ int vbd_create(blkif_t *blkif, blkif_vdev_t handle, 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 --git a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c index 1ff4d29009..3163ee5666 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c @@ -69,7 +69,7 @@ static void frontend_changed(struct xenbus_watch *watch, const char *node) 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 @@ static void frontend_changed(struct xenbus_watch *watch, const char *node) } /* 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,20 +124,15 @@ static void frontend_changed(struct xenbus_watch *watch, const char *node) 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; - } + /* 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; } - /* We're ready, activate. */ - vbd_activate(&be->blkif->vbd); - xenbus_transaction_end(0); xenbus_dev_ok(be->dev);