Skip to content

Commit

Permalink
[XFS] Unwrap xfs_dabuf_global_lock
Browse files Browse the repository at this point in the history
Un-obfuscate dabuf_global_lock, remove mutex_lock->spin_lock macros, call
spin_lock directly, remove extraneous cookie holdover from old xfs code,
and change lock type to spinlock_t.

SGI-PV: 970382
SGI-Modid: xfs-linux-melb:xfs-kern:29744a

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Signed-off-by: Donald Douwsma <donaldd@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
  • Loading branch information
Eric Sandeen authored and Lachlan McIlroy committed Feb 7, 2008
1 parent 64137e5 commit 703e1f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions fs/xfs/xfs_da_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2218,7 +2218,7 @@ xfs_da_state_free(xfs_da_state_t *state)

#ifdef XFS_DABUF_DEBUG
xfs_dabuf_t *xfs_dabuf_global_list;
lock_t xfs_dabuf_global_lock;
spinlock_t xfs_dabuf_global_lock;
#endif

/*
Expand Down Expand Up @@ -2264,10 +2264,9 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra)
}
#ifdef XFS_DABUF_DEBUG
{
SPLDECL(s);
xfs_dabuf_t *p;

s = mutex_spinlock(&xfs_dabuf_global_lock);
spin_lock(&xfs_dabuf_global_lock);
for (p = xfs_dabuf_global_list; p; p = p->next) {
ASSERT(p->blkno != dabuf->blkno ||
p->target != dabuf->target);
Expand All @@ -2277,7 +2276,7 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra)
xfs_dabuf_global_list->prev = dabuf;
dabuf->next = xfs_dabuf_global_list;
xfs_dabuf_global_list = dabuf;
mutex_spinunlock(&xfs_dabuf_global_lock, s);
spin_unlock(&xfs_dabuf_global_lock);
}
#endif
return dabuf;
Expand Down Expand Up @@ -2319,16 +2318,14 @@ xfs_da_buf_done(xfs_dabuf_t *dabuf)
kmem_free(dabuf->data, BBTOB(dabuf->bbcount));
#ifdef XFS_DABUF_DEBUG
{
SPLDECL(s);

s = mutex_spinlock(&xfs_dabuf_global_lock);
spin_lock(&xfs_dabuf_global_lock);
if (dabuf->prev)
dabuf->prev->next = dabuf->next;
else
xfs_dabuf_global_list = dabuf->next;
if (dabuf->next)
dabuf->next->prev = dabuf->prev;
mutex_spinunlock(&xfs_dabuf_global_lock, s);
spin_unlock(&xfs_dabuf_global_lock);
}
memset(dabuf, 0, XFS_DA_BUF_SIZE(dabuf->nbuf));
#endif
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ xfs_init(void)
extern kmem_zone_t *xfs_buf_item_zone;
extern kmem_zone_t *xfs_dabuf_zone;
#ifdef XFS_DABUF_DEBUG
extern lock_t xfs_dabuf_global_lock;
extern spinlock_t xfs_dabuf_global_lock;
spinlock_init(&xfs_dabuf_global_lock, "xfsda");
#endif

Expand Down

0 comments on commit 703e1f0

Please sign in to comment.