diff options
author | Christoph Hellwig <hch@infradead.org> | 2009-10-06 16:29:28 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2009-10-08 13:01:03 -0400 |
commit | 69961a26b82931601e07c9e3656bd90c598f2395 (patch) | |
tree | 0798e1feac2cebe0327affef4a63bdf6fd11ff02 /fs/xfs | |
parent | c90b07e8dd9f263d2e2af1d9648ba269f4d0d8fd (diff) |
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 1ea65b6e5ab6..eefea0d9d03d 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -1148,7 +1148,7 @@ xfs_fs_put_super( | |||
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | STATIC int | 1150 | STATIC int |
1151 | xfs_fs_sync_super( | 1151 | xfs_fs_sync_fs( |
1152 | struct super_block *sb, | 1152 | struct super_block *sb, |
1153 | int wait) | 1153 | int wait) |
1154 | { | 1154 | { |
@@ -1156,23 +1156,23 @@ xfs_fs_sync_super( | |||
1156 | int error; | 1156 | int error; |
1157 | 1157 | ||
1158 | /* | 1158 | /* |
1159 | * Treat a sync operation like a freeze. This is to work | 1159 | * Not much we can do for the first async pass. Writing out the |
1160 | * around a race in sync_inodes() which works in two phases | 1160 | * superblock would be counter-productive as we are going to redirty |
1161 | * - an asynchronous flush, which can write out an inode | 1161 | * when writing out other data and metadata (and writing out a single |
1162 | * without waiting for file size updates to complete, and a | 1162 | * block is quite fast anyway). |
1163 | * synchronous flush, which wont do anything because the | 1163 | * |
1164 | * async flush removed the inode's dirty flag. Also | 1164 | * Try to asynchronously kick off quota syncing at least. |
1165 | * sync_inodes() will not see any files that just have | ||
1166 | * outstanding transactions to be flushed because we don't | ||
1167 | * dirty the Linux inode until after the transaction I/O | ||
1168 | * completes. | ||
1169 | */ | 1165 | */ |
1170 | if (wait || unlikely(sb->s_frozen == SB_FREEZE_WRITE)) | 1166 | if (!wait) { |
1171 | error = xfs_quiesce_data(mp); | 1167 | xfs_qm_sync(mp, SYNC_TRYLOCK); |
1172 | else | 1168 | return 0; |
1173 | error = xfs_sync_fsdata(mp, 0); | 1169 | } |
1170 | |||
1171 | error = xfs_quiesce_data(mp); | ||
1172 | if (error) | ||
1173 | return -error; | ||
1174 | 1174 | ||
1175 | if (unlikely(laptop_mode)) { | 1175 | if (laptop_mode) { |
1176 | int prev_sync_seq = mp->m_sync_seq; | 1176 | int prev_sync_seq = mp->m_sync_seq; |
1177 | 1177 | ||
1178 | /* | 1178 | /* |
@@ -1191,7 +1191,7 @@ xfs_fs_sync_super( | |||
1191 | mp->m_sync_seq != prev_sync_seq); | 1191 | mp->m_sync_seq != prev_sync_seq); |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | return -error; | 1194 | return 0; |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | STATIC int | 1197 | STATIC int |
@@ -1565,7 +1565,7 @@ static struct super_operations xfs_super_operations = { | |||
1565 | .write_inode = xfs_fs_write_inode, | 1565 | .write_inode = xfs_fs_write_inode, |
1566 | .clear_inode = xfs_fs_clear_inode, | 1566 | .clear_inode = xfs_fs_clear_inode, |
1567 | .put_super = xfs_fs_put_super, | 1567 | .put_super = xfs_fs_put_super, |
1568 | .sync_fs = xfs_fs_sync_super, | 1568 | .sync_fs = xfs_fs_sync_fs, |
1569 | .freeze_fs = xfs_fs_freeze, | 1569 | .freeze_fs = xfs_fs_freeze, |
1570 | .statfs = xfs_fs_statfs, | 1570 | .statfs = xfs_fs_statfs, |
1571 | .remount_fs = xfs_fs_remount, | 1571 | .remount_fs = xfs_fs_remount, |