]> err.no Git - linux-2.6/blobdiff - include/linux/elevator.h
[PATCH] ext4: uninitialised extent handling
[linux-2.6] / include / linux / elevator.h
index cc81645a3e1871cce19b10c7303673f01bc56fa0..b3370ef5164d0589d3300e91162c0b5599045de1 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef _LINUX_ELEVATOR_H
 #define _LINUX_ELEVATOR_H
 
+#include <linux/percpu.h>
+
+#ifdef CONFIG_BLOCK
+
 typedef int (elevator_merge_fn) (request_queue_t *, struct request **,
                                 struct bio *);
 
@@ -178,4 +182,28 @@ enum {
        INIT_LIST_HEAD(&(rq)->donelist);        \
        } while (0)
 
+/*
+ * io context count accounting
+ */
+#define elv_ioc_count_mod(name, __val)                         \
+       do {                                                    \
+               preempt_disable();                              \
+               __get_cpu_var(name) += (__val);                 \
+               preempt_enable();                               \
+       } while (0)
+
+#define elv_ioc_count_inc(name)        elv_ioc_count_mod(name, 1)
+#define elv_ioc_count_dec(name)        elv_ioc_count_mod(name, -1)
+
+#define elv_ioc_count_read(name)                               \
+({                                                             \
+       unsigned long __val = 0;                                \
+       int __cpu;                                              \
+       smp_wmb();                                              \
+       for_each_possible_cpu(__cpu)                            \
+               __val += per_cpu(name, __cpu);                  \
+       __val;                                                  \
+})
+
+#endif /* CONFIG_BLOCK */
 #endif