Commit 1a427ab0 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: convert pag_ici_lock to a spin lock

now that we are using RCU protection for the inode cache lookups,
the lock is only needed on the modification side. Hence it is not
necessary for the lock to be a rwlock as there are no read side
holders anymore. Convert it to a spin lock to reflect it's exclusive
nature.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 1a3e8f3d
...@@ -620,12 +620,12 @@ xfs_inode_set_reclaim_tag( ...@@ -620,12 +620,12 @@ xfs_inode_set_reclaim_tag(
struct xfs_perag *pag; struct xfs_perag *pag;
pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
write_lock(&pag->pag_ici_lock); spin_lock(&pag->pag_ici_lock);
spin_lock(&ip->i_flags_lock); spin_lock(&ip->i_flags_lock);
__xfs_inode_set_reclaim_tag(pag, ip); __xfs_inode_set_reclaim_tag(pag, ip);
__xfs_iflags_set(ip, XFS_IRECLAIMABLE); __xfs_iflags_set(ip, XFS_IRECLAIMABLE);
spin_unlock(&ip->i_flags_lock); spin_unlock(&ip->i_flags_lock);
write_unlock(&pag->pag_ici_lock); spin_unlock(&pag->pag_ici_lock);
xfs_perag_put(pag); xfs_perag_put(pag);
} }
...@@ -833,12 +833,12 @@ xfs_reclaim_inode( ...@@ -833,12 +833,12 @@ xfs_reclaim_inode(
* added to the tree assert that it's been there before to catch * added to the tree assert that it's been there before to catch
* problems with the inode life time early on. * problems with the inode life time early on.
*/ */
write_lock(&pag->pag_ici_lock); spin_lock(&pag->pag_ici_lock);
if (!radix_tree_delete(&pag->pag_ici_root, if (!radix_tree_delete(&pag->pag_ici_root,
XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino))) XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino)))
ASSERT(0); ASSERT(0);
__xfs_inode_clear_reclaim(pag, ip); __xfs_inode_clear_reclaim(pag, ip);
write_unlock(&pag->pag_ici_lock); spin_unlock(&pag->pag_ici_lock);
/* /*
* Here we do an (almost) spurious inode lock in order to coordinate * Here we do an (almost) spurious inode lock in order to coordinate
......
...@@ -227,7 +227,7 @@ typedef struct xfs_perag { ...@@ -227,7 +227,7 @@ typedef struct xfs_perag {
atomic_t pagf_fstrms; /* # of filestreams active in this AG */ atomic_t pagf_fstrms; /* # of filestreams active in this AG */
rwlock_t pag_ici_lock; /* incore inode lock */ spinlock_t pag_ici_lock; /* incore inode cache lock */
struct radix_tree_root pag_ici_root; /* incore inode cache root */ struct radix_tree_root pag_ici_root; /* incore inode cache root */
int pag_ici_reclaimable; /* reclaimable inodes */ int pag_ici_reclaimable; /* reclaimable inodes */
struct mutex pag_ici_reclaim_lock; /* serialisation point */ struct mutex pag_ici_reclaim_lock; /* serialisation point */
......
...@@ -260,7 +260,7 @@ xfs_iget_cache_hit( ...@@ -260,7 +260,7 @@ xfs_iget_cache_hit(
goto out_error; goto out_error;
} }
write_lock(&pag->pag_ici_lock); spin_lock(&pag->pag_ici_lock);
spin_lock(&ip->i_flags_lock); spin_lock(&ip->i_flags_lock);
ip->i_flags &= ~(XFS_IRECLAIMABLE | XFS_IRECLAIM); ip->i_flags &= ~(XFS_IRECLAIMABLE | XFS_IRECLAIM);
ip->i_flags |= XFS_INEW; ip->i_flags |= XFS_INEW;
...@@ -273,7 +273,7 @@ xfs_iget_cache_hit( ...@@ -273,7 +273,7 @@ xfs_iget_cache_hit(
&xfs_iolock_active, "xfs_iolock_active"); &xfs_iolock_active, "xfs_iolock_active");
spin_unlock(&ip->i_flags_lock); spin_unlock(&ip->i_flags_lock);
write_unlock(&pag->pag_ici_lock); spin_unlock(&pag->pag_ici_lock);
} else { } else {
/* If the VFS inode is being torn down, pause and try again. */ /* If the VFS inode is being torn down, pause and try again. */
if (!igrab(inode)) { if (!igrab(inode)) {
...@@ -351,7 +351,7 @@ xfs_iget_cache_miss( ...@@ -351,7 +351,7 @@ xfs_iget_cache_miss(
BUG(); BUG();
} }
write_lock(&pag->pag_ici_lock); spin_lock(&pag->pag_ici_lock);
/* insert the new inode */ /* insert the new inode */
error = radix_tree_insert(&pag->pag_ici_root, agino, ip); error = radix_tree_insert(&pag->pag_ici_root, agino, ip);
...@@ -366,14 +366,14 @@ xfs_iget_cache_miss( ...@@ -366,14 +366,14 @@ xfs_iget_cache_miss(
ip->i_udquot = ip->i_gdquot = NULL; ip->i_udquot = ip->i_gdquot = NULL;
xfs_iflags_set(ip, XFS_INEW); xfs_iflags_set(ip, XFS_INEW);
write_unlock(&pag->pag_ici_lock); spin_unlock(&pag->pag_ici_lock);
radix_tree_preload_end(); radix_tree_preload_end();
*ipp = ip; *ipp = ip;
return 0; return 0;
out_preload_end: out_preload_end:
write_unlock(&pag->pag_ici_lock); spin_unlock(&pag->pag_ici_lock);
radix_tree_preload_end(); radix_tree_preload_end();
if (lock_flags) if (lock_flags)
xfs_iunlock(ip, lock_flags); xfs_iunlock(ip, lock_flags);
......
...@@ -472,7 +472,7 @@ xfs_initialize_perag( ...@@ -472,7 +472,7 @@ xfs_initialize_perag(
goto out_unwind; goto out_unwind;
pag->pag_agno = index; pag->pag_agno = index;
pag->pag_mount = mp; pag->pag_mount = mp;
rwlock_init(&pag->pag_ici_lock); spin_lock_init(&pag->pag_ici_lock);
mutex_init(&pag->pag_ici_reclaim_lock); mutex_init(&pag->pag_ici_reclaim_lock);
INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC); INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC);
spin_lock_init(&pag->pag_buf_lock); spin_lock_init(&pag->pag_buf_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment