#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 {
} 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;
}
{
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:
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,
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,
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; }
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,