Whamcloud - gitweb
b=21571 stacksize and locking fixes for loadgen patch from umka
[fs/lustre-release.git] / lustre / obdfilter / lproc_obdfilter.c
index 7810acc..e18d6e9 100644 (file)
@@ -103,8 +103,14 @@ static int lprocfs_filter_rd_last_id(char *page, char **start, off_t off,
 
         if (obd == NULL)
                 return 0;
+        rc = snprintf(page, count, LPU64"\n",filter_last_id(filter, 0));
+        if (rc < 0)
+                return rc;
+        page += rc;
+        count -= rc;
+        retval += rc;
 
-        for (i = FILTER_GROUP_MDS0; i < filter->fo_group_count; i++) {
+        for (i = FILTER_GROUP_MDS1_N_BASE; i < filter->fo_group_count; i++) {
                 rc = snprintf(page, count, LPU64"\n",filter_last_id(filter, i));
                 if (rc < 0) {
                         retval = rc;
@@ -293,7 +299,9 @@ static int lprocfs_filter_wr_cache(struct file *file, const char *buffer,
         if (rc)
                 return rc;
 
+        spin_lock_bh(&obd->obd_processing_task_lock);
         obd->u.filter.fo_read_cache = val;
+        spin_unlock_bh(&obd->obd_processing_task_lock);
         return count;
 }
 
@@ -318,7 +326,42 @@ static int lprocfs_filter_wr_wcache(struct file *file, const char *buffer,
         if (rc)
                 return rc;
 
+        spin_lock_bh(&obd->obd_processing_task_lock);
         obd->u.filter.fo_writethrough_cache = val;
+        spin_unlock_bh(&obd->obd_processing_task_lock);
+        return count;
+}
+
+static int lprocfs_filter_rd_mds_sync(char *page, char **start, off_t off,
+                                      int count, int *eof, void *data)
+{
+        struct obd_device *obd = (struct obd_device *)data;
+        LASSERT(obd != NULL);
+
+        return snprintf(page, count, "%u\n", obd->u.filter.fo_mds_ost_sync);
+}
+
+int lprocfs_filter_rd_degraded(char *page, char **start, off_t off,
+                               int count, int *eof, void *data)
+{
+        struct obd_device *obd = data;
+
+        return snprintf(page, count, "%u\n", obd->u.filter.fo_raid_degraded);
+}
+
+int lprocfs_filter_wr_degraded(struct file *file, const char *buffer,
+                               unsigned long count, void *data)
+{
+        struct obd_device *obd = data;
+        int val, rc;
+
+        rc = lprocfs_write_helper(buffer, count, &val);
+        if (rc)
+                return rc;
+
+        spin_lock(&obd->obd_osfs_lock);
+        obd->u.filter.fo_raid_degraded = !!val;
+        spin_unlock(&obd->obd_osfs_lock);
         return count;
 }
 
@@ -363,6 +406,9 @@ static struct lprocfs_vars lprocfs_filter_obd_vars[] = {
         { "read_cache_enable", lprocfs_filter_rd_cache, lprocfs_filter_wr_cache, 0},
         { "writethrough_cache_enable", lprocfs_filter_rd_wcache,
                           lprocfs_filter_wr_wcache, 0},
+        { "mds_sync",     lprocfs_filter_rd_mds_sync, 0, 0},
+        { "degraded",     lprocfs_filter_rd_degraded,
+                          lprocfs_filter_wr_degraded, 0 },
         { 0 }
 };
 
@@ -375,7 +421,6 @@ void filter_tally(struct obd_export *exp, struct page **pages, int nr_pages,
                   unsigned long *blocks, int blocks_per_page, int wr)
 {
         struct filter_obd *filter = &exp->exp_obd->u.filter;
-        struct filter_export_data *fed = &exp->exp_filter_data;
         struct page *last_page = NULL;
         unsigned long *last_block = NULL;
         unsigned long discont_pages = 0;
@@ -387,8 +432,6 @@ void filter_tally(struct obd_export *exp, struct page **pages, int nr_pages,
 
         lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_R_PAGES + wr],
                               nr_pages);
-        lprocfs_oh_tally_log2(&fed->fed_brw_stats.hist[BRW_R_PAGES + wr],
-                              nr_pages);
         if (exp->exp_nid_stats && exp->exp_nid_stats->nid_brw_stats)
                 lprocfs_oh_tally_log2(&exp->exp_nid_stats->nid_brw_stats->
                                         hist[BRW_R_PAGES + wr], nr_pages);
@@ -407,12 +450,8 @@ void filter_tally(struct obd_export *exp, struct page **pages, int nr_pages,
 
         lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_PAGES +wr],
                          discont_pages);
-        lprocfs_oh_tally(&fed->fed_brw_stats.hist[BRW_R_DISCONT_PAGES + wr],
-                         discont_pages);
         lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_BLOCKS+wr],
                          discont_blocks);
-        lprocfs_oh_tally(&fed->fed_brw_stats.hist[BRW_R_DISCONT_BLOCKS + wr],
-                         discont_blocks);
 
         if (exp->exp_nid_stats && exp->exp_nid_stats->nid_brw_stats) {
                 lprocfs_oh_tally_log2(&exp->exp_nid_stats->nid_brw_stats->
@@ -540,30 +579,6 @@ int lproc_filter_attach_seqstat(struct obd_device *dev)
                                       &filter_brw_stats_fops, dev);
 }
 
-static int filter_per_export_stats_seq_show(struct seq_file *seq, void *v)
-{
-        struct filter_export_data *fed = seq->private;
-
-        brw_stats_show(seq, &fed->fed_brw_stats);
-
-        return 0;
-}
-
-static ssize_t filter_per_export_stats_seq_write(struct file *file,
-                                       const char *buf, size_t len, loff_t *off)
-{
-        struct seq_file *seq = file->private_data;
-        struct filter_export_data *fed = seq->private;
-        int i;
-
-        for (i = 0; i < BRW_LAST; i++)
-                lprocfs_oh_clear(&fed->fed_brw_stats.hist[i]);
-
-        return len;
-}
-
-LPROC_SEQ_FOPS(filter_per_export_stats);
-
 void lprocfs_filter_init_vars(struct lprocfs_static_vars *lvars)
 {
     lvars->module_vars  = lprocfs_filter_module_vars;
@@ -572,10 +587,10 @@ void lprocfs_filter_init_vars(struct lprocfs_static_vars *lvars)
 
 static int filter_per_nid_stats_seq_show(struct seq_file *seq, void *v)
 {
-        nid_stat_t *tmp = seq->private;
+        nid_stat_t * stat = seq->private;
 
-        if (tmp->nid_brw_stats)
-                brw_stats_show(seq, tmp->nid_brw_stats);
+        if (stat->nid_brw_stats)
+                brw_stats_show(seq, stat->nid_brw_stats);
 
         return 0;
 }
@@ -584,13 +599,13 @@ static ssize_t filter_per_nid_stats_seq_write(struct file *file,
                                               const char *buf, size_t len,
                                               loff_t *off)
 {
-        struct seq_file *seq = file->private_data;
-        nid_stat_t *tmp = seq->private;
+        struct seq_file *seq  = file->private_data;
+        nid_stat_t      *stat = seq->private;
         int i;
 
-        if (tmp->nid_brw_stats)
+        if (stat->nid_brw_stats)
                 for (i = 0; i < BRW_LAST; i++)
-                        lprocfs_oh_clear(&tmp->nid_brw_stats->hist[i]);
+                        lprocfs_oh_clear(&stat->nid_brw_stats->hist[i]);
 
         return len;
 }