Whamcloud - gitweb
Branch HEAD
authorbobijam <bobijam>
Tue, 23 Sep 2008 02:49:52 +0000 (02:49 +0000)
committerbobijam <bobijam>
Tue, 23 Sep 2008 02:49:52 +0000 (02:49 +0000)
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.

lustre/ChangeLog
lustre/llite/lproc_llite.c

index c7fe06f..440be75 100644 (file)
@@ -12,6 +12,12 @@ tbd  Sun Microsystems, Inc.
        * RHEL 4 and RHEL 5/SLES 10 clients behaves differently on 'cd' to a
         removed cwd "./" (refer to Bugzilla 14399).
 
+Severity   : enhancement
+Bugzilla   : 15966
+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.
+
 Severity   : major
 Frequency  : Only on FC kernels 2.6.22+
 Bugzilla   : 16303
index 8099a8d..c0eda8c 100644 (file)
@@ -335,7 +335,7 @@ static int ll_wr_max_cached_mb(struct file *file, const char *buffer,
         spin_lock(&sbi->ll_lock);
         sbi->ll_async_page_max = pages_number ;
         spin_unlock(&sbi->ll_lock);
-        
+
         if (!sbi->ll_dt_exp)
                 /* Not set up yet, don't call llap_shrink_cache */
                 return count;
@@ -361,20 +361,20 @@ static int ll_rd_pgcache_bnlc(char *page, char **start, off_t off,
         unsigned long total_budget = 0;
         int n = 0, cpu;
 
-        n += snprintf(page +n, count - n, 
+        n += snprintf(page +n, count - n,
                 "cpu\tpage count\tbudget\t\treblnc count\tgen\thit\tmiss\tcross\n");
         for_each_online_cpu(cpu) {
                 pd = LL_PGLIST_DATA_CPU(sbi, cpu);
-                n += snprintf(page + n, count - n, 
-                              "%d\t%-8lu\t%-8lu\t%-8lu\t%lu\t%lu\t%lu\t%lu\n", 
+                n += snprintf(page + n, count - n,
+                              "%d\t%-8lu\t%-8lu\t%-8lu\t%lu\t%lu\t%lu\t%lu\n",
                               cpu, pd->llpd_count, pd->llpd_budget,
-                              pd->llpd_reblnc_count, pd->llpd_gen, 
+                              pd->llpd_reblnc_count, pd->llpd_gen,
                               pd->llpd_hit, pd->llpd_miss, pd->llpd_cross);
                 total_budget += pd->llpd_budget;
         }
-        n += snprintf(page + n, count - n, 
-                "Total budget: %lu, page max: %lu, rebalance cnt: %lu\n", 
-                total_budget, sbi->ll_async_page_max, 
+        n += snprintf(page + n, count - n,
+                "Total budget: %lu, page max: %lu, rebalance cnt: %lu\n",
+                total_budget, sbi->ll_async_page_max,
                 sbi->ll_async_page_reblnc_count);
         *eof = 1;
         return n;
@@ -438,7 +438,7 @@ static int ll_wr_max_rw_chunk(struct file *file, const char *buffer,
         return count;
 }
 
-static int ll_rd_track_id(char *page, int count, void *data, 
+static int ll_rd_track_id(char *page, int count, void *data,
                           enum stats_track_type type)
 {
         struct super_block *sb = data;
@@ -446,7 +446,7 @@ static int ll_rd_track_id(char *page, int count, void *data,
         if (ll_s2sbi(sb)->ll_stats_track_type == type) {
                 return snprintf(page, count, "%d\n",
                                 ll_s2sbi(sb)->ll_stats_track_id);
-        
+
         } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
                 return snprintf(page, count, "0 (all)\n");
         } else {
@@ -504,7 +504,7 @@ static int ll_rd_track_gid(char *page, char **start, off_t off,
 
 static int ll_wr_track_gid(struct file *file, const char *buffer,
                           unsigned long count, void *data)
-{                                                                 
+{
         return (ll_wr_track_id(buffer, count, data, STATS_TRACK_GID));
 }
 
@@ -731,12 +731,12 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
         len = strlen(lsi->lsi_lmd->lmd_profile);
         ptr = strrchr(lsi->lsi_lmd->lmd_profile, '-');
         if (ptr && (strcmp(ptr, "-client") == 0))
-                len -= 7; 
-        
+                len -= 7;
+
         /* Mount info */
         snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len,
                  lsi->lsi_lmd->lmd_profile, sb);
-        
+
         sbi->ll_proc_root = lprocfs_register(name, parent, NULL, NULL);
         if (IS_ERR(sbi->ll_proc_root)) {
                 err = PTR_ERR(sbi->ll_proc_root);
@@ -766,7 +766,7 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
                 CWARN("Error adding the offset_stats file\n");
 
         /* File operations stats */
-        sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES, 
+        sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
                                             LPROCFS_STATS_FLAG_PERCPU);
         if (sbi->ll_stats == NULL)
                 GOTO(out, err = -ENOMEM);
@@ -797,7 +797,7 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
         for (id = 0; id < LL_RA_STAT; id++)
                 lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
                                      ra_stats_string[id], "pages");
-        err = lprocfs_register_stats(sbi->ll_proc_root, "read_ahead_stats", 
+        err = lprocfs_register_stats(sbi->ll_proc_root, "read_ahead_stats",
                                      sbi->ll_ra_stats);
         if (err)
                 GOTO(out, err);
@@ -943,7 +943,7 @@ static int llite_dump_pgcache_seq_show(struct seq_file *seq, void *v)
         return 0;
 }
 
-static void *llite_dump_pgcache_seq_next(struct seq_file *seq, void *v, 
+static void *llite_dump_pgcache_seq_next(struct seq_file *seq, void *v,
                                          loff_t *pos)
 {
         struct ll_async_page *llap, *dummy_llap = seq->private;
@@ -961,7 +961,7 @@ static void *llite_dump_pgcache_seq_next(struct seq_file *seq, void *v,
          * we advance to a position beyond it, returning null if there
          * isn't another llap in the list beyond that new position. */
         pd = ll_pglist_cpu_lock(sbi, cpu);
-        llap = llite_pglist_next_llap(&pd->llpd_list, 
+        llap = llite_pglist_next_llap(&pd->llpd_list,
                         &dummy_llap->llap_pglist_item);
         list_del_init(&dummy_llap->llap_pglist_item);
         if (llap) {
@@ -978,7 +978,7 @@ static void *llite_dump_pgcache_seq_next(struct seq_file *seq, void *v,
                         ll_pglist_cpu_unlock(sbi, i);
                 }
                 if (next != NULL) {
-                        list_move(&dummy_llap->llap_pglist_item, 
+                        list_move(&dummy_llap->llap_pglist_item,
                                   &next->llpd_list);
                         dummy_llap->llap_pglist_cpu = i;
                         ll_pglist_cpu_unlock(sbi, cpu);
@@ -1133,14 +1133,15 @@ 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",
                    now.tv_sec, now.tv_usec);
         seq_printf(seq, "%15s %19s       | %20s\n", " ", "read", "write");
-        seq_printf(seq, "%13s   %14s %4s %4s  | %14s %4s %4s\n", 
+        seq_printf(seq, "%13s   %14s %4s %4s  | %14s %4s %4s\n",
                    "extents", "calls", "%", "cum%",
                    "calls", "%", "cum%");
         spin_lock(&sbi->ll_pp_extent_lock);
@@ -1163,8 +1164,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;
@@ -1186,15 +1197,16 @@ 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",
                    now.tv_sec, now.tv_usec);
 
         seq_printf(seq, "%15s %19s       | %20s\n", " ", "read", "write");
-        seq_printf(seq, "%13s   %14s %4s %4s  | %14s %4s %4s\n", 
+        seq_printf(seq, "%13s   %14s %4s %4s  | %14s %4s %4s\n",
                    "extents", "calls", "%", "cum%",
                    "calls", "%", "cum%");
         spin_lock(&sbi->ll_lock);
@@ -1211,8 +1223,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;
 
-        sbi->ll_rw_stats_on = 1;
+        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;
         spin_lock(&sbi->ll_pp_extent_lock);
         for(i = 0; i <= LL_PROCESS_HIST_MAX; i++)
         {
@@ -1253,7 +1274,7 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct file
 
         if (cur == -1) {
                 /* new process */
-                sbi->ll_extent_process_count = 
+                sbi->ll_extent_process_count =
                         (sbi->ll_extent_process_count + 1) % LL_PROCESS_HIST_MAX;
                 cur = sbi->ll_extent_process_count;
                 io_extents->pp_extents[cur].pid = pid;
@@ -1261,7 +1282,7 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct file
                 lprocfs_oh_clear(&io_extents->pp_extents[cur].pp_w_hist);
         }
 
-        for(i = 0; (count >= (1 << LL_HIST_START << i)) && 
+        for(i = 0; (count >= (1 << LL_HIST_START << i)) &&
              (i < (LL_HIST_MAX - 1)); i++);
         if (rw == 0) {
                 io_extents->pp_extents[cur].pp_r_hist.oh_buckets[i]++;
@@ -1344,8 +1365,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);
@@ -1394,8 +1416,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;
 
-        sbi->ll_rw_stats_on = 1;
+        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;
 
         spin_lock(&sbi->ll_process_lock);
         sbi->ll_offset_process_count = 0;