unsigned int dasd_global_profile_level = DASD_PROFILE_OFF;
#ifdef CONFIG_DASD_PROFILE
-struct dasd_profile_info dasd_global_profile_data;
-static struct dentry *dasd_global_profile_dentry;
+static struct dasd_profile_info dasd_global_profile_data;
+struct dasd_profile dasd_global_profile = {
+ .dentry = NULL,
+ .data = &dasd_global_profile_data,
+ .lock = __SPIN_LOCK_UNLOCKED(dasd_global_profile.lock),
+};
static struct dentry *dasd_debugfs_global_entry;
/*
if (++counter >= 31)
break;
+ spin_lock(&dasd_global_profile.lock);
if (dasd_global_profile_level) {
- dasd_global_profile_data.dasd_io_nr_req[counter]++;
+ dasd_global_profile.data->dasd_io_nr_req[counter]++;
if (rq_data_dir(req) == READ)
- dasd_global_profile_data.dasd_read_nr_req[counter]++;
+ dasd_global_profile.data->dasd_read_nr_req[counter]++;
}
+ spin_unlock(&dasd_global_profile.lock);
spin_lock(&block->profile.lock);
if (block->profile.data) {
dasd_profile_counter(irqtime / sectors, irqtimeps_ind);
dasd_profile_counter(endtime, endtime_ind);
+ spin_lock(&dasd_global_profile.lock);
if (dasd_global_profile_level) {
- dasd_profile_end_add_data(&dasd_global_profile_data,
+ dasd_profile_end_add_data(dasd_global_profile.data,
cqr->startdev != block->base,
cqr->cpmode == 1,
rq_data_dir(req) == READ,
irqtime_ind, irqtimeps_ind,
endtime_ind);
}
+ spin_unlock(&dasd_global_profile.lock);
spin_lock(&block->profile.lock);
if (block->profile.data)
void dasd_global_profile_reset(void)
{
- memset(&dasd_global_profile_data, 0, sizeof(dasd_global_profile_data));
- getnstimeofday(&dasd_global_profile_data.starttod);
+ dasd_profile_reset(&dasd_global_profile);
}
int dasd_profile_on(struct dasd_profile *profile)
seq_puts(m, "disabled\n");
return 0;
}
- dasd_stats_seq_print(m, &dasd_global_profile_data);
+ spin_lock_bh(&dasd_global_profile.lock);
+ dasd_stats_seq_print(m, dasd_global_profile.data);
+ spin_unlock_bh(&dasd_global_profile.lock);
return 0;
}
static void dasd_statistics_removeroot(void)
{
dasd_global_profile_level = DASD_PROFILE_OFF;
- debugfs_remove(dasd_global_profile_dentry);
- dasd_global_profile_dentry = NULL;
+ debugfs_remove(dasd_global_profile.dentry);
+ dasd_global_profile.dentry = NULL;
debugfs_remove(dasd_debugfs_global_entry);
debugfs_remove(dasd_debugfs_root_entry);
}
dasd_debugfs_root_entry = NULL;
dasd_debugfs_global_entry = NULL;
- dasd_global_profile_dentry = NULL;
pde = debugfs_create_dir("dasd", NULL);
if (!pde || IS_ERR(pde))
goto error;
NULL, &dasd_stats_global_fops);
if (!pde || IS_ERR(pde))
goto error;
- dasd_global_profile_dentry = pde;
+ dasd_global_profile.dentry = pde;
return;
error:
"/proc/dasd/statistics'\n");
return 0;
}
- prof = &dasd_global_profile_data;
+ spin_lock_bh(&dasd_global_profile.lock);
+ prof = dasd_global_profile.data;
/* prevent counter 'overflow' on output */
for (factor = 1; (prof->dasd_io_reqs / factor) > 9999999;
dasd_statistics_array(m, prof->dasd_io_time3, factor);
seq_printf(m, "# of req in chanq at enqueuing (1..32) \n");
dasd_statistics_array(m, prof->dasd_io_nr_req, factor);
+ spin_unlock_bh(&dasd_global_profile.lock);
#else
seq_printf(m, "Statistics are not activated in this kernel\n");
#endif