diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-06-26 10:19:54 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-06-26 10:19:54 +1000 |
commit | 833eb04bbc0d8bf04c0b6d2f6071f8bae2f99573 (patch) | |
tree | f1859a455793c0f55514e39e77c6b03f0ee76485 | |
parent | 8d521aa2bf90485635f90e5f0c1daa1fc9f7e3ef (diff) |
misc:down_nowait-xfs
down_trylock -> down_try in xfs
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: xfs@oss.sgi.com
-rw-r--r-- | fs/xfs/linux-2.6/sema.h | 8 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/fs/xfs/linux-2.6/sema.h b/fs/xfs/linux-2.6/sema.h index 3abe7e9ceb33..7d20f0422c97 100644 --- a/fs/xfs/linux-2.6/sema.h +++ b/fs/xfs/linux-2.6/sema.h @@ -36,17 +36,15 @@ typedef struct semaphore sema_t; static inline int issemalocked(sema_t *sp) { - return down_trylock(sp) || (up(sp), 0); + return !down_try(sp) || (up(sp), 0); } /* - * Map cpsema (try to get the sema) to down_trylock. We need to switch - * the return values since cpsema returns 1 (acquired) 0 (failed) and - * down_trylock returns the reverse 0 (acquired) 1 (failed). + * Map cpsema (try to get the sema) to down_try. */ static inline int cpsema(sema_t *sp) { - return down_trylock(sp) ? 0 : 1; + return down_try(sp); } #endif /* __XFS_SUPPORT_SEMA_H__ */ diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 98e0e86093b4..4773fe0f774d 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c @@ -539,7 +539,7 @@ found: * if this does not work then we need to drop the * spinlock and do a hard attempt on the semaphore. */ - if (down_trylock(&bp->b_sema)) { + if (!down_try(&bp->b_sema)) { if (!(flags & XBF_TRYLOCK)) { /* wait for buffer ownership */ XB_TRACE(bp, "get_lock", 0); @@ -883,7 +883,7 @@ xfs_buf_cond_lock( { int locked; - locked = down_trylock(&bp->b_sema) == 0; + locked = down_try(&bp->b_sema); if (locked) { XB_SET_OWNER(bp); } |