提交 cc92e7ac 编写于 作者: C Christoph Hellwig 提交者: Tim Shimmin

[XFS] growlock should be a mutex

m_growlock only needs plain binary mutex semantics, so use a struct mutex
instead of a semaphore for it.

SGI-PV: 968563
SGI-Modid: xfs-linux-melb:xfs-kern:29512a
Signed-off-by: NChristoph Hellwig <hch@infradead.org>
Signed-off-by: NDavid Chinner <dgc@sgi.com>
Signed-off-by: NTim Shimmin <tes@sgi.com>
上级 0adba536
...@@ -433,10 +433,10 @@ xfs_growfs_data( ...@@ -433,10 +433,10 @@ xfs_growfs_data(
xfs_growfs_data_t *in) xfs_growfs_data_t *in)
{ {
int error; int error;
if (!cpsema(&mp->m_growlock)) if (!mutex_trylock(&mp->m_growlock))
return XFS_ERROR(EWOULDBLOCK); return XFS_ERROR(EWOULDBLOCK);
error = xfs_growfs_data_private(mp, in); error = xfs_growfs_data_private(mp, in);
vsema(&mp->m_growlock); mutex_unlock(&mp->m_growlock);
return error; return error;
} }
...@@ -446,10 +446,10 @@ xfs_growfs_log( ...@@ -446,10 +446,10 @@ xfs_growfs_log(
xfs_growfs_log_t *in) xfs_growfs_log_t *in)
{ {
int error; int error;
if (!cpsema(&mp->m_growlock)) if (!mutex_trylock(&mp->m_growlock))
return XFS_ERROR(EWOULDBLOCK); return XFS_ERROR(EWOULDBLOCK);
error = xfs_growfs_log_private(mp, in); error = xfs_growfs_log_private(mp, in);
vsema(&mp->m_growlock); mutex_unlock(&mp->m_growlock);
return error; return error;
} }
......
...@@ -139,7 +139,7 @@ xfs_mount_init(void) ...@@ -139,7 +139,7 @@ xfs_mount_init(void)
AIL_LOCKINIT(&mp->m_ail_lock, "xfs_ail"); AIL_LOCKINIT(&mp->m_ail_lock, "xfs_ail");
spinlock_init(&mp->m_sb_lock, "xfs_sb"); spinlock_init(&mp->m_sb_lock, "xfs_sb");
mutex_init(&mp->m_ilock); mutex_init(&mp->m_ilock);
initnsema(&mp->m_growlock, 1, "xfs_grow"); mutex_init(&mp->m_growlock);
/* /*
* Initialize the AIL. * Initialize the AIL.
*/ */
...@@ -174,7 +174,7 @@ xfs_mount_free( ...@@ -174,7 +174,7 @@ xfs_mount_free(
AIL_LOCK_DESTROY(&mp->m_ail_lock); AIL_LOCK_DESTROY(&mp->m_ail_lock);
spinlock_destroy(&mp->m_sb_lock); spinlock_destroy(&mp->m_sb_lock);
mutex_destroy(&mp->m_ilock); mutex_destroy(&mp->m_ilock);
freesema(&mp->m_growlock); mutex_destroy(&mp->m_growlock);
if (mp->m_quotainfo) if (mp->m_quotainfo)
XFS_QM_DONE(mp); XFS_QM_DONE(mp);
......
...@@ -384,7 +384,7 @@ typedef struct xfs_mount { ...@@ -384,7 +384,7 @@ typedef struct xfs_mount {
uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */
struct xfs_perag *m_perag; /* per-ag accounting info */ struct xfs_perag *m_perag; /* per-ag accounting info */
struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */ struct rw_semaphore m_peraglock; /* lock for m_perag (pointer) */
sema_t m_growlock; /* growfs mutex */ struct mutex m_growlock; /* growfs mutex */
int m_fixedfsid[2]; /* unchanged for life of FS */ int m_fixedfsid[2]; /* unchanged for life of FS */
uint m_dmevmask; /* DMI events for this FS */ uint m_dmevmask; /* DMI events for this FS */
__uint64_t m_flags; /* global mount flags */ __uint64_t m_flags; /* global mount flags */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册