Commit 8a1706c3 authored by Stephen Lord's avatar Stephen Lord

[XFS] clean up the flush logic some more, make the inode flush path less

lossy since we now depend on it. Add a sync_fs callout which waits
for flush to be done.

SGI Modid: 2.5.x-xfs:slinx:155186a
parent 8e3724ac
......@@ -506,6 +506,19 @@ linvfs_write_super(
sb->s_dirt = 0;
}
STATIC int
linvfs_sync_super(
struct super_block *sb)
{
vfs_t *vfsp = LINVFS_GET_VFS(sb);
int error;
VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_WAIT, NULL, error);
sb->s_dirt = 0;
return -error;
}
STATIC int
linvfs_statfs(
struct super_block *sb,
......@@ -798,6 +811,7 @@ STATIC struct super_operations linvfs_sops = {
.clear_inode = linvfs_clear_inode,
.put_super = linvfs_put_super,
.write_super = linvfs_write_super,
.sync_fs = linvfs_sync_super,
.write_super_lockfs = linvfs_freeze_fs,
.unlockfs = linvfs_unfreeze_fs,
.statfs = linvfs_statfs,
......
......@@ -1506,7 +1506,7 @@ xfs_syncsub(
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
error = xfs_trans_commit(tp, 0, NULL);
xfs_iunlock(ip, XFS_ILOCK_EXCL);
xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
xfs_log_force(mp, (xfs_lsn_t)0, log_flags);
}
/*
......
......@@ -3730,9 +3730,7 @@ xfs_inode_flush(
int flags)
{
xfs_inode_t *ip;
xfs_dinode_t *dip;
xfs_mount_t *mp;
xfs_buf_t *bp;
int error = 0;
ip = XFS_BHVTOI(bdp);
......@@ -3778,44 +3776,30 @@ xfs_inode_flush(
* now, they get caught later by xfs_sync.
*/
if (flags & FLUSH_INODE) {
if (xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
if ((xfs_ipincount(ip) == 0) && xfs_iflock_nowait(ip)) {
int flush_flags;
int flush_flags;
#if 0
/* not turning this on until some
* performance analysis is done
*/
if (flags & FLUSH_SYNC)
flush_flags = XFS_IFLUSH_SYNC;
else
#endif
flush_flags = XFS_IFLUSH_DELWRI_ELSE_ASYNC;
if (xfs_ipincount(ip))
return EAGAIN;
xfs_ifunlock(ip);
if (flags & FLUSH_SYNC) {
xfs_ilock(ip, XFS_ILOCK_SHARED);
xfs_iflock(ip);
} else if (xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip)) {
xfs_iunlock(ip, XFS_ILOCK_SHARED);
error = xfs_itobp(mp, NULL, ip, &dip, &bp, 0);
if (error)
return error;
xfs_buf_relse(bp);
if (xfs_ilock_nowait(ip, XFS_ILOCK_SHARED) == 0)
return EAGAIN;
if (xfs_ipincount(ip) ||
!xfs_iflock_nowait(ip)) {
xfs_iunlock(ip, XFS_ILOCK_SHARED);
return EAGAIN;
}
error = xfs_iflush(ip, flush_flags);
} else {
error = EAGAIN;
return EAGAIN;
}
xfs_iunlock(ip, XFS_ILOCK_SHARED);
} else {
error = EAGAIN;
return EAGAIN;
}
if (flags & FLUSH_SYNC)
flush_flags = XFS_IFLUSH_SYNC;
else
flush_flags = XFS_IFLUSH_ASYNC;
error = xfs_iflush(ip, flush_flags);
xfs_iunlock(ip, XFS_ILOCK_SHARED);
}
return error;
......
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