aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iget.c
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-08-13 02:41:16 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-08-13 02:41:16 -0400
commitc63942d3eeffb98219e05d0976862ab9907d297d (patch)
tree2f00c2aa9df30c3e91c06aa46c5722382093c5de /fs/xfs/xfs_iget.c
parent39d2f1ab2a36ac527a6c41cfe689f50c239eaca3 (diff)
[XFS] replace inode flush semaphore with a completion
Use the new completion flush code to implement the inode flush lock. Removes one of the final users of semaphores in the XFS code base. SGI-PV: 981498 SGI-Modid: xfs-linux-melb:xfs-kern:31817a Signed-off-by: David Chinner <david@fromorbit.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_iget.c')
-rw-r--r--fs/xfs/xfs_iget.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 539c2dd8eae8..e229e9e001c2 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -216,7 +216,14 @@ finish_inode:
216 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); 216 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino);
217 init_waitqueue_head(&ip->i_ipin_wait); 217 init_waitqueue_head(&ip->i_ipin_wait);
218 atomic_set(&ip->i_pincount, 0); 218 atomic_set(&ip->i_pincount, 0);
219 initnsema(&ip->i_flock, 1, "xfsfino"); 219
220 /*
221 * Because we want to use a counting completion, complete
222 * the flush completion once to allow a single access to
223 * the flush completion without blocking.
224 */
225 init_completion(&ip->i_flush);
226 complete(&ip->i_flush);
220 227
221 if (lock_flags) 228 if (lock_flags)
222 xfs_ilock(ip, lock_flags); 229 xfs_ilock(ip, lock_flags);
@@ -783,26 +790,3 @@ xfs_isilocked(
783} 790}
784#endif 791#endif
785 792
786/*
787 * The following three routines simply manage the i_flock
788 * semaphore embedded in the inode. This semaphore synchronizes
789 * processes attempting to flush the in-core inode back to disk.
790 */
791void
792xfs_iflock(xfs_inode_t *ip)
793{
794 psema(&(ip->i_flock), PINOD|PLTWAIT);
795}
796
797int
798xfs_iflock_nowait(xfs_inode_t *ip)
799{
800 return (cpsema(&(ip->i_flock)));
801}
802
803void
804xfs_ifunlock(xfs_inode_t *ip)
805{
806 ASSERT(issemalocked(&(ip->i_flock)));
807 vsema(&(ip->i_flock));
808}