xfs: cleanup xfs_iunpin_wait/xfs_iunpin_nowait
Remove the inode item pointer and ili_last_lsn checks in __xfs_iunpin_wait as any pinned inode is guaranteed to have them valid. After this the xfs_iunpin_nowait case is nothing more than a xfs_log_force_lsn, as we know that the caller has already checked the pincount. Make xfs_iunpin_nowait the new low-level routine just doing the log force and rewrite xfs_iunpin_wait around it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
committed by
Alex Elder
parent
d7658d487f
commit
60ec678371
@@ -2467,47 +2467,31 @@ xfs_iunpin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is called to unpin an inode. It can be directed to wait or to return
|
* This is called to unpin an inode. The caller must have the inode locked
|
||||||
* immediately without waiting for the inode to be unpinned. The caller must
|
* in at least shared mode so that the buffer cannot be subsequently pinned
|
||||||
* have the inode locked in at least shared mode so that the buffer cannot be
|
* once someone is waiting for it to be unpinned.
|
||||||
* subsequently pinned once someone is waiting for it to be unpinned.
|
|
||||||
*/
|
*/
|
||||||
STATIC void
|
static void
|
||||||
__xfs_iunpin_wait(
|
xfs_iunpin_nowait(
|
||||||
xfs_inode_t *ip,
|
struct xfs_inode *ip)
|
||||||
int wait)
|
|
||||||
{
|
{
|
||||||
xfs_inode_log_item_t *iip = ip->i_itemp;
|
|
||||||
|
|
||||||
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
|
||||||
if (atomic_read(&ip->i_pincount) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Give the log a push to start the unpinning I/O */
|
/* Give the log a push to start the unpinning I/O */
|
||||||
if (iip && iip->ili_last_lsn)
|
xfs_log_force_lsn(ip->i_mount, ip->i_itemp->ili_last_lsn, 0);
|
||||||
xfs_log_force_lsn(ip->i_mount, iip->ili_last_lsn, 0);
|
|
||||||
else
|
|
||||||
xfs_log_force(ip->i_mount, 0);
|
|
||||||
|
|
||||||
if (wait)
|
|
||||||
wait_event(ip->i_ipin_wait, (atomic_read(&ip->i_pincount) == 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xfs_iunpin_wait(
|
xfs_iunpin_wait(
|
||||||
xfs_inode_t *ip)
|
struct xfs_inode *ip)
|
||||||
{
|
{
|
||||||
__xfs_iunpin_wait(ip, 1);
|
if (xfs_ipincount(ip)) {
|
||||||
|
xfs_iunpin_nowait(ip);
|
||||||
|
wait_event(ip->i_ipin_wait, (xfs_ipincount(ip) == 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
xfs_iunpin_nowait(
|
|
||||||
xfs_inode_t *ip)
|
|
||||||
{
|
|
||||||
__xfs_iunpin_wait(ip, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* xfs_iextents_copy()
|
* xfs_iextents_copy()
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user