From 696f6d3ffc3e01fc0a8d5d9a7740d52bf2b6a7e5 Mon Sep 17 00:00:00 2001 From: bobijam Date: Tue, 23 Sep 2008 02:45:40 +0000 Subject: [PATCH] Branch b1_8_gate b=15966 o=komal.nawandar i=adilger i=zhenyu.xu (bobijam) Description: Re-disable certain /proc logging Details : Enable and disable client's offset_stats, extents_stats and extents_stats_per_process stats logging on the fly.b=15966 --- lustre/llite/lproc_llite.c | 50 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 3730392..596098d 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -1119,8 +1119,9 @@ static int ll_rw_extents_stats_pp_seq_show(struct seq_file *seq, void *v) do_gettimeofday(&now); if (!sbi->ll_rw_stats_on) { - seq_printf(seq, "Disabled\n" - "Write anything in this file to activate\n"); + seq_printf(seq, "disabled\n" + "write anything in this file to activate, " + "then 0 or \"[D/d]isabled\" to deactivate\n"); return 0; } seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", @@ -1149,8 +1150,18 @@ static ssize_t ll_rw_extents_stats_pp_seq_write(struct file *file, struct ll_sb_info *sbi = seq->private; struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info; int i; + int value = 1, rc = 0; + + rc = lprocfs_write_helper(buf, len, &value); + if (rc < 0 && (strcmp(buf, "disabled") == 0 || + strcmp(buf, "Disabled") == 0)) + value = 0; + + if (value == 0) + sbi->ll_rw_stats_on = 0; + else + sbi->ll_rw_stats_on = 1; - sbi->ll_rw_stats_on = 1; spin_lock(&sbi->ll_pp_extent_lock); for(i = 0; i < LL_PROCESS_HIST_MAX; i++) { io_extents->pp_extents[i].pid = 0; @@ -1172,8 +1183,9 @@ static int ll_rw_extents_stats_seq_show(struct seq_file *seq, void *v) do_gettimeofday(&now); if (!sbi->ll_rw_stats_on) { - seq_printf(seq, "Disabled\n" - "Write anything in this file to activate\n"); + seq_printf(seq, "disabled\n" + "write anything in this file to activate, " + "then 0 or \"[D/d]isabled\" to deactivate\n"); return 0; } seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n", @@ -1197,8 +1209,17 @@ static ssize_t ll_rw_extents_stats_seq_write(struct file *file, const char *buf, struct ll_sb_info *sbi = seq->private; struct ll_rw_extents_info *io_extents = &sbi->ll_rw_extents_info; int i; + int value = 1, rc = 0; + + rc = lprocfs_write_helper(buf, len, &value); + if (rc < 0 && (strcmp(buf, "disabled") == 0 || + strcmp(buf, "Disabled") == 0)) + value = 0; - sbi->ll_rw_stats_on = 1; + if (value == 0) + sbi->ll_rw_stats_on = 0; + else + sbi->ll_rw_stats_on = 1; spin_lock(&sbi->ll_pp_extent_lock); for(i = 0; i <= LL_PROCESS_HIST_MAX; i++) { @@ -1330,8 +1351,9 @@ static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v) do_gettimeofday(&now); if (!sbi->ll_rw_stats_on) { - seq_printf(seq, "Disabled\n" - "Write anything in this file to activate\n"); + seq_printf(seq, "disabled\n" + "write anything in this file to activate, " + "then 0 or \"[D/d]isabled\" to deactivate\n"); return 0; } spin_lock(&sbi->ll_process_lock); @@ -1380,8 +1402,18 @@ static ssize_t ll_rw_offset_stats_seq_write(struct file *file, const char *buf, struct ll_sb_info *sbi = seq->private; struct ll_rw_process_info *process_info = sbi->ll_rw_process_info; struct ll_rw_process_info *offset_info = sbi->ll_rw_offset_info; + int value = 1, rc = 0; + + rc = lprocfs_write_helper(buf, len, &value); - sbi->ll_rw_stats_on = 1; + if (rc < 0 && (strcmp(buf, "disabled") == 0 || + strcmp(buf, "Disabled") == 0)) + value = 0; + + if (value == 0) + sbi->ll_rw_stats_on = 0; + else + sbi->ll_rw_stats_on = 1; spin_lock(&sbi->ll_process_lock); sbi->ll_offset_process_count = 0; -- 1.8.3.1