[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>
This commit is contained in:
David Chinner
2008-08-13 16:41:16 +10:00
committed by Lachlan McIlroy
parent 39d2f1ab2a
commit c63942d3ee
4 changed files with 39 additions and 40 deletions

View File

@@ -216,7 +216,14 @@ finish_inode:
mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino);
init_waitqueue_head(&ip->i_ipin_wait);
atomic_set(&ip->i_pincount, 0);
initnsema(&ip->i_flock, 1, "xfsfino");
/*
* Because we want to use a counting completion, complete
* the flush completion once to allow a single access to
* the flush completion without blocking.
*/
init_completion(&ip->i_flush);
complete(&ip->i_flush);
if (lock_flags)
xfs_ilock(ip, lock_flags);
@@ -783,26 +790,3 @@ xfs_isilocked(
}
#endif
/*
* The following three routines simply manage the i_flock
* semaphore embedded in the inode. This semaphore synchronizes
* processes attempting to flush the in-core inode back to disk.
*/
void
xfs_iflock(xfs_inode_t *ip)
{
psema(&(ip->i_flock), PINOD|PLTWAIT);
}
int
xfs_iflock_nowait(xfs_inode_t *ip)
{
return (cpsema(&(ip->i_flock)));
}
void
xfs_ifunlock(xfs_inode_t *ip)
{
ASSERT(issemalocked(&(ip->i_flock)));
vsema(&(ip->i_flock));
}