aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/buffer_head.h
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2008-08-02 06:02:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-05 00:56:09 -0400
commitca5de404ff036a29b25e9a83f6919c9f606c5841 (patch)
tree474da867c4d4086313cee90cdc3560bb17fade96 /include/linux/buffer_head.h
parent529ae9aaa08378cfe2a4350bded76f32cc8ff0ce (diff)
fs: rename buffer trylock
Like the page lock change, this also requires name change, so convert the raw test_and_set bitop to a trylock. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/buffer_head.h')
-rw-r--r--include/linux/buffer_head.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 50cfe8ceb478..eadaab44015f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -115,7 +115,6 @@ BUFFER_FNS(Uptodate, uptodate)
115BUFFER_FNS(Dirty, dirty) 115BUFFER_FNS(Dirty, dirty)
116TAS_BUFFER_FNS(Dirty, dirty) 116TAS_BUFFER_FNS(Dirty, dirty)
117BUFFER_FNS(Lock, locked) 117BUFFER_FNS(Lock, locked)
118TAS_BUFFER_FNS(Lock, locked)
119BUFFER_FNS(Req, req) 118BUFFER_FNS(Req, req)
120TAS_BUFFER_FNS(Req, req) 119TAS_BUFFER_FNS(Req, req)
121BUFFER_FNS(Mapped, mapped) 120BUFFER_FNS(Mapped, mapped)
@@ -321,10 +320,15 @@ static inline void wait_on_buffer(struct buffer_head *bh)
321 __wait_on_buffer(bh); 320 __wait_on_buffer(bh);
322} 321}
323 322
323static inline int trylock_buffer(struct buffer_head *bh)
324{
325 return likely(!test_and_set_bit(BH_Lock, &bh->b_state));
326}
327
324static inline void lock_buffer(struct buffer_head *bh) 328static inline void lock_buffer(struct buffer_head *bh)
325{ 329{
326 might_sleep(); 330 might_sleep();
327 if (test_set_buffer_locked(bh)) 331 if (!trylock_buffer(bh))
328 __lock_buffer(bh); 332 __lock_buffer(bh);
329} 333}
330 334