diff options
author | Christoph Hellwig <hch@lst.de> | 2011-07-08 08:36:19 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2011-07-08 08:36:19 -0400 |
commit | 0c842ad46a51891ac4420b7285613f4134a65ccd (patch) | |
tree | cf82cc7853821a21998114d20b1297b14061eade /fs/xfs/xfs_mount.c | |
parent | bbb4197c73be356a052dac25cce5ed0c157c6c90 (diff) |
xfs: clean up buffer locking helpers
Rename xfs_buf_cond_lock and reverse it's return value to fit most other
trylock operations in the Kernel and XFS (with the exception of down_trylock,
after which xfs_buf_cond_lock was modelled), and replace xfs_buf_lock_val
with an xfs_buf_islocked for use in asserts, or and opencoded variant in
tracing. remove the XFS_BUF_* wrappers for all the locking helpers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 63659ee316bd..77ffe3ce71fe 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -1941,22 +1941,19 @@ unwind: | |||
1941 | * the superblock buffer if it can be locked without sleeping. | 1941 | * the superblock buffer if it can be locked without sleeping. |
1942 | * If it can't then we'll return NULL. | 1942 | * If it can't then we'll return NULL. |
1943 | */ | 1943 | */ |
1944 | xfs_buf_t * | 1944 | struct xfs_buf * |
1945 | xfs_getsb( | 1945 | xfs_getsb( |
1946 | xfs_mount_t *mp, | 1946 | struct xfs_mount *mp, |
1947 | int flags) | 1947 | int flags) |
1948 | { | 1948 | { |
1949 | xfs_buf_t *bp; | 1949 | struct xfs_buf *bp = mp->m_sb_bp; |
1950 | 1950 | ||
1951 | ASSERT(mp->m_sb_bp != NULL); | 1951 | if (!xfs_buf_trylock(bp)) { |
1952 | bp = mp->m_sb_bp; | 1952 | if (flags & XBF_TRYLOCK) |
1953 | if (flags & XBF_TRYLOCK) { | ||
1954 | if (!XFS_BUF_CPSEMA(bp)) { | ||
1955 | return NULL; | 1953 | return NULL; |
1956 | } | 1954 | xfs_buf_lock(bp); |
1957 | } else { | ||
1958 | XFS_BUF_PSEMA(bp, PRIBIO); | ||
1959 | } | 1955 | } |
1956 | |||
1960 | XFS_BUF_HOLD(bp); | 1957 | XFS_BUF_HOLD(bp); |
1961 | ASSERT(XFS_BUF_ISDONE(bp)); | 1958 | ASSERT(XFS_BUF_ISDONE(bp)); |
1962 | return bp; | 1959 | return bp; |