xfs: cleanup ->sync_fs
Sort out ->sync_fs to not perform a superblock writeback for the wait = 0 case as that is just an optional first pass and the superblock will be written back properly in the next call with wait = 1. Instead perform an opportunistic quota writeback to have less work later. Also remove the freeze special case as we do a proper wait = 1 call in the freeze code anyway. Also rename the function to xfs_fs_sync_fs to match the normal naming convention, update comments and avoid calling into the laptop_mode logic on an error. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
This commit is contained in:
parent
c90b07e8dd
commit
69961a26b8
|
@ -1148,7 +1148,7 @@ xfs_fs_put_super(
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_fs_sync_super(
|
xfs_fs_sync_fs(
|
||||||
struct super_block *sb,
|
struct super_block *sb,
|
||||||
int wait)
|
int wait)
|
||||||
{
|
{
|
||||||
|
@ -1156,23 +1156,23 @@ xfs_fs_sync_super(
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Treat a sync operation like a freeze. This is to work
|
* Not much we can do for the first async pass. Writing out the
|
||||||
* around a race in sync_inodes() which works in two phases
|
* superblock would be counter-productive as we are going to redirty
|
||||||
* - an asynchronous flush, which can write out an inode
|
* when writing out other data and metadata (and writing out a single
|
||||||
* without waiting for file size updates to complete, and a
|
* block is quite fast anyway).
|
||||||
* synchronous flush, which wont do anything because the
|
*
|
||||||
* async flush removed the inode's dirty flag. Also
|
* Try to asynchronously kick off quota syncing at least.
|
||||||
* sync_inodes() will not see any files that just have
|
|
||||||
* outstanding transactions to be flushed because we don't
|
|
||||||
* dirty the Linux inode until after the transaction I/O
|
|
||||||
* completes.
|
|
||||||
*/
|
*/
|
||||||
if (wait || unlikely(sb->s_frozen == SB_FREEZE_WRITE))
|
if (!wait) {
|
||||||
error = xfs_quiesce_data(mp);
|
xfs_qm_sync(mp, SYNC_TRYLOCK);
|
||||||
else
|
return 0;
|
||||||
error = xfs_sync_fsdata(mp, 0);
|
}
|
||||||
|
|
||||||
if (unlikely(laptop_mode)) {
|
error = xfs_quiesce_data(mp);
|
||||||
|
if (error)
|
||||||
|
return -error;
|
||||||
|
|
||||||
|
if (laptop_mode) {
|
||||||
int prev_sync_seq = mp->m_sync_seq;
|
int prev_sync_seq = mp->m_sync_seq;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1191,7 +1191,7 @@ xfs_fs_sync_super(
|
||||||
mp->m_sync_seq != prev_sync_seq);
|
mp->m_sync_seq != prev_sync_seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -error;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC int
|
STATIC int
|
||||||
|
@ -1565,7 +1565,7 @@ static struct super_operations xfs_super_operations = {
|
||||||
.write_inode = xfs_fs_write_inode,
|
.write_inode = xfs_fs_write_inode,
|
||||||
.clear_inode = xfs_fs_clear_inode,
|
.clear_inode = xfs_fs_clear_inode,
|
||||||
.put_super = xfs_fs_put_super,
|
.put_super = xfs_fs_put_super,
|
||||||
.sync_fs = xfs_fs_sync_super,
|
.sync_fs = xfs_fs_sync_fs,
|
||||||
.freeze_fs = xfs_fs_freeze,
|
.freeze_fs = xfs_fs_freeze,
|
||||||
.statfs = xfs_fs_statfs,
|
.statfs = xfs_fs_statfs,
|
||||||
.remount_fs = xfs_fs_remount,
|
.remount_fs = xfs_fs_remount,
|
||||||
|
|
Loading…
Reference in New Issue