ia64/xen-unstable

changeset 7186:6fda96e7f332

Added some DPRINTK statements, for debugging.
author emellor@ewan
date Tue Oct 04 11:27:37 2005 +0100 (2005-10-04)
parents d79ab87e27b8 96cc6aa196b6
children 488f8aaa4022 b27d526d4033
files linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Mon Oct 03 16:40:27 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Tue Oct 04 11:27:37 2005 +0100
     1.3 @@ -63,13 +63,23 @@ static void frontend_changed(struct xenb
     1.4  	struct backend_info *be
     1.5  		= container_of(watch, struct backend_info, watch);
     1.6  
     1.7 +	DPRINTK("frontend_changed: %s.\n", be->frontpath);
     1.8 +
     1.9  	/* If other end is gone, delete ourself. */
    1.10  	if (node && !xenbus_exists(be->frontpath, "")) {
    1.11 +		DPRINTK("Frontend has disappeared; unregistering device.\n");
    1.12  		device_unregister(&be->dev->dev);
    1.13  		return;
    1.14  	}
    1.15 -	if (be->blkif == NULL || be->blkif->status == CONNECTED)
    1.16 +	if (be->blkif == NULL) {
    1.17 +		DPRINTK("blkif is null; doing nothing.\n");
    1.18  		return;
    1.19 +	}
    1.20 +
    1.21 +	if (be->blkif->status == CONNECTED) {
    1.22 +		DPRINTK("blkif is CONNECTED; doing nothing.\n");
    1.23 +		return;
    1.24 +	}
    1.25  
    1.26  	err = xenbus_gather(be->frontpath, "ring-ref", "%lu", &ring_ref,
    1.27  			    "event-channel", "%u", &evtchn, NULL);
    1.28 @@ -132,10 +142,11 @@ again:
    1.29  
    1.30  	xenbus_dev_ok(be->dev);
    1.31  
    1.32 +	DPRINTK("frontend_changed(%s) finished OK.\n", be->frontpath);
    1.33  	return;
    1.34 -
    1.35   abort:
    1.36  	xenbus_transaction_end(1);
    1.37 +	DPRINTK("frontend_changed(%s) aborted.\n", be->frontpath);
    1.38  }
    1.39  
    1.40  /* 
    1.41 @@ -152,9 +163,13 @@ static void backend_changed(struct xenbu
    1.42  		= container_of(watch, struct backend_info, backend_watch);
    1.43  	struct xenbus_device *dev = be->dev;
    1.44  
    1.45 +	DPRINTK("backend_changed: %s\n", watch->node);
    1.46 +
    1.47  	err = xenbus_scanf(dev->nodename, "physical-device", "%li", &pdev);
    1.48 -	if (XENBUS_EXIST_ERR(err))
    1.49 +	if (XENBUS_EXIST_ERR(err)) {
    1.50 +		DPRINTK("physical-device node exists; doing nothing.\n");
    1.51  		return;
    1.52 +	}
    1.53  	if (err < 0) {
    1.54  		xenbus_dev_error(dev, err, "reading physical-device");
    1.55  		return;
    1.56 @@ -174,6 +189,8 @@ static void backend_changed(struct xenbu
    1.57  	}
    1.58  
    1.59  	if (be->blkif == NULL) {
    1.60 +		DPRINTK("be->blkif is null; creating VBD.\n");
    1.61 +
    1.62  		/* Front end dir is a number, which is used as the handle. */
    1.63  		p = strrchr(be->frontpath, '/') + 1;
    1.64  		handle = simple_strtoul(p, NULL, 0);
    1.65 @@ -197,6 +214,11 @@ static void backend_changed(struct xenbu
    1.66  		/* Pass in NULL node to skip exist test. */
    1.67  		frontend_changed(&be->watch, NULL);
    1.68  	}
    1.69 +	else {
    1.70 +		DPRINTK("be->blkif is non-null; doing nothing.\n");
    1.71 +	}
    1.72 +
    1.73 +	DPRINTK("backend_changed(%s) finished OK.\n", watch->node);
    1.74  }
    1.75  
    1.76  static int blkback_probe(struct xenbus_device *dev,
    1.77 @@ -218,8 +240,10 @@ static int blkback_probe(struct xenbus_d
    1.78  			    "frontend-id", "%li", &be->frontend_id,
    1.79  			    "frontend", NULL, &frontend,
    1.80  			    NULL);
    1.81 -	if (XENBUS_EXIST_ERR(err))
    1.82 +	if (XENBUS_EXIST_ERR(err)) {
    1.83 +		DPRINTK("blkback_probe: %s does not exist", dev->nodename);
    1.84  		goto free_be;
    1.85 +	}
    1.86  	if (err < 0) {
    1.87  		xenbus_dev_error(dev, err,
    1.88  				 "reading %s/frontend or frontend-id",
    1.89 @@ -231,6 +255,8 @@ static int blkback_probe(struct xenbus_d
    1.90  		 * then our bus-id is no longer valid and we need to
    1.91  		 * destroy the backend device.
    1.92  		 */
    1.93 +		DPRINTK("blkback_probe: failed to get frontend path and ID; "
    1.94 +			"destroying backend device");
    1.95  		err = -ENOENT;
    1.96  		goto free_be;
    1.97  	}