direct-io.hg

changeset 8473:399c68937d59

merge
author kaf24@firebug.cl.cam.ac.uk
date Tue Jan 03 14:36:56 2006 +0100 (2006-01-03)
parents 412995d28a07 9fedfb8cb1b2
children 9fc306e40a7c
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Tue Jan 03 14:35:45 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Tue Jan 03 14:36:56 2006 +0100
     1.3 @@ -540,6 +540,9 @@ static int __init blkif_init(void)
     1.4  	pending_vaddrs        = kmalloc(sizeof(pending_vaddrs[0]) *
     1.5  					mmap_pages, GFP_KERNEL);
     1.6  	if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) {
     1.7 +		kfree(pending_reqs);
     1.8 +		kfree(pending_grant_handles);
     1.9 +		kfree(pending_vaddrs);
    1.10  		printk("%s: out of memory\n", __FUNCTION__);
    1.11  		return -1;
    1.12  	}
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Tue Jan 03 14:35:45 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Tue Jan 03 14:36:56 2006 +0100
     2.3 @@ -225,7 +225,7 @@ static int blktap_open(struct inode *ino
     2.4  	/* Allocate the fe ring. */
     2.5  	sring = (blkif_sring_t *)get_zeroed_page(GFP_KERNEL);
     2.6  	if (sring == NULL)
     2.7 -		goto fail_nomem;
     2.8 +		return -ENOMEM;
     2.9  
    2.10  	SetPageReserved(virt_to_page(sring));
    2.11      
    2.12 @@ -233,9 +233,6 @@ static int blktap_open(struct inode *ino
    2.13  	FRONT_RING_INIT(&blktap_ufe_ring, sring, PAGE_SIZE);
    2.14  
    2.15  	return 0;
    2.16 -
    2.17 - fail_nomem:
    2.18 -	return -ENOMEM;
    2.19  }
    2.20  
    2.21  static int blktap_release(struct inode *inode, struct file *filp)
    2.22 @@ -391,12 +388,12 @@ void blktap_kick_user(void)
    2.23  }
    2.24  
    2.25  static struct file_operations blktap_fops = {
    2.26 -	owner:    THIS_MODULE,
    2.27 -	poll:     blktap_poll,
    2.28 -	ioctl:    blktap_ioctl,
    2.29 -	open:     blktap_open,
    2.30 -	release:  blktap_release,
    2.31 -	mmap:     blktap_mmap,
    2.32 +	.owner   = THIS_MODULE,
    2.33 +	.poll    = blktap_poll,
    2.34 +	.ioctl   = blktap_ioctl,
    2.35 +	.open    = blktap_open,
    2.36 +	.release = blktap_release,
    2.37 +	.mmap    = blktap_mmap,
    2.38  };
    2.39  
    2.40  
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Tue Jan 03 14:35:45 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Tue Jan 03 14:36:56 2006 +0100
     3.3 @@ -314,39 +314,31 @@ static void __xencons_tx_flush(void)
     3.4  {
     3.5  	int sent, sz, work_done = 0;
     3.6  
     3.7 -	if (xen_start_info->flags & SIF_INITDOMAIN) {
     3.8 -		if (x_char) {
     3.9 +	if (x_char) {
    3.10 +		if (xen_start_info->flags & SIF_INITDOMAIN)
    3.11  			kcons_write_dom0(NULL, &x_char, 1);
    3.12 -			x_char = 0;
    3.13 -			work_done = 1;
    3.14 -		}
    3.15 +		else
    3.16 +			while (x_char)
    3.17 +				if (xencons_ring_send(&x_char, 1) == 1)
    3.18 +					break;
    3.19 +		x_char = 0;
    3.20 +		work_done = 1;
    3.21 +	}
    3.22  
    3.23 -		while (wc != wp) {
    3.24 -			sz = wp - wc;
    3.25 -			if (sz > (wbuf_size - WBUF_MASK(wc)))
    3.26 -				sz = wbuf_size - WBUF_MASK(wc);
    3.27 +	while (wc != wp) {
    3.28 +		sz = wp - wc;
    3.29 +		if (sz > (wbuf_size - WBUF_MASK(wc)))
    3.30 +			sz = wbuf_size - WBUF_MASK(wc);
    3.31 +		if (xen_start_info->flags & SIF_INITDOMAIN) {
    3.32  			kcons_write_dom0(NULL, &wbuf[WBUF_MASK(wc)], sz);
    3.33  			wc += sz;
    3.34 -			work_done = 1;
    3.35 -		}
    3.36 -	} else {
    3.37 -		while (x_char) {
    3.38 -			if (xencons_ring_send(&x_char, 1) == 1) {
    3.39 -				x_char = 0;
    3.40 -				work_done = 1;
    3.41 -			}
    3.42 -		}
    3.43 -
    3.44 -		while (wc != wp) {
    3.45 -			sz = wp - wc;
    3.46 -			if (sz > (wbuf_size - WBUF_MASK(wc)))
    3.47 -				sz = wbuf_size - WBUF_MASK(wc);
    3.48 +		} else {
    3.49  			sent = xencons_ring_send(&wbuf[WBUF_MASK(wc)], sz);
    3.50  			if (sent == 0)
    3.51  				break;
    3.52  			wc += sent;
    3.53 -			work_done = 1;
    3.54  		}
    3.55 +		work_done = 1;
    3.56  	}
    3.57  
    3.58  	if (work_done && (xencons_tty != NULL)) {
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Tue Jan 03 14:35:45 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Tue Jan 03 14:36:56 2006 +0100
     4.3 @@ -183,7 +183,7 @@ static void unmap_frontend_pages(netif_t
     4.4  int netif_map(netif_t *netif, unsigned long tx_ring_ref,
     4.5  	      unsigned long rx_ring_ref, unsigned int evtchn)
     4.6  {
     4.7 -	int err;
     4.8 +	int err = -ENOMEM;
     4.9  	netif_tx_sring_t *txs;
    4.10  	netif_rx_sring_t *rxs;
    4.11  	evtchn_op_t op = {
    4.12 @@ -199,25 +199,16 @@ int netif_map(netif_t *netif, unsigned l
    4.13  	if (netif->tx_comms_area == NULL)
    4.14  		return -ENOMEM;
    4.15  	netif->rx_comms_area = alloc_vm_area(PAGE_SIZE);
    4.16 -	if (netif->rx_comms_area == NULL) {
    4.17 -		free_vm_area(netif->tx_comms_area);
    4.18 -		return -ENOMEM;
    4.19 -	}
    4.20 +	if (netif->rx_comms_area == NULL)
    4.21 +		goto err_rx;
    4.22  
    4.23  	err = map_frontend_pages(netif, tx_ring_ref, rx_ring_ref);
    4.24 -	if (err) {
    4.25 -		free_vm_area(netif->tx_comms_area);
    4.26 -		free_vm_area(netif->rx_comms_area);
    4.27 -		return err;
    4.28 -	}
    4.29 +	if (err)
    4.30 +		goto err_map;
    4.31  
    4.32  	err = HYPERVISOR_event_channel_op(&op);
    4.33 -	if (err) {
    4.34 -		unmap_frontend_pages(netif);
    4.35 -		free_vm_area(netif->tx_comms_area);
    4.36 -		free_vm_area(netif->rx_comms_area);
    4.37 -		return err;
    4.38 -	}
    4.39 +	if (err)
    4.40 +		goto err_hypervisor;
    4.41  
    4.42  	netif->evtchn = op.u.bind_interdomain.local_port;
    4.43  
    4.44 @@ -245,6 +236,13 @@ int netif_map(netif_t *netif, unsigned l
    4.45  	rtnl_unlock();
    4.46  
    4.47  	return 0;
    4.48 +err_hypervisor:
    4.49 +	unmap_frontend_pages(netif);
    4.50 +err_map:
    4.51 +	free_vm_area(netif->rx_comms_area);
    4.52 +err_rx:
    4.53 +	free_vm_area(netif->tx_comms_area);
    4.54 +	return err;
    4.55  }
    4.56  
    4.57  static void free_netif_callback(void *arg)
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Tue Jan 03 14:35:45 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Tue Jan 03 14:36:56 2006 +0100
     5.3 @@ -542,14 +542,6 @@ static int xenbus_probe_node(struct xen_
     5.4  			     const char *type,
     5.5  			     const char *nodename)
     5.6  {
     5.7 -#define CHECK_FAIL				\
     5.8 -	do {					\
     5.9 -		if (err)			\
    5.10 -			goto fail;		\
    5.11 -	}					\
    5.12 -	while (0)				\
    5.13 -
    5.14 -
    5.15  	int err;
    5.16  	struct xenbus_device *xendev;
    5.17  	size_t stringlen;
    5.18 @@ -584,19 +576,18 @@ static int xenbus_probe_node(struct xen_
    5.19  	xendev->dev.release = xenbus_dev_release;
    5.20  
    5.21  	err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename);
    5.22 -	CHECK_FAIL;
    5.23 +	if (err)
    5.24 +		goto fail;
    5.25  
    5.26  	/* Register with generic device framework. */
    5.27  	err = device_register(&xendev->dev);
    5.28 -	CHECK_FAIL;
    5.29 +	if (err)
    5.30 +		goto fail;
    5.31  
    5.32  	device_create_file(&xendev->dev, &dev_attr_nodename);
    5.33  	device_create_file(&xendev->dev, &dev_attr_devtype);
    5.34  
    5.35  	return 0;
    5.36 -
    5.37 -#undef CHECK_FAIL
    5.38 -
    5.39  fail:
    5.40  	xenbus_dev_free(xendev);
    5.41  	return err;