Changes:
xxxx/xx/xx: Version 10.0.4 - Sebastien Godard (sysstat <at> orange.fr)
+ * [Andrey Borzenkov]: Don't take virtual devices into account in
+ sar -b results.
* configure script updated: Added --disable-stripping option.
Using this option tells configure to NOT strip object files.
* NLS updated. Serbian translation added.
Michael Blakeley <mike@bla[...].com>
Pascal Bleser <pbleser@ato[...].com>
Lodewijk Bonebakker <jlbonebakker@gma[...].com>
+ Andrey Borzenkov <arvidjaar@gma[...].com>
Jesse Brandeburg <jesse.brandeburg@int[...].com>
Xavier Bru <xavier.bru@bul[...].net>
Jason Burnett <jason@jnj[...].org>
* ioconf.c which should be used only with kernels that don't have sysfs.
*
* IN:
- * @name Device or partition name.
+ * @name Device or partition name.
+ * @allow_virtual TRUE if virtual devices are also accepted.
+ * The device is assumed to be virtual if no
+ * /sys/block/<device>/device link exists.
*
* RETURNS:
- * TRUE if @name is a (whole) device.
+ * TRUE if @name is not a partition.
***************************************************************************
*/
-int is_device(char *name)
+int is_device(char *name, int allow_virtual)
{
char syspath[PATH_MAX];
char *slash;
while ((slash = strchr(name, '/'))) {
*slash = '!';
}
- snprintf(syspath, sizeof(syspath), "%s/%s", SYSFS_BLOCK, name);
+ snprintf(syspath, sizeof(syspath), "%s/%s%s", SYSFS_BLOCK, name,
+ allow_virtual ? "" : "/device");
return !(access(syspath, F_OK));
}
#define NR_DISKS 4
+#define IGNORE_VIRTUAL_DEVICES FALSE
+#define ACCEPT_VIRTUAL_DEVICES TRUE
+
/* Environment variables */
#define ENV_TIME_FMT "S_TIME_FORMAT"
#define ENV_TIME_DEFTM "S_TIME_DEF_TIME"
extern void
init_nls(void);
extern int
- is_device(char *);
+ is_device(char *, int);
extern double
ll_s_value(unsigned long long, unsigned long long, unsigned long long);
extern double
if (i == 14) {
/* Device or partition */
- if (!dlist_idx && !DISPLAY_PARTITIONS(flags) && !is_device(dev_name))
+ if (!dlist_idx && !DISPLAY_PARTITIONS(flags) &&
+ !is_device(dev_name, ACCEPT_VIRTUAL_DEVICES))
continue;
sdev.rd_ios = rd_ios;
sdev.rd_merges = rd_merges_or_rd_sec;
&major, &minor, dev_name,
&rd_ios, &rd_sec, &wr_ios, &wr_sec) == 7) {
- if (is_device(dev_name)) {
+ if (is_device(dev_name, IGNORE_VIRTUAL_DEVICES)) {
/*
- * OK: It's a device and not a partition.
+ * OK: It's a (real) device and not a partition.
* Note: Structure should have been initialized first!
*/
st_io->dk_drive += rd_ios + wr_ios;
if (!rd_ios && !wr_ios)
/* Unused device: Ignore it */
continue;
- if (read_part || is_device(dev_name)) {
+ if (read_part || is_device(dev_name, ACCEPT_VIRTUAL_DEVICES)) {
st_disk_i = st_disk + dsk++;
st_disk_i->major = major;
st_disk_i->minor = minor;
if (!count_part) {
i = sscanf(line, "%*d %*d %s %lu %*u %*u %*u %lu",
dev_name, &rd_ios, &wr_ios);
- if ((i == 2) || !is_device(dev_name))
+ if ((i == 2) || !is_device(dev_name, ACCEPT_VIRTUAL_DEVICES))
/* It was a partition and not a device */
continue;
if (only_used_dev && !rd_ios && !wr_ios)