diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-12-16 01:08:41 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-12-16 01:08:41 -0500 |
commit | 1a427ab0c1b205d1bda8da0b77ea9d295ac23c57 (patch) | |
tree | dc0fffd22282d0da29da43b3ebdeed7c3f5fac1d /fs/xfs | |
parent | 1a3e8f3da09c7082d25b512a0ffe569391e4c09a (diff) |
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: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_ag.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 10 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index fd38682da851..a02480de9759 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -620,12 +620,12 @@ xfs_inode_set_reclaim_tag( | |||
620 | struct xfs_perag *pag; | 620 | struct xfs_perag *pag; |
621 | 621 | ||
622 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); | 622 | pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); |
623 | write_lock(&pag->pag_ici_lock); | 623 | spin_lock(&pag->pag_ici_lock); |
624 | spin_lock(&ip->i_flags_lock); | 624 | spin_lock(&ip->i_flags_lock); |
625 | __xfs_inode_set_reclaim_tag(pag, ip); | 625 | __xfs_inode_set_reclaim_tag(pag, ip); |
626 | __xfs_iflags_set(ip, XFS_IRECLAIMABLE); | 626 | __xfs_iflags_set(ip, XFS_IRECLAIMABLE); |
627 | spin_unlock(&ip->i_flags_lock); | 627 | spin_unlock(&ip->i_flags_lock); |
628 | write_unlock(&pag->pag_ici_lock); | 628 | spin_unlock(&pag->pag_ici_lock); |
629 | xfs_perag_put(pag); | 629 | xfs_perag_put(pag); |
630 | } | 630 | } |
631 | 631 | ||
@@ -833,12 +833,12 @@ reclaim: | |||
833 | * added to the tree assert that it's been there before to catch | 833 | * added to the tree assert that it's been there before to catch |
834 | * problems with the inode life time early on. | 834 | * problems with the inode life time early on. |
835 | */ | 835 | */ |
836 | write_lock(&pag->pag_ici_lock); | 836 | spin_lock(&pag->pag_ici_lock); |
837 | if (!radix_tree_delete(&pag->pag_ici_root, | 837 | if (!radix_tree_delete(&pag->pag_ici_root, |
838 | XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino))) | 838 | XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino))) |
839 | ASSERT(0); | 839 | ASSERT(0); |
840 | __xfs_inode_clear_reclaim(pag, ip); | 840 | __xfs_inode_clear_reclaim(pag, ip); |
841 | write_unlock(&pag->pag_ici_lock); | 841 | spin_unlock(&pag->pag_ici_lock); |
842 | 842 | ||
843 | /* | 843 | /* |
844 | * Here we do an (almost) spurious inode lock in order to coordinate | 844 | * Here we do an (almost) spurious inode lock in order to coordinate |
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h index 63c7a1a6c022..58632cc17f2d 100644 --- a/fs/xfs/xfs_ag.h +++ b/fs/xfs/xfs_ag.h | |||
@@ -227,7 +227,7 @@ typedef struct xfs_perag { | |||
227 | 227 | ||
228 | atomic_t pagf_fstrms; /* # of filestreams active in this AG */ | 228 | atomic_t pagf_fstrms; /* # of filestreams active in this AG */ |
229 | 229 | ||
230 | rwlock_t pag_ici_lock; /* incore inode lock */ | 230 | spinlock_t pag_ici_lock; /* incore inode cache lock */ |
231 | struct radix_tree_root pag_ici_root; /* incore inode cache root */ | 231 | struct radix_tree_root pag_ici_root; /* incore inode cache root */ |
232 | int pag_ici_reclaimable; /* reclaimable inodes */ | 232 | int pag_ici_reclaimable; /* reclaimable inodes */ |
233 | struct mutex pag_ici_reclaim_lock; /* serialisation point */ | 233 | struct mutex pag_ici_reclaim_lock; /* serialisation point */ |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 04ed09b907b8..3ecad00e8409 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -260,7 +260,7 @@ xfs_iget_cache_hit( | |||
260 | goto out_error; | 260 | goto out_error; |
261 | } | 261 | } |
262 | 262 | ||
263 | write_lock(&pag->pag_ici_lock); | 263 | spin_lock(&pag->pag_ici_lock); |
264 | spin_lock(&ip->i_flags_lock); | 264 | spin_lock(&ip->i_flags_lock); |
265 | ip->i_flags &= ~(XFS_IRECLAIMABLE | XFS_IRECLAIM); | 265 | ip->i_flags &= ~(XFS_IRECLAIMABLE | XFS_IRECLAIM); |
266 | ip->i_flags |= XFS_INEW; | 266 | ip->i_flags |= XFS_INEW; |
@@ -273,7 +273,7 @@ xfs_iget_cache_hit( | |||
273 | &xfs_iolock_active, "xfs_iolock_active"); | 273 | &xfs_iolock_active, "xfs_iolock_active"); |
274 | 274 | ||
275 | spin_unlock(&ip->i_flags_lock); | 275 | spin_unlock(&ip->i_flags_lock); |
276 | write_unlock(&pag->pag_ici_lock); | 276 | spin_unlock(&pag->pag_ici_lock); |
277 | } else { | 277 | } else { |
278 | /* If the VFS inode is being torn down, pause and try again. */ | 278 | /* If the VFS inode is being torn down, pause and try again. */ |
279 | if (!igrab(inode)) { | 279 | if (!igrab(inode)) { |
@@ -351,7 +351,7 @@ xfs_iget_cache_miss( | |||
351 | BUG(); | 351 | BUG(); |
352 | } | 352 | } |
353 | 353 | ||
354 | write_lock(&pag->pag_ici_lock); | 354 | spin_lock(&pag->pag_ici_lock); |
355 | 355 | ||
356 | /* insert the new inode */ | 356 | /* insert the new inode */ |
357 | error = radix_tree_insert(&pag->pag_ici_root, agino, ip); | 357 | error = radix_tree_insert(&pag->pag_ici_root, agino, ip); |
@@ -366,14 +366,14 @@ xfs_iget_cache_miss( | |||
366 | ip->i_udquot = ip->i_gdquot = NULL; | 366 | ip->i_udquot = ip->i_gdquot = NULL; |
367 | xfs_iflags_set(ip, XFS_INEW); | 367 | xfs_iflags_set(ip, XFS_INEW); |
368 | 368 | ||
369 | write_unlock(&pag->pag_ici_lock); | 369 | spin_unlock(&pag->pag_ici_lock); |
370 | radix_tree_preload_end(); | 370 | radix_tree_preload_end(); |
371 | 371 | ||
372 | *ipp = ip; | 372 | *ipp = ip; |
373 | return 0; | 373 | return 0; |
374 | 374 | ||
375 | out_preload_end: | 375 | out_preload_end: |
376 | write_unlock(&pag->pag_ici_lock); | 376 | spin_unlock(&pag->pag_ici_lock); |
377 | radix_tree_preload_end(); | 377 | radix_tree_preload_end(); |
378 | if (lock_flags) | 378 | if (lock_flags) |
379 | xfs_iunlock(ip, lock_flags); | 379 | xfs_iunlock(ip, lock_flags); |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 40579fdf0d0a..d447aef84bc3 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -472,7 +472,7 @@ xfs_initialize_perag( | |||
472 | goto out_unwind; | 472 | goto out_unwind; |
473 | pag->pag_agno = index; | 473 | pag->pag_agno = index; |
474 | pag->pag_mount = mp; | 474 | pag->pag_mount = mp; |
475 | rwlock_init(&pag->pag_ici_lock); | 475 | spin_lock_init(&pag->pag_ici_lock); |
476 | mutex_init(&pag->pag_ici_reclaim_lock); | 476 | mutex_init(&pag->pag_ici_reclaim_lock); |
477 | INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC); | 477 | INIT_RADIX_TREE(&pag->pag_ici_root, GFP_ATOMIC); |
478 | spin_lock_init(&pag->pag_buf_lock); | 478 | spin_lock_init(&pag->pag_buf_lock); |