diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_sync.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index a3d2e7713068..c1a9a1135073 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -268,29 +268,42 @@ xfs_sync_inode_attr( | |||
268 | return error; | 268 | return error; |
269 | } | 269 | } |
270 | 270 | ||
271 | /* | ||
272 | * Write out pagecache data for the whole filesystem. | ||
273 | */ | ||
271 | int | 274 | int |
272 | xfs_sync_inodes( | 275 | xfs_sync_data( |
273 | xfs_mount_t *mp, | 276 | struct xfs_mount *mp, |
274 | int flags) | 277 | int flags) |
275 | { | 278 | { |
276 | int error = 0; | 279 | int error; |
277 | int lflags = XFS_LOG_FORCE; | ||
278 | 280 | ||
279 | if (mp->m_flags & XFS_MOUNT_RDONLY) | 281 | ASSERT((flags & ~(SYNC_TRYLOCK|SYNC_WAIT|SYNC_IOWAIT)) == 0); |
280 | return 0; | ||
281 | 282 | ||
282 | if (flags & SYNC_WAIT) | 283 | error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags, |
283 | lflags |= XFS_LOG_SYNC; | 284 | XFS_ICI_NO_TAG); |
285 | if (error) | ||
286 | return XFS_ERROR(error); | ||
284 | 287 | ||
285 | if (flags & SYNC_DELWRI) | 288 | xfs_log_force(mp, 0, |
286 | error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags, XFS_ICI_NO_TAG); | 289 | (flags & SYNC_WAIT) ? |
290 | XFS_LOG_FORCE | XFS_LOG_SYNC : | ||
291 | XFS_LOG_FORCE); | ||
292 | return 0; | ||
293 | } | ||
287 | 294 | ||
288 | if (flags & SYNC_ATTR) | 295 | /* |
289 | error = xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags, XFS_ICI_NO_TAG); | 296 | * Write out inode metadata (attributes) for the whole filesystem. |
297 | */ | ||
298 | int | ||
299 | xfs_sync_attr( | ||
300 | struct xfs_mount *mp, | ||
301 | int flags) | ||
302 | { | ||
303 | ASSERT((flags & ~SYNC_WAIT) == 0); | ||
290 | 304 | ||
291 | if (!error && (flags & SYNC_DELWRI)) | 305 | return xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags, |
292 | xfs_log_force(mp, 0, lflags); | 306 | XFS_ICI_NO_TAG); |
293 | return XFS_ERROR(error); | ||
294 | } | 307 | } |
295 | 308 | ||
296 | STATIC int | 309 | STATIC int |
@@ -404,12 +417,12 @@ xfs_quiesce_data( | |||
404 | int error; | 417 | int error; |
405 | 418 | ||
406 | /* push non-blocking */ | 419 | /* push non-blocking */ |
407 | xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_BDFLUSH); | 420 | xfs_sync_data(mp, 0); |
408 | xfs_qm_sync(mp, SYNC_BDFLUSH); | 421 | xfs_qm_sync(mp, SYNC_BDFLUSH); |
409 | xfs_filestream_flush(mp); | 422 | xfs_filestream_flush(mp); |
410 | 423 | ||
411 | /* push and block */ | 424 | /* push and block */ |
412 | xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_WAIT|SYNC_IOWAIT); | 425 | xfs_sync_data(mp, SYNC_WAIT|SYNC_IOWAIT); |
413 | xfs_qm_sync(mp, SYNC_WAIT); | 426 | xfs_qm_sync(mp, SYNC_WAIT); |
414 | 427 | ||
415 | /* write superblock and hoover up shutdown errors */ | 428 | /* write superblock and hoover up shutdown errors */ |
@@ -438,7 +451,7 @@ xfs_quiesce_fs( | |||
438 | * logged before we can write the unmount record. | 451 | * logged before we can write the unmount record. |
439 | */ | 452 | */ |
440 | do { | 453 | do { |
441 | xfs_sync_inodes(mp, SYNC_ATTR|SYNC_WAIT); | 454 | xfs_sync_attr(mp, SYNC_WAIT); |
442 | pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1); | 455 | pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1); |
443 | if (!pincount) { | 456 | if (!pincount) { |
444 | delay(50); | 457 | delay(50); |
@@ -521,8 +534,8 @@ xfs_flush_inodes_work( | |||
521 | void *arg) | 534 | void *arg) |
522 | { | 535 | { |
523 | struct inode *inode = arg; | 536 | struct inode *inode = arg; |
524 | xfs_sync_inodes(mp, SYNC_DELWRI | SYNC_TRYLOCK); | 537 | xfs_sync_data(mp, SYNC_TRYLOCK); |
525 | xfs_sync_inodes(mp, SYNC_DELWRI | SYNC_TRYLOCK | SYNC_IOWAIT); | 538 | xfs_sync_data(mp, SYNC_TRYLOCK | SYNC_IOWAIT); |
526 | iput(inode); | 539 | iput(inode); |
527 | } | 540 | } |
528 | 541 | ||