static void dasd_stats_all_block_reset(void)
{
	int i;
	struct dasd_device *device;

	for (i = 0; i < dasd_max_devindex; ++i) {
		device = dasd_device_from_devindex(i);
		if (IS_ERR(device))
			continue;
		if (device->block)
			dasd_profile_reset(&device->block->profile);
		dasd_put_device(device);
	}
}
Beispiel #2
0
/*
 * Reset device profile information
 */
static int dasd_ioctl_reset_profile(struct dasd_block *block)
{
	dasd_profile_reset(&block->profile);
	return 0;
}
Beispiel #3
0
static ssize_t dasd_stats_proc_write(struct file *file,
		const char __user *user_buf, size_t user_len, loff_t *pos)
{
#ifdef CONFIG_DASD_PROFILE
	char *buffer, *str;
	int rc;

	if (user_len > 65536)
		user_len = 65536;
	buffer = dasd_get_user_string(user_buf, user_len);
	if (IS_ERR(buffer))
		return PTR_ERR(buffer);

	/* check for valid verbs */
	str = skip_spaces(buffer);
	if (strncmp(str, "set", 3) == 0 && isspace(str[3])) {
		/* 'set xxx' was given */
		str = skip_spaces(str + 4);
		if (strcmp(str, "on") == 0) {
			/* switch on statistics profiling */
			rc = dasd_stats_all_block_on();
			if (rc) {
				dasd_stats_all_block_off();
				goto out_error;
			}
			rc = dasd_profile_on(&dasd_global_profile);
			if (rc) {
				dasd_stats_all_block_off();
				goto out_error;
			}
			dasd_profile_reset(&dasd_global_profile);
			dasd_global_profile_level = DASD_PROFILE_ON;
			pr_info("The statistics feature has been switched "
				"on\n");
		} else if (strcmp(str, "off") == 0) {
			/* switch off statistics profiling */
			dasd_global_profile_level = DASD_PROFILE_OFF;
			dasd_profile_off(&dasd_global_profile);
			dasd_stats_all_block_off();
			pr_info("The statistics feature has been switched "
				"off\n");
		} else
			goto out_parse_error;
	} else if (strncmp(str, "reset", 5) == 0) {
		/* reset the statistics */
		dasd_profile_reset(&dasd_global_profile);
		dasd_stats_all_block_reset();
		pr_info("The statistics have been reset\n");
	} else
		goto out_parse_error;
	vfree(buffer);
	return user_len;
out_parse_error:
	rc = -EINVAL;
	pr_warn("%s is not a supported value for /proc/dasd/statistics\n", str);
out_error:
	vfree(buffer);
	return rc;
#else
	pr_warn("/proc/dasd/statistics: is not activated in this kernel\n");
	return user_len;
#endif				/* CONFIG_DASD_PROFILE */
}