Commit ebb9a9ae authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

tools: add WARN_ON_ONCE

Patch series "Radix tree patches for 4.10", v3.

Mostly these are improvements; the only bug fixes in here relate to
multiorder entries (which are unused in the 4.9 tree).

This patch (of 32):

The radix tree uses its own buggy WARN_ON_ONCE.  Replace it with the
definition from asm-generic/bug.h

Link: http://lkml.kernel.org/r/1480369871-5271-37-git-send-email-mawilcox@linuxonhyperv.comSigned-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
Tested-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4b4bb46d
...@@ -12,6 +12,17 @@ ...@@ -12,6 +12,17 @@
unlikely(__ret_warn_on); \ unlikely(__ret_warn_on); \
}) })
#define WARN_ON_ONCE(condition) ({ \
static int __warned; \
int __ret_warn_once = !!(condition); \
\
if (unlikely(__ret_warn_once && !__warned)) { \
__warned = true; \
WARN_ON(1); \
} \
unlikely(__ret_warn_once); \
})
#define WARN_ONCE(condition, format...) ({ \ #define WARN_ONCE(condition, format...) ({ \
static int __warned; \ static int __warned; \
int __ret_warn_once = !!(condition); \ int __ret_warn_once = !!(condition); \
......
CFLAGS += -I. -g -O2 -Wall -D_LGPL_SOURCE CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE
LDFLAGS += -lpthread -lurcu LDFLAGS += -lpthread -lurcu
TARGETS = main TARGETS = main
OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \ OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \
......
#define WARN_ON_ONCE(x) assert(x) #include "asm/bug.h"
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#define __rcu #define __rcu
#define __read_mostly #define __read_mostly
#define BITS_PER_LONG (sizeof(long) * 8)
static inline void INIT_LIST_HEAD(struct list_head *list) static inline void INIT_LIST_HEAD(struct list_head *list)
{ {
list->next = list; list->next = list;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment