ia64/xen-unstable

changeset 6373:5f39234a9ac4

g/c vbd active.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Aug 23 18:09:54 2005 +0000 (2005-08-23)
parents 9dc059239e2a
children df11e0709383
files linux-2.6-xen-sparse/drivers/xen/blkback/common.h linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Tue Aug 23 17:51:57 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Tue Aug 23 18:09:54 2005 +0000
     1.3 @@ -35,8 +35,6 @@ struct vbd {
     1.4      unsigned char  type;        /* VDISK_xxx */
     1.5      blkif_pdev_t   pdevice;     /* phys device that this vbd maps to */
     1.6      struct block_device *bdev;
     1.7 -
     1.8 -    int active;
     1.9  }; 
    1.10  
    1.11  typedef struct blkif_st {
    1.12 @@ -83,11 +81,9 @@ int blkif_map(blkif_t *blkif, unsigned l
    1.13              free_blkif_callback(_b);		  \
    1.14      } while (0)
    1.15  
    1.16 -/* Creates inactive vbd. */
    1.17 +/* Create a vbd. */
    1.18  int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, blkif_pdev_t pdevice,
    1.19  	       int readonly);
    1.20 -int vbd_is_active(struct vbd *vbd);
    1.21 -void vbd_activate(struct vbd *vbd);
    1.22  void vbd_free(struct vbd *vbd);
    1.23  
    1.24  unsigned long vbd_size(struct vbd *vbd);
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Tue Aug 23 17:51:57 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Tue Aug 23 18:09:54 2005 +0000
     2.3 @@ -116,8 +116,7 @@ static void free_blkif(void *arg)
     2.4      op.u.close.dom = blkif->domid;
     2.5      HYPERVISOR_event_channel_op(&op);
     2.6  
     2.7 -    if (vbd_is_active(&blkif->vbd))
     2.8 -	vbd_free(&blkif->vbd);
     2.9 +    vbd_free(&blkif->vbd);
    2.10  
    2.11      if (blkif->evtchn)
    2.12          unbind_evtchn_from_irqhandler(blkif->evtchn, blkif);
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c	Tue Aug 23 17:51:57 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c	Tue Aug 23 18:09:54 2005 +0000
     3.3 @@ -32,11 +32,6 @@ unsigned long vbd_secsize(struct vbd *vb
     3.4  	return bdev_hardsect_size(vbd->bdev);
     3.5  }
     3.6  
     3.7 -int vbd_is_active(struct vbd *vbd)
     3.8 -{
     3.9 -	return vbd->active;
    3.10 -}
    3.11 -
    3.12  int vbd_create(blkif_t *blkif, blkif_vdev_t handle,
    3.13  	       blkif_pdev_t pdevice, int readonly)
    3.14  {
    3.15 @@ -46,7 +41,6 @@ int vbd_create(blkif_t *blkif, blkif_vde
    3.16      vbd->handle   = handle; 
    3.17      vbd->readonly = readonly;
    3.18      vbd->type     = 0;
    3.19 -    vbd->active   = 0;
    3.20  
    3.21      vbd->pdevice  = pdevice;
    3.22  
    3.23 @@ -62,7 +56,7 @@ int vbd_create(blkif_t *blkif, blkif_vde
    3.24      if ( (vbd->bdev->bd_disk == NULL) )
    3.25      {
    3.26          DPRINTK("vbd_creat: device %08x doesn't exist.\n", vbd->pdevice);
    3.27 -        bdev_put(vbd->bdev);
    3.28 +	vbd_free(vbd);
    3.29          return -ENOENT;
    3.30      }
    3.31  
    3.32 @@ -76,19 +70,11 @@ int vbd_create(blkif_t *blkif, blkif_vde
    3.33      return 0;
    3.34  }
    3.35  
    3.36 -void vbd_activate(struct vbd *vbd)
    3.37 -{
    3.38 -    BUG_ON(vbd_is_active(vbd));
    3.39 -
    3.40 -    /* Now we're active. */
    3.41 -    vbd->active = 1;
    3.42 -}
    3.43 -
    3.44  void vbd_free(struct vbd *vbd)
    3.45  {
    3.46 -    if (vbd_is_active(vbd))
    3.47 -	vbd->active = 0;
    3.48 -    bdev_put(vbd->bdev);
    3.49 +    if (vbd->bdev)
    3.50 +	bdev_put(vbd->bdev);
    3.51 +    vbd->bdev = NULL;
    3.52  }
    3.53  
    3.54  int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation)
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Tue Aug 23 17:51:57 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Tue Aug 23 18:09:54 2005 +0000
     4.3 @@ -69,7 +69,7 @@ static void frontend_changed(struct xenb
     4.4  		device_unregister(&be->dev->dev);
     4.5  		return;
     4.6  	}
     4.7 -	if (vbd_is_active(&be->blkif->vbd))
     4.8 +	if (be->blkif->status == CONNECTED)
     4.9  		return;
    4.10  
    4.11  	err = xenbus_gather(be->frontpath, "grant-id", "%lu", &sharedmfn,
    4.12 @@ -82,9 +82,8 @@ static void frontend_changed(struct xenb
    4.13  	}
    4.14  
    4.15  	/* Domains must use same shared frame for all vbds. */
    4.16 -	if (be->blkif->status == CONNECTED &&
    4.17 -	    (evtchn != be->blkif->remote_evtchn ||
    4.18 -	     sharedmfn != be->blkif->shmem_frame)) {
    4.19 +	if (evtchn != be->blkif->remote_evtchn ||
    4.20 +	    sharedmfn != be->blkif->shmem_frame) {
    4.21  		xenbus_dev_error(be->dev, err,
    4.22  				 "Shared frame/evtchn %li/%u not same as"
    4.23  				 " old %li/%u",
    4.24 @@ -125,20 +124,15 @@ static void frontend_changed(struct xenb
    4.25  		goto abort;
    4.26  	}
    4.27  
    4.28 -	/* First vbd?  We need to map the shared frame, irq etc. */
    4.29 -	if (be->blkif->status != CONNECTED) {
    4.30 -		err = blkif_map(be->blkif, sharedmfn, evtchn);
    4.31 -		if (err) {
    4.32 -			xenbus_dev_error(be->dev, err,
    4.33 -					 "mapping shared-frame %lu port %u",
    4.34 -					 sharedmfn, evtchn);
    4.35 -			goto abort;
    4.36 -		}
    4.37 +	/* Map the shared frame, irq etc. */
    4.38 +	err = blkif_map(be->blkif, sharedmfn, evtchn);
    4.39 +	if (err) {
    4.40 +		xenbus_dev_error(be->dev, err,
    4.41 +				 "mapping shared-frame %lu port %u",
    4.42 +				 sharedmfn, evtchn);
    4.43 +		goto abort;
    4.44  	}
    4.45  
    4.46 -	/* We're ready, activate. */
    4.47 -	vbd_activate(&be->blkif->vbd);
    4.48 -
    4.49  	xenbus_transaction_end(0);
    4.50  	xenbus_dev_ok(be->dev);
    4.51