to tracefile.c
There is no value in keeping it separate.
Linux-commit:
49209c598d93289ca077575615e98f242b1d8156
Test-Parameters: trivial
Change-Id: I24ee7545a40fd6d2ac15018f089d51142736fa27
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/37408
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX];
-static DECLARE_RWSEM(cfs_tracefile_sem);
-
int cfs_tracefile_init_arch(void)
{
int i;
int cfs_tracefile_init_arch(void)
{
int i;
-void cfs_tracefile_read_lock(void)
-{
- down_read(&cfs_tracefile_sem);
-}
-
-void cfs_tracefile_read_unlock(void)
-{
- up_read(&cfs_tracefile_sem);
-}
-
-void cfs_tracefile_write_lock(void)
-{
- down_write(&cfs_tracefile_sem);
-}
-
-void cfs_tracefile_write_unlock(void)
-{
- up_write(&cfs_tracefile_sem);
-}
-
enum cfs_trace_buf_type cfs_trace_buf_idx_get(void)
{
if (in_irq())
enum cfs_trace_buf_type cfs_trace_buf_idx_get(void)
{
if (in_irq())
static int thread_running = 0;
static atomic_t cfs_tage_allocated = ATOMIC_INIT(0);
static int thread_running = 0;
static atomic_t cfs_tage_allocated = ATOMIC_INIT(0);
+static DECLARE_RWSEM(cfs_tracefile_sem);
static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
struct cfs_trace_cpu_data *tcd);
static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
struct cfs_trace_cpu_data *tcd);
- cfs_tracefile_write_lock();
+ down_write(&cfs_tracefile_sem);
filp = filp_open(filename, O_CREAT|O_EXCL|O_WRONLY|O_LARGEFILE, 0600);
if (IS_ERR(filp)) {
filp = filp_open(filename, O_CREAT|O_EXCL|O_WRONLY|O_LARGEFILE, 0600);
if (IS_ERR(filp)) {
close:
filp_close(filp, NULL);
out:
close:
filp_close(filp, NULL);
out:
- cfs_tracefile_write_unlock();
+ up_write(&cfs_tracefile_sem);
- cfs_tracefile_write_lock();
+ down_write(&cfs_tracefile_sem);
if (strcmp(str, "stop") == 0) {
if (strcmp(str, "stop") == 0) {
- cfs_tracefile_write_unlock();
+ up_write(&cfs_tracefile_sem);
- cfs_tracefile_write_lock();
+ down_write(&cfs_tracefile_sem);
memset(cfs_tracefile, 0, sizeof(cfs_tracefile));
} else if (strncmp(str, "size=", 5) == 0) {
memset(cfs_tracefile, 0, sizeof(cfs_tracefile));
} else if (strncmp(str, "size=", 5) == 0) {
cfs_trace_start_thread();
}
cfs_trace_start_thread();
}
- cfs_tracefile_write_unlock();
+ up_write(&cfs_tracefile_sem);
mb /= num_possible_cpus();
pages = mb << (20 - PAGE_SHIFT);
mb /= num_possible_cpus();
pages = mb << (20 - PAGE_SHIFT);
- cfs_tracefile_write_lock();
+ down_write(&cfs_tracefile_sem);
cfs_tcd_for_each(tcd, i, j)
tcd->tcd_max_pages = (pages * tcd->tcd_pages_factor) / 100;
cfs_tcd_for_each(tcd, i, j)
tcd->tcd_max_pages = (pages * tcd->tcd_pages_factor) / 100;
- cfs_tracefile_write_unlock();
+ up_write(&cfs_tracefile_sem);
struct cfs_trace_cpu_data *tcd;
int total_pages = 0;
struct cfs_trace_cpu_data *tcd;
int total_pages = 0;
- cfs_tracefile_read_lock();
+ down_read(&cfs_tracefile_sem);
cfs_tcd_for_each(tcd, i, j)
total_pages += tcd->tcd_max_pages;
cfs_tcd_for_each(tcd, i, j)
total_pages += tcd->tcd_max_pages;
- cfs_tracefile_read_unlock();
+ up_read(&cfs_tracefile_sem);
return (total_pages >> (20 - PAGE_SHIFT)) + 1;
}
return (total_pages >> (20 - PAGE_SHIFT)) + 1;
}
goto end_loop;
filp = NULL;
goto end_loop;
filp = NULL;
- cfs_tracefile_read_lock();
+ down_read(&cfs_tracefile_sem);
if (cfs_tracefile[0] != 0) {
filp = filp_open(cfs_tracefile,
O_CREAT | O_RDWR | O_LARGEFILE,
if (cfs_tracefile[0] != 0) {
filp = filp_open(cfs_tracefile,
O_CREAT | O_RDWR | O_LARGEFILE,
- cfs_tracefile_read_unlock();
+ up_read(&cfs_tracefile_sem);
if (filp == NULL) {
put_pages_on_daemon_list(&pc);
__LASSERT(list_empty(&pc.pc_pages));
if (filp == NULL) {
put_pages_on_daemon_list(&pc);
__LASSERT(list_empty(&pc.pc_pages));
int cfs_tracefile_init_arch(void);
void cfs_tracefile_fini_arch(void);
int cfs_tracefile_init_arch(void);
void cfs_tracefile_fini_arch(void);
-void cfs_tracefile_read_lock(void);
-void cfs_tracefile_read_unlock(void);
-void cfs_tracefile_write_lock(void);
-void cfs_tracefile_write_unlock(void);
-
int cfs_tracefile_dump_all_pages(char *filename);
void cfs_trace_debug_print(void);
void cfs_trace_flush_pages(void);
int cfs_tracefile_dump_all_pages(char *filename);
void cfs_trace_debug_print(void);
void cfs_trace_flush_pages(void);