direct-io.hg

changeset 11283:7299065fac68

Small blktap cleanups.

Signed-off-by: Andrew Warfield <andy@xensource.com>
author akw@devbox.site
date Tue Aug 29 15:55:24 2006 -0700 (2006-08-29)
parents 7bfd8efb4fa7
children 90fb2c4d33a5
files linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c tools/blktap/drivers/block-aio.c tools/blktap/drivers/block-qcow.c tools/blktap/drivers/tapdisk.c tools/blktap/lib/xs_api.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Tue Aug 29 14:34:57 2006 -0700
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c	Tue Aug 29 15:55:24 2006 -0700
     1.3 @@ -114,8 +114,8 @@ typedef struct domid_translate {
     1.4  } domid_translate_t ;
     1.5  
     1.6  
     1.7 -domid_translate_t  translate_domid[MAX_TAP_DEV];
     1.8 -tap_blkif_t *tapfds[MAX_TAP_DEV];
     1.9 +static domid_translate_t  translate_domid[MAX_TAP_DEV];
    1.10 +static tap_blkif_t *tapfds[MAX_TAP_DEV];
    1.11  
    1.12  static int __init set_blkif_reqs(char *str)
    1.13  {
    1.14 @@ -1118,7 +1118,7 @@ static int do_block_io_op(blkif_t *blkif
    1.15  			       "ring does not exist!\n");
    1.16  			print_dbug = 0; /*We only print this message once*/
    1.17  		}
    1.18 -		return 1;
    1.19 +		return 0;
    1.20  	}
    1.21  
    1.22  	info = tapfds[blkif->dev_num];
    1.23 @@ -1127,7 +1127,7 @@ static int do_block_io_op(blkif_t *blkif
    1.24  			WPRINTK("Can't get UE info!\n");
    1.25  			print_dbug = 0;
    1.26  		}
    1.27 -		return 1;
    1.28 +		return 0;
    1.29  	}
    1.30  
    1.31  	while (rc != rp) {
     2.1 --- a/tools/blktap/drivers/block-aio.c	Tue Aug 29 14:34:57 2006 -0700
     2.2 +++ b/tools/blktap/drivers/block-aio.c	Tue Aug 29 15:55:24 2006 -0700
     2.3 @@ -161,7 +161,7 @@ int tdaio_open (struct td_state *s, cons
     2.4                                  "trying to concurrently use a large number "
     2.5                                  "of blktap-based disks, you may need to "
     2.6                                  "increase the system-wide aio request limit. "
     2.7 -                                "(e.g. 'echo echo 1048576 > /proc/sys/"
     2.8 +                                "(e.g. 'echo echo 1048576 > /proc/sys/fs/"
     2.9                                  "aio-max-nr')\n");
    2.10                  } else {
    2.11                          DPRINTF("Couldn't get fd for AIO poll support.  This "
     3.1 --- a/tools/blktap/drivers/block-qcow.c	Tue Aug 29 14:34:57 2006 -0700
     3.2 +++ b/tools/blktap/drivers/block-qcow.c	Tue Aug 29 15:55:24 2006 -0700
     3.3 @@ -182,7 +182,7 @@ static int init_aio_state(struct td_stat
     3.4                                  "trying to concurrently use a large number "
     3.5                                  "of blktap-based disks, you may need to "
     3.6                                  "increase the system-wide aio request limit. "
     3.7 -                                "(e.g. 'echo echo 1048576 > /proc/sys/"
     3.8 +                                "(e.g. 'echo echo 1048576 > /proc/sys/fs/"
     3.9                                  "aio-max-nr')\n");
    3.10                  } else {
    3.11                          DPRINTF("Couldn't get fd for AIO poll support.  This "
     4.1 --- a/tools/blktap/drivers/tapdisk.c	Tue Aug 29 14:34:57 2006 -0700
     4.2 +++ b/tools/blktap/drivers/tapdisk.c	Tue Aug 29 15:55:24 2006 -0700
     4.3 @@ -110,6 +110,7 @@ static void unmap_disk(struct td_state *
     4.4  	free(s->fd_entry);
     4.5  	free(s->blkif);
     4.6  	free(s->ring_info);
     4.7 +        free(s->private);
     4.8  	free(s);
     4.9  
    4.10  	return;
     5.1 --- a/tools/blktap/lib/xs_api.c	Tue Aug 29 14:34:57 2006 -0700
     5.2 +++ b/tools/blktap/lib/xs_api.c	Tue Aug 29 15:55:24 2006 -0700
     5.3 @@ -204,7 +204,7 @@ char *get_dom_domid(struct xs_handle *h,
     5.4  int convert_dev_name_to_num(char *name) {
     5.5  	char *p_sd, *p_hd, *p_xvd, *p_plx, *p, *alpha,*ptr;
     5.6  	int majors[10] = {3,22,33,34,56,57,88,89,90,91};
     5.7 -	int maj,i;
     5.8 +	int maj,i,ret = 0;
     5.9  
    5.10  	asprintf(&p_sd,"/dev/sd");
    5.11  	asprintf(&p_hd,"/dev/hd");
    5.12 @@ -221,7 +221,7 @@ int convert_dev_name_to_num(char *name) 
    5.13  			*ptr++;
    5.14  		}
    5.15  		*p++;
    5.16 -		return BASE_DEV_VAL + (16*i) + atoi(p);
    5.17 +		ret = BASE_DEV_VAL + (16*i) + atoi(p);
    5.18  	} else if (strstr(name, p_hd) != NULL) {
    5.19  		p = name + strlen(p_hd);
    5.20  		for (i = 0, ptr = alpha; i < strlen(alpha); i++) {
    5.21 @@ -229,7 +229,7 @@ int convert_dev_name_to_num(char *name) 
    5.22  			*ptr++;
    5.23  		}
    5.24  		*p++;
    5.25 -		return (majors[i/2]*256) + atoi(p);
    5.26 +		ret = (majors[i/2]*256) + atoi(p);
    5.27  
    5.28  	} else if (strstr(name, p_xvd) != NULL) {
    5.29  		p = name + strlen(p_xvd);
    5.30 @@ -238,16 +238,23 @@ int convert_dev_name_to_num(char *name) 
    5.31  			*ptr++;
    5.32  		}
    5.33  		*p++;
    5.34 -		return (202*256) + (16*i) + atoi(p);
    5.35 +		ret = (202*256) + (16*i) + atoi(p);
    5.36  
    5.37  	} else if (strstr(name, p_plx) != NULL) {
    5.38  		p = name + strlen(p_plx);
    5.39 -		return atoi(p);
    5.40 +		ret = atoi(p);
    5.41  
    5.42  	} else {
    5.43  		DPRINTF("Unknown device type, setting to default.\n");
    5.44 -		return BASE_DEV_VAL;
    5.45 +		ret = BASE_DEV_VAL;
    5.46  	}
    5.47 +
    5.48 +        free(p_sd);
    5.49 +        free(p_hd);
    5.50 +        free(p_xvd);
    5.51 +        free(p_plx);
    5.52 +        free(alpha);
    5.53 +        
    5.54  	return 0;
    5.55  }
    5.56