LB_LINUX_CONFIG([MODVERSIONS])
-LB_LINUX_CONFIG([PREEMPT],[
- AC_MSG_ERROR([Lustre does not support kernels with preempt enabled.])
-])
-
LB_LINUX_CONFIG([KALLSYMS],[],[
if test "x$ARCH_UM" = "x" ; then
AC_MSG_ERROR([Lustre requires that CONFIG_KALLSYMS is enabled in your kernel.])
}
#endif
+#ifndef get_cpu
+# ifdef CONFIG_PREEMPT
+# define cfs_get_cpu() ({ preempt_disable(); smp_processor_id(); })
+# define cfs_put_cpu() preempt_enable()
+# else
+# define cfs_get_cpu() smp_processor_id()
+# define cfs_put_cpu()
+# endif
+#else
+# define cfs_get_cpu() get_cpu()
+# define cfs_put_cpu() put_cpu()
+#endif /* get_cpu & put_cpu */
#endif
#include <libcfs/libcfs.h>
#include "tracefile.h"
-#ifndef get_cpu
-#define get_cpu() smp_processor_id()
-#define put_cpu() do { } while (0)
-#endif
-
/* three types of trace_data in linux */
enum {
TCD_TYPE_PROC = 0,
char *
trace_get_console_buffer(void)
{
- int cpu = get_cpu();
+ int cpu = cfs_get_cpu();
int idx;
if (in_irq()) {
void
trace_put_console_buffer(char *buffer)
{
- put_cpu();
+ cfs_put_cpu();
}
struct trace_cpu_data *
struct trace_cpu_data *tcd;
int cpu;
- cpu = get_cpu();
+ cpu = cfs_get_cpu();
if (in_irq())
tcd = &(*trace_data[TCD_TYPE_IRQ])[cpu].tcd;
else if (in_softirq())
{
trace_unlock_tcd(tcd);
- put_cpu();
+ cfs_put_cpu();
}
int trace_lock_tcd(struct trace_cpu_data *tcd)
vfs_rename(old,old_dir,new,new_dir)
#endif
-#ifndef get_cpu
-#ifdef CONFIG_PREEMPT
-#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
-#define put_cpu() preempt_enable()
-#else
-#define get_cpu() smp_processor_id()
-#define put_cpu()
-#endif
-#endif /* get_cpu & put_cpu */
-
#ifndef for_each_possible_cpu
#define for_each_possible_cpu(i) for_each_cpu(i)
#endif
#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:
/* File operations stats */
sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
- LPROCFS_STATS_FLAG_PERCPU);
+ LPROCFS_STATS_FLAG_NONE);
if (sbi->ll_stats == NULL)
GOTO(out, err = -ENOMEM);
/* do counter init */
GOTO(out, err);
sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
- LPROCFS_STATS_FLAG_PERCPU);
+ LPROCFS_STATS_FLAG_NONE);
if (sbi->ll_ra_stats == NULL)
GOTO(out, err = -ENOMEM);
obd_zombie_impexp_init();
#ifdef LPROCFS
obd_memory = lprocfs_alloc_stats(OBD_STATS_NUM,
- LPROCFS_STATS_FLAG_PERCPU);
+ LPROCFS_STATS_FLAG_NONE);
if (obd_memory == NULL) {
CERROR("kmalloc of 'obd_memory' failed\n");
RETURN(-ENOMEM);