diff options
author | Nick Piggin <npiggin@suse.de> | 2008-08-02 06:02:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-05 00:56:09 -0400 |
commit | ca5de404ff036a29b25e9a83f6919c9f606c5841 (patch) | |
tree | 474da867c4d4086313cee90cdc3560bb17fade96 /include/linux/buffer_head.h | |
parent | 529ae9aaa08378cfe2a4350bded76f32cc8ff0ce (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.h | 8 |
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) | |||
115 | BUFFER_FNS(Dirty, dirty) | 115 | BUFFER_FNS(Dirty, dirty) |
116 | TAS_BUFFER_FNS(Dirty, dirty) | 116 | TAS_BUFFER_FNS(Dirty, dirty) |
117 | BUFFER_FNS(Lock, locked) | 117 | BUFFER_FNS(Lock, locked) |
118 | TAS_BUFFER_FNS(Lock, locked) | ||
119 | BUFFER_FNS(Req, req) | 118 | BUFFER_FNS(Req, req) |
120 | TAS_BUFFER_FNS(Req, req) | 119 | TAS_BUFFER_FNS(Req, req) |
121 | BUFFER_FNS(Mapped, mapped) | 120 | BUFFER_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 | ||
323 | static inline int trylock_buffer(struct buffer_head *bh) | ||
324 | { | ||
325 | return likely(!test_and_set_bit(BH_Lock, &bh->b_state)); | ||
326 | } | ||
327 | |||
324 | static inline void lock_buffer(struct buffer_head *bh) | 328 | static 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 | ||