aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_sync.c
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-10-30 02:16:11 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:16:11 -0400
commita4e4c4f4a8f9376158f8181a75285091f52a79e3 (patch)
tree146e3f2d51e60db4536895a0cd4eb69a33762d37 /fs/xfs/linux-2.6/xfs_sync.c
parentcb56a4b995d44b7990ca3acd18db571eedd0649f (diff)
[XFS] Kill xfs_sync()
There are no more callers to xfs_sync() now, so remove the function altogther. SGI-PV: 988140 SGI-Modid: xfs-linux-melb:xfs-kern:32311a 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/linux-2.6/xfs_sync.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c132
1 files changed, 15 insertions, 117 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index 91a54a79a09b..ed24435af651 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -316,11 +316,21 @@ xfs_sync_fsdata(
316} 316}
317 317
318/* 318/*
319 * First stage of freeze - no more writers will make progress now we are here, 319 * When remounting a filesystem read-only or freezing the filesystem, we have
320 * two phases to execute. This first phase is syncing the data before we
321 * quiesce the filesystem, and the second is flushing all the inodes out after
322 * we've waited for all the transactions created by the first phase to
323 * complete. The second phase ensures that the inodes are written to their
324 * location on disk rather than just existing in transactions in the log. This
325 * means after a quiesce there is no log replay required to write the inodes to
326 * disk (this is the main difference between a sync and a quiesce).
327 */
328/*
329 * First stage of freeze - no writers will make progress now we are here,
320 * so we flush delwri and delalloc buffers here, then wait for all I/O to 330 * so we flush delwri and delalloc buffers here, then wait for all I/O to
321 * complete. Data is frozen at that point. Metadata is not frozen, 331 * complete. Data is frozen at that point. Metadata is not frozen,
322 * transactions can still occur here so don't bother flushing the buftarg (i.e 332 * transactions can still occur here so don't bother flushing the buftarg
323 * SYNC_QUIESCE) because it'll just get dirty again. 333 * because it'll just get dirty again.
324 */ 334 */
325int 335int
326xfs_quiesce_data( 336xfs_quiesce_data(
@@ -337,11 +347,10 @@ xfs_quiesce_data(
337 xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_WAIT|SYNC_IOWAIT); 347 xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_WAIT|SYNC_IOWAIT);
338 XFS_QM_DQSYNC(mp, SYNC_WAIT); 348 XFS_QM_DQSYNC(mp, SYNC_WAIT);
339 349
340 /* write superblock and hoover shutdown errors */ 350 /* write superblock and hoover up shutdown errors */
341 error = xfs_sync_fsdata(mp, 0); 351 error = xfs_sync_fsdata(mp, 0);
342 352
343 /* flush devices */ 353 /* flush data-only devices */
344 XFS_bflush(mp->m_ddev_targp);
345 if (mp->m_rtdev_targp) 354 if (mp->m_rtdev_targp)
346 XFS_bflush(mp->m_rtdev_targp); 355 XFS_bflush(mp->m_rtdev_targp);
347 356
@@ -349,117 +358,6 @@ xfs_quiesce_data(
349} 358}
350 359
351/* 360/*
352 * xfs_sync flushes any pending I/O to file system vfsp.
353 *
354 * This routine is called by vfs_sync() to make sure that things make it
355 * out to disk eventually, on sync() system calls to flush out everything,
356 * and when the file system is unmounted. For the vfs_sync() case, all
357 * we really need to do is sync out the log to make all of our meta-data
358 * updates permanent (except for timestamps). For calls from pflushd(),
359 * dirty pages are kept moving by calling pdflush() on the inodes
360 * containing them. We also flush the inodes that we can lock without
361 * sleeping and the superblock if we can lock it without sleeping from
362 * vfs_sync() so that items at the tail of the log are always moving out.
363 *
364 * Flags:
365 * SYNC_BDFLUSH - We're being called from vfs_sync() so we don't want
366 * to sleep if we can help it. All we really need
367 * to do is ensure that the log is synced at least
368 * periodically. We also push the inodes and
369 * superblock if we can lock them without sleeping
370 * and they are not pinned.
371 * SYNC_ATTR - We need to flush the inodes. Now handled by direct calls
372 * to xfs_sync_inodes().
373 * SYNC_WAIT - All the flushes that take place in this call should
374 * be synchronous.
375 * SYNC_DELWRI - This tells us to push dirty pages associated with
376 * inodes. SYNC_WAIT and SYNC_BDFLUSH are used to
377 * determine if they should be flushed sync, async, or
378 * delwri.
379 * SYNC_FSDATA - This indicates that the caller would like to make
380 * sure the superblock is safe on disk. We can ensure
381 * this by simply making sure the log gets flushed
382 * if SYNC_BDFLUSH is set, and by actually writing it
383 * out otherwise.
384 * SYNC_IOWAIT - The caller wants us to wait for all data I/O to complete
385 * before we return (including direct I/O). Forms the drain
386 * side of the write barrier needed to safely quiesce the
387 * filesystem.
388 *
389 */
390int
391xfs_sync(
392 xfs_mount_t *mp,
393 int flags)
394{
395 int error;
396 int last_error = 0;
397 uint log_flags = XFS_LOG_FORCE;
398
399 ASSERT(!(flags & SYNC_ATTR));
400
401 /*
402 * Get the Quota Manager to flush the dquots.
403 *
404 * If XFS quota support is not enabled or this filesystem
405 * instance does not use quotas XFS_QM_DQSYNC will always
406 * return zero.
407 */
408 error = XFS_QM_DQSYNC(mp, flags);
409 if (error) {
410 /*
411 * If we got an IO error, we will be shutting down.
412 * So, there's nothing more for us to do here.
413 */
414 ASSERT(error != EIO || XFS_FORCED_SHUTDOWN(mp));
415 if (XFS_FORCED_SHUTDOWN(mp))
416 return XFS_ERROR(error);
417 }
418
419 if (flags & SYNC_IOWAIT)
420 xfs_filestream_flush(mp);
421
422 /*
423 * Sync out the log. This ensures that the log is periodically
424 * flushed even if there is not enough activity to fill it up.
425 */
426 if (flags & SYNC_WAIT)
427 log_flags |= XFS_LOG_SYNC;
428
429 xfs_log_force(mp, (xfs_lsn_t)0, log_flags);
430
431 if (flags & SYNC_DELWRI) {
432 if (flags & SYNC_BDFLUSH)
433 xfs_finish_reclaim_all(mp, 1, XFS_IFLUSH_DELWRI_ELSE_ASYNC);
434 else
435 error = xfs_sync_inodes(mp, flags);
436 /*
437 * Flushing out dirty data above probably generated more
438 * log activity, so if this isn't vfs_sync() then flush
439 * the log again.
440 */
441 xfs_log_force(mp, 0, log_flags);
442 }
443
444 if (flags & SYNC_FSDATA) {
445 error = xfs_sync_fsdata(mp, flags);
446 if (error)
447 last_error = error;
448 }
449
450 /*
451 * Now check to see if the log needs a "dummy" transaction.
452 */
453 if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) {
454 error = xfs_commit_dummy_trans(mp, log_flags);
455 if (error)
456 return error;
457 }
458
459 return XFS_ERROR(last_error);
460}
461
462/*
463 * Enqueue a work item to be picked up by the vfs xfssyncd thread. 361 * Enqueue a work item to be picked up by the vfs xfssyncd thread.
464 * Doing this has two advantages: 362 * Doing this has two advantages:
465 * - It saves on stack space, which is tight in certain situations 363 * - It saves on stack space, which is tight in certain situations