[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1466398515-1005-6-git-send-email-byungchul.park@lge.com>
Date: Mon, 20 Jun 2016 13:55:15 +0900
From: Byungchul Park <byungchul.park@....com>
To: peterz@...radead.org, mingo@...nel.org
Cc: linux-kernel@...r.kernel.org, npiggin@...e.de,
sergey.senozhatsky@...il.com, gregkh@...uxfoundation.org,
minchan@...nel.org
Subject: [PATCH 5/5] lockdep: Apply bit_spin_lock lockdep to BH_Uptodate_Lock
In order to use lockdep-enabled bit_spin_lock, we have to call
bit_spin_init() when a instance including the bit used as lock
creates, and bit_spin_free() when the instance including the bit
destroys.
BH_Uptodate_Lock bit of buffer head's b_state is one of
bit_spin_lock users. And this patch adds bit_spin_init() and
bit_spin_free() properly to apply the lock correctness validator.
Signed-off-by: Byungchul Park <byungchul.park@....com>
---
fs/buffer.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/buffer.c b/fs/buffer.c
index a75ca74..65c0b8a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3317,6 +3317,7 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags)
if (ret) {
INIT_LIST_HEAD(&ret->b_assoc_buffers);
preempt_disable();
+ bit_spin_init(BH_Uptodate_Lock, &ret->b_state);
__this_cpu_inc(bh_accounting.nr);
recalc_bh_state();
preempt_enable();
@@ -3328,6 +3329,7 @@ EXPORT_SYMBOL(alloc_buffer_head);
void free_buffer_head(struct buffer_head *bh)
{
BUG_ON(!list_empty(&bh->b_assoc_buffers));
+ bit_spin_free(BH_Uptodate_Lock, &bh->b_state);
kmem_cache_free(bh_cachep, bh);
preempt_disable();
__this_cpu_dec(bh_accounting.nr);
--
1.9.1
Powered by blists - more mailing lists