Whamcloud - gitweb
b=19400
[fs/lustre-release.git] / lustre / include / lprocfs_status.h
index 3056bd0..abac33c 100644 (file)
@@ -165,9 +165,11 @@ struct lprocfs_percpu {
 #define LPROCFS_GET_SMP_ID  0x0002
 
 enum lprocfs_stats_flags {
-        LPROCFS_STATS_FLAG_PERCPU   = 0x0000, /* per cpu counter */
+        LPROCFS_STATS_FLAG_NONE     = 0x0000, /* per cpu counter */
         LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
                                                * area and need locking */
+        LPROCFS_STATS_GET_SMP_ID    = 0x0002, /* just record locking with
+                                               * LPROCFS_GET_SMP_ID flag */
 };
 
 enum lprocfs_fields_flags {
@@ -354,8 +356,10 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int type)
         } else {
                 if (type & LPROCFS_GET_NUM_CPU)
                         rc = num_possible_cpus();
-                if (type & LPROCFS_GET_SMP_ID)
-                        rc = smp_processor_id();
+                if (type & LPROCFS_GET_SMP_ID) {
+                       stats->ls_flags |= LPROCFS_STATS_GET_SMP_ID;
+                        rc = cfs_get_cpu();
+               }
         }
         return rc;
 }
@@ -364,6 +368,8 @@ static inline void lprocfs_stats_unlock(struct lprocfs_stats *stats)
 {
         if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
                 spin_unlock(&stats->ls_lock);
+       else if (stats->ls_flags & LPROCFS_STATS_GET_SMP_ID)
+               cfs_put_cpu();
 }
 
 /* Two optimized LPROCFS counter increment functions are provided:
@@ -491,6 +497,8 @@ extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
                                 int count, int *eof, void *data);
 extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
                              int *eof, void *data);
+extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
+                            int *eof, void *data);
 extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
                                     int count, int *eof, void *data);
 extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
@@ -540,11 +548,9 @@ void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);
 void lprocfs_oh_clear(struct obd_histogram *oh);
 unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
 
-/* lprocfs_status.c: counter read/write functions */
-extern int lprocfs_counter_read(char *page, char **start, off_t off,
-                                int count, int *eof, void *data);
-extern int lprocfs_counter_write(struct file *file, const char *buffer,
-                                 unsigned long count, void *data);
+void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
+                           struct lprocfs_counter *cnt);
+
 
 /* lprocfs_status.c: recovery status */
 int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
@@ -804,8 +810,12 @@ static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
 static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
                                        int count, int *eof, void *data)
 { return 0; }
-static inline int lprocfs_rd_import(char *page, char **start, off_t off, int count,
-                                    int *eof, void *data) { return 0; }
+static inline int lprocfs_rd_import(char *page, char **start, off_t off,
+                                    int count, int *eof, void *data)
+{ return 0; }
+static inline int lprocfs_rd_state(char *page, char **start, off_t off,
+                                   int count, int *eof, void *data)
+{ return 0; }
 static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
                                            int count, int *eof, void *data)
 { return 0; }
@@ -864,11 +874,8 @@ void lprocfs_oh_clear(struct obd_histogram *oh) {}
 static inline
 unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }
 static inline
-int lprocfs_counter_read(char *page, char **start, off_t off,
-                         int count, int *eof, void *data) { return 0; }
-static inline
-int lprocfs_counter_write(struct file *file, const char *buffer,
-                          unsigned long count, void *data) { return 0; }
+void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
+                           struct lprocfs_counter *cnt) {}
 
 static inline
 __u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,