ia64/xen-unstable

changeset 18859:7338f6301067

xentop: Fix xentop for blktap

Blktap devices information isn't shown by xentop currently.

xen-unstable c/s 17813 said "blktap devices have statistics
counters (e.g., rd_req, wr_req, oo_req) prepended by tap_".
In fact, it is as follows.

# ls -l /sys/devices/xen-backend/tap-1-769/statistics/
total 0
-r--r--r-- 1 root root 4096 Dec 3 20:37 oo_req
-r--r--r-- 1 root root 4096 Dec 3 20:37 rd_req
-r--r--r-- 1 root root 4096 Dec 3 20:37 rd_sect
-r--r--r-- 1 root root 4096 Dec 3 20:37 wr_req
-r--r--r-- 1 root root 4096 Dec 3 20:37 wr_sect

The statistics counters haven't had "tap_" because it was removed
by linux-2.6.18-xen c/s 34.

This patch reverts xen-unstable c/s 17813, then we can get the
blktap devices information by using xentop.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 03 15:58:23 2008 +0000 (2008-12-03)
parents bb7683510600
children f4c5befcba8d 63aa939c114c
files tools/xenstat/libxenstat/src/xenstat_linux.c
line diff
     1.1 --- a/tools/xenstat/libxenstat/src/xenstat_linux.c	Wed Dec 03 15:56:33 2008 +0000
     1.2 +++ b/tools/xenstat/libxenstat/src/xenstat_linux.c	Wed Dec 03 15:58:23 2008 +0000
     1.3 @@ -182,12 +182,6 @@ int xenstat_collect_vbds(xenstat_node * 
     1.4  	struct dirent *dp;
     1.5  	struct priv_data *priv = get_priv_data(node->handle);
     1.6  
     1.7 -	char *sys_prefix = "statistics/";
     1.8 -
     1.9 -	/* 23 = "statistics/" + "xxxx_xx_req" */
    1.10 -	char ooreq[23], rdreq[23], wrreq[23]; 
    1.11 -	char *stat_prefix = NULL;
    1.12 -
    1.13  	if (priv == NULL) {
    1.14  		perror("Allocation error");
    1.15  		return 0;
    1.16 @@ -215,16 +209,12 @@ int xenstat_collect_vbds(xenstat_node * 
    1.17  		if (ret != 3)
    1.18  			continue;
    1.19  
    1.20 -
    1.21 -		if (strcmp(buf,"vbd") == 0){
    1.22 -			stat_prefix = "";
    1.23 +		if (strcmp(buf,"vbd") == 0)
    1.24  			vbd.back_type = 1;
    1.25 -		} else if (strcmp(buf,"tap") == 0){
    1.26 -			stat_prefix = "tap_";
    1.27 +		else if (strcmp(buf,"tap") == 0)
    1.28  			vbd.back_type = 2;
    1.29 -		} else {
    1.30 +		else
    1.31  			continue;
    1.32 -		}
    1.33  
    1.34  		domain = xenstat_node_domain(node, domid);
    1.35  		if (domain == NULL) {
    1.36 @@ -235,22 +225,19 @@ int xenstat_collect_vbds(xenstat_node * 
    1.37  			continue;
    1.38  		}
    1.39  
    1.40 -		snprintf(ooreq, sizeof(ooreq), "%s%soo_req", sys_prefix, stat_prefix);
    1.41 -		if((read_attributes_vbd(dp->d_name, ooreq, buf, 256)<=0)
    1.42 +		if((read_attributes_vbd(dp->d_name, "statistics/oo_req", buf, 256)<=0)
    1.43  		   || ((ret = sscanf(buf, "%llu", &vbd.oo_reqs)) != 1))
    1.44  		{
    1.45  			continue;
    1.46  		}
    1.47  
    1.48 -		snprintf(rdreq,  sizeof(rdreq),"%s%srd_req", sys_prefix, stat_prefix);
    1.49 -		if((read_attributes_vbd(dp->d_name, rdreq, buf, 256)<=0)
    1.50 +		if((read_attributes_vbd(dp->d_name, "statistics/rd_req", buf, 256)<=0)
    1.51  		   || ((ret = sscanf(buf, "%llu", &vbd.rd_reqs)) != 1))
    1.52  		{
    1.53  			continue;
    1.54  		}
    1.55  
    1.56 -		snprintf(wrreq,  sizeof(wrreq),"%s%swr_req", sys_prefix, stat_prefix);
    1.57 -		if((read_attributes_vbd(dp->d_name, wrreq, buf, 256)<=0)
    1.58 +		if((read_attributes_vbd(dp->d_name, "statistics/wr_req", buf, 256)<=0)
    1.59  		   || ((ret = sscanf(buf, "%llu", &vbd.wr_reqs)) != 1))
    1.60  		{
    1.61  			continue;