diff options
author | David Chinner <david@fromorbit.com> | 2008-10-30 02:15:21 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 02:15:21 -0400 |
commit | dfd837a9eb79de4e50323a6f4e1ad8138d806cb7 (patch) | |
tree | 82a076961ce10f9a9253c1ed2f7916b489fdc548 /fs/xfs | |
parent | 2030b5aba8a4bcaca5aca85968514fa58207d3bd (diff) |
[XFS] kill xfs_syncsub
Now that the only caller is xfs_sync(), merge the two together as it makes
no sense to keep them separate.
SGI-PV: 988140
SGI-Modid: xfs-linux-melb:xfs-kern:32306a
Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 141 |
1 files changed, 62 insertions, 79 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 7e9fb5251b2e..d4b7b21a6e56 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -48,79 +48,6 @@ | |||
48 | #include <linux/freezer.h> | 48 | #include <linux/freezer.h> |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * xfs_sync flushes any pending I/O to file system vfsp. | ||
52 | * | ||
53 | * This routine is called by vfs_sync() to make sure that things make it | ||
54 | * out to disk eventually, on sync() system calls to flush out everything, | ||
55 | * and when the file system is unmounted. For the vfs_sync() case, all | ||
56 | * we really need to do is sync out the log to make all of our meta-data | ||
57 | * updates permanent (except for timestamps). For calls from pflushd(), | ||
58 | * dirty pages are kept moving by calling pdflush() on the inodes | ||
59 | * containing them. We also flush the inodes that we can lock without | ||
60 | * sleeping and the superblock if we can lock it without sleeping from | ||
61 | * vfs_sync() so that items at the tail of the log are always moving out. | ||
62 | * | ||
63 | * Flags: | ||
64 | * SYNC_BDFLUSH - We're being called from vfs_sync() so we don't want | ||
65 | * to sleep if we can help it. All we really need | ||
66 | * to do is ensure that the log is synced at least | ||
67 | * periodically. We also push the inodes and | ||
68 | * superblock if we can lock them without sleeping | ||
69 | * and they are not pinned. | ||
70 | * SYNC_ATTR - We need to flush the inodes. If SYNC_BDFLUSH is not | ||
71 | * set, then we really want to lock each inode and flush | ||
72 | * it. | ||
73 | * SYNC_WAIT - All the flushes that take place in this call should | ||
74 | * be synchronous. | ||
75 | * SYNC_DELWRI - This tells us to push dirty pages associated with | ||
76 | * inodes. SYNC_WAIT and SYNC_BDFLUSH are used to | ||
77 | * determine if they should be flushed sync, async, or | ||
78 | * delwri. | ||
79 | * SYNC_CLOSE - This flag is passed when the system is being | ||
80 | * unmounted. We should sync and invalidate everything. | ||
81 | * SYNC_FSDATA - This indicates that the caller would like to make | ||
82 | * sure the superblock is safe on disk. We can ensure | ||
83 | * this by simply making sure the log gets flushed | ||
84 | * if SYNC_BDFLUSH is set, and by actually writing it | ||
85 | * out otherwise. | ||
86 | * SYNC_IOWAIT - The caller wants us to wait for all data I/O to complete | ||
87 | * before we return (including direct I/O). Forms the drain | ||
88 | * side of the write barrier needed to safely quiesce the | ||
89 | * filesystem. | ||
90 | * | ||
91 | */ | ||
92 | int | ||
93 | xfs_sync( | ||
94 | xfs_mount_t *mp, | ||
95 | int flags) | ||
96 | { | ||
97 | int error; | ||
98 | |||
99 | /* | ||
100 | * Get the Quota Manager to flush the dquots. | ||
101 | * | ||
102 | * If XFS quota support is not enabled or this filesystem | ||
103 | * instance does not use quotas XFS_QM_DQSYNC will always | ||
104 | * return zero. | ||
105 | */ | ||
106 | error = XFS_QM_DQSYNC(mp, flags); | ||
107 | if (error) { | ||
108 | /* | ||
109 | * If we got an IO error, we will be shutting down. | ||
110 | * So, there's nothing more for us to do here. | ||
111 | */ | ||
112 | ASSERT(error != EIO || XFS_FORCED_SHUTDOWN(mp)); | ||
113 | if (XFS_FORCED_SHUTDOWN(mp)) | ||
114 | return XFS_ERROR(error); | ||
115 | } | ||
116 | |||
117 | if (flags & SYNC_IOWAIT) | ||
118 | xfs_filestream_flush(mp); | ||
119 | |||
120 | return xfs_syncsub(mp, flags); | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * Sync all the inodes in the given AG according to the | 51 | * Sync all the inodes in the given AG according to the |
125 | * direction given by the flags. | 52 | * direction given by the flags. |
126 | */ | 53 | */ |
@@ -396,22 +323,78 @@ xfs_sync_fsdata( | |||
396 | } | 323 | } |
397 | 324 | ||
398 | /* | 325 | /* |
399 | * xfs sync routine for internal use | 326 | * xfs_sync flushes any pending I/O to file system vfsp. |
400 | * | 327 | * |
401 | * This routine supports all of the flags defined for the generic vfs_sync | 328 | * This routine is called by vfs_sync() to make sure that things make it |
402 | * interface as explained above under xfs_sync. | 329 | * out to disk eventually, on sync() system calls to flush out everything, |
330 | * and when the file system is unmounted. For the vfs_sync() case, all | ||
331 | * we really need to do is sync out the log to make all of our meta-data | ||
332 | * updates permanent (except for timestamps). For calls from pflushd(), | ||
333 | * dirty pages are kept moving by calling pdflush() on the inodes | ||
334 | * containing them. We also flush the inodes that we can lock without | ||
335 | * sleeping and the superblock if we can lock it without sleeping from | ||
336 | * vfs_sync() so that items at the tail of the log are always moving out. | ||
337 | * | ||
338 | * Flags: | ||
339 | * SYNC_BDFLUSH - We're being called from vfs_sync() so we don't want | ||
340 | * to sleep if we can help it. All we really need | ||
341 | * to do is ensure that the log is synced at least | ||
342 | * periodically. We also push the inodes and | ||
343 | * superblock if we can lock them without sleeping | ||
344 | * and they are not pinned. | ||
345 | * SYNC_ATTR - We need to flush the inodes. If SYNC_BDFLUSH is not | ||
346 | * set, then we really want to lock each inode and flush | ||
347 | * it. | ||
348 | * SYNC_WAIT - All the flushes that take place in this call should | ||
349 | * be synchronous. | ||
350 | * SYNC_DELWRI - This tells us to push dirty pages associated with | ||
351 | * inodes. SYNC_WAIT and SYNC_BDFLUSH are used to | ||
352 | * determine if they should be flushed sync, async, or | ||
353 | * delwri. | ||
354 | * SYNC_CLOSE - This flag is passed when the system is being | ||
355 | * unmounted. We should sync and invalidate everything. | ||
356 | * SYNC_FSDATA - This indicates that the caller would like to make | ||
357 | * sure the superblock is safe on disk. We can ensure | ||
358 | * this by simply making sure the log gets flushed | ||
359 | * if SYNC_BDFLUSH is set, and by actually writing it | ||
360 | * out otherwise. | ||
361 | * SYNC_IOWAIT - The caller wants us to wait for all data I/O to complete | ||
362 | * before we return (including direct I/O). Forms the drain | ||
363 | * side of the write barrier needed to safely quiesce the | ||
364 | * filesystem. | ||
403 | * | 365 | * |
404 | */ | 366 | */ |
405 | STATIC int | 367 | int |
406 | xfs_syncsub( | 368 | xfs_sync( |
407 | xfs_mount_t *mp, | 369 | xfs_mount_t *mp, |
408 | int flags) | 370 | int flags) |
409 | { | 371 | { |
410 | int error = 0; | 372 | int error; |
411 | int last_error = 0; | 373 | int last_error = 0; |
412 | uint log_flags = XFS_LOG_FORCE; | 374 | uint log_flags = XFS_LOG_FORCE; |
413 | 375 | ||
414 | /* | 376 | /* |
377 | * Get the Quota Manager to flush the dquots. | ||
378 | * | ||
379 | * If XFS quota support is not enabled or this filesystem | ||
380 | * instance does not use quotas XFS_QM_DQSYNC will always | ||
381 | * return zero. | ||
382 | */ | ||
383 | error = XFS_QM_DQSYNC(mp, flags); | ||
384 | if (error) { | ||
385 | /* | ||
386 | * If we got an IO error, we will be shutting down. | ||
387 | * So, there's nothing more for us to do here. | ||
388 | */ | ||
389 | ASSERT(error != EIO || XFS_FORCED_SHUTDOWN(mp)); | ||
390 | if (XFS_FORCED_SHUTDOWN(mp)) | ||
391 | return XFS_ERROR(error); | ||
392 | } | ||
393 | |||
394 | if (flags & SYNC_IOWAIT) | ||
395 | xfs_filestream_flush(mp); | ||
396 | |||
397 | /* | ||
415 | * Sync out the log. This ensures that the log is periodically | 398 | * Sync out the log. This ensures that the log is periodically |
416 | * flushed even if there is not enough activity to fill it up. | 399 | * flushed even if there is not enough activity to fill it up. |
417 | */ | 400 | */ |