From 18865345233fa676a2a64cff87dedca4251192cb Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 14 May 2014 10:02:19 +1000 Subject: [PATCH] fs-buffer-do-not-use-unnecessary-atomic-operations-when-discarding-buffers-fix move BUFFER_FLAGS_DISCARD into the .c file Cc: Mel Gorman Cc: Johannes Weiner Cc: Vlastimil Babka Cc: Jan Kara Cc: Michal Hocko Cc: Hugh Dickins Cc: Dave Hansen Cc: Theodore Ts'o Cc: "Paul E. McKenney" Cc: Oleg Nesterov Cc: Rik van Riel Cc: Peter Zijlstra Signed-off-by: Andrew Morton --- fs/buffer.c | 9 ++++++++- include/linux/buffer_head.h | 5 ----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index cd3aafe613a3..b00b05b38531 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1483,6 +1483,12 @@ EXPORT_SYMBOL(set_bh_page); /* * Called when truncating a buffer on a page completely. */ + +/* Bits that are cleared during an invalidate */ +#define BUFFER_FLAGS_DISCARD \ + (1 << BH_Mapped | 1 << BH_New | 1 << BH_Req | \ + 1 << BH_Delay | 1 << BH_Unwritten) + static void discard_buffer(struct buffer_head * bh) { unsigned long b_state, b_state_old; @@ -1492,7 +1498,8 @@ static void discard_buffer(struct buffer_head * bh) bh->b_bdev = NULL; b_state = bh->b_state; for (;;) { - b_state_old = cmpxchg(&bh->b_state, b_state, (b_state & ~BUFFER_FLAGS_DISCARD)); + b_state_old = cmpxchg(&bh->b_state, b_state, + (b_state & ~BUFFER_FLAGS_DISCARD)); if (b_state_old == b_state) break; b_state = b_state_old; diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 54cf52a36a6f..e05c7ecdb24d 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -77,11 +77,6 @@ struct buffer_head { atomic_t b_count; /* users using this buffer_head */ }; -/* Bits that are cleared during an invalidate */ -#define BUFFER_FLAGS_DISCARD \ - (1 << BH_Mapped | 1 << BH_New | 1 << BH_Req | \ - 1 << BH_Delay | 1 << BH_Unwritten) - /* * macro tricks to expand the set_buffer_foo(), clear_buffer_foo() * and buffer_foo() functions. -- 2.39.5