diff options
author | David Chinner <david@fromorbit.com> | 2008-10-30 02:16:11 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 02:16:11 -0400 |
commit | a4e4c4f4a8f9376158f8181a75285091f52a79e3 (patch) | |
tree | 146e3f2d51e60db4536895a0cd4eb69a33762d37 /fs/xfs | |
parent | cb56a4b995d44b7990ca3acd18db571eedd0649f (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')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 132 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.h | 25 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 10 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 15 |
4 files changed, 29 insertions, 153 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 | */ |
325 | int | 335 | int |
326 | xfs_quiesce_data( | 336 | xfs_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 | */ | ||
390 | int | ||
391 | xfs_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 |
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h index 2509db021f79..4591dc0c7880 100644 --- a/fs/xfs/linux-2.6/xfs_sync.h +++ b/fs/xfs/linux-2.6/xfs_sync.h | |||
@@ -28,31 +28,14 @@ typedef struct bhv_vfs_sync_work { | |||
28 | } bhv_vfs_sync_work_t; | 28 | } bhv_vfs_sync_work_t; |
29 | 29 | ||
30 | #define SYNC_ATTR 0x0001 /* sync attributes */ | 30 | #define SYNC_ATTR 0x0001 /* sync attributes */ |
31 | #define SYNC_DELWRI 0x0004 /* look at delayed writes */ | 31 | #define SYNC_DELWRI 0x0002 /* look at delayed writes */ |
32 | #define SYNC_WAIT 0x0008 /* wait for i/o to complete */ | 32 | #define SYNC_WAIT 0x0004 /* wait for i/o to complete */ |
33 | #define SYNC_BDFLUSH 0x0010 /* BDFLUSH is calling -- don't block */ | 33 | #define SYNC_BDFLUSH 0x0008 /* BDFLUSH is calling -- don't block */ |
34 | #define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */ | 34 | #define SYNC_IOWAIT 0x0010 /* wait for all I/O to complete */ |
35 | #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ | ||
36 | #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ | ||
37 | #define SYNC_IOWAIT 0x0100 /* wait for all I/O to complete */ | ||
38 | |||
39 | /* | ||
40 | * When remounting a filesystem read-only or freezing the filesystem, | ||
41 | * we have two phases to execute. This first phase is syncing the data | ||
42 | * before we quiesce the fielsystem, and the second is flushing all the | ||
43 | * inodes out after we've waited for all the transactions created by | ||
44 | * the first phase to complete. The second phase uses SYNC_INODE_QUIESCE | ||
45 | * to ensure that the inodes are written to their location on disk | ||
46 | * rather than just existing in transactions in the log. This means | ||
47 | * after a quiesce there is no log replay required to write the inodes | ||
48 | * to disk (this is the main difference between a sync and a quiesce). | ||
49 | */ | ||
50 | #define SYNC_DATA_QUIESCE (SYNC_DELWRI|SYNC_FSDATA|SYNC_WAIT|SYNC_IOWAIT) | ||
51 | 35 | ||
52 | int xfs_syncd_init(struct xfs_mount *mp); | 36 | int xfs_syncd_init(struct xfs_mount *mp); |
53 | void xfs_syncd_stop(struct xfs_mount *mp); | 37 | void xfs_syncd_stop(struct xfs_mount *mp); |
54 | 38 | ||
55 | int xfs_sync(struct xfs_mount *mp, int flags); | ||
56 | int xfs_sync_inodes(struct xfs_mount *mp, int flags); | 39 | int xfs_sync_inodes(struct xfs_mount *mp, int flags); |
57 | int xfs_sync_fsdata(struct xfs_mount *mp, int flags); | 40 | int xfs_sync_fsdata(struct xfs_mount *mp, int flags); |
58 | 41 | ||
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 270f775974e2..db1986a205a9 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -987,14 +987,10 @@ xfs_qm_dqdetach( | |||
987 | } | 987 | } |
988 | 988 | ||
989 | /* | 989 | /* |
990 | * This is called by VFS_SYNC and flags arg determines the caller, | 990 | * This is called to sync quotas. We can be told to use non-blocking |
991 | * and its motives, as done in xfs_sync. | 991 | * semantics by either the SYNC_BDFLUSH flag or the absence of the |
992 | * | 992 | * SYNC_WAIT flag. |
993 | * vfs_sync: SYNC_FSDATA|SYNC_ATTR|SYNC_BDFLUSH 0x31 | ||
994 | * syscall sync: SYNC_FSDATA|SYNC_ATTR|SYNC_DELWRI 0x25 | ||
995 | * umountroot : SYNC_WAIT | SYNC_CLOSE | SYNC_ATTR | SYNC_FSDATA | ||
996 | */ | 993 | */ |
997 | |||
998 | int | 994 | int |
999 | xfs_qm_sync( | 995 | xfs_qm_sync( |
1000 | xfs_mount_t *mp, | 996 | xfs_mount_t *mp, |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 1256746b249f..58865fe47806 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -431,14 +431,13 @@ xfs_ireclaim(xfs_inode_t *ip) | |||
431 | xfs_iextract(ip); | 431 | xfs_iextract(ip); |
432 | 432 | ||
433 | /* | 433 | /* |
434 | * Here we do a spurious inode lock in order to coordinate with | 434 | * Here we do a spurious inode lock in order to coordinate with inode |
435 | * xfs_sync(). This is because xfs_sync() references the inodes | 435 | * cache radix tree lookups. This is because the lookup can reference |
436 | * in the mount list without taking references on the corresponding | 436 | * the inodes in the cache without taking references. We make that OK |
437 | * vnodes. We make that OK here by ensuring that we wait until | 437 | * here by ensuring that we wait until the inode is unlocked after the |
438 | * the inode is unlocked in xfs_sync() before we go ahead and | 438 | * lookup before we go ahead and free it. We get both the ilock and |
439 | * free it. We get both the regular lock and the io lock because | 439 | * the iolock because the code may need to drop the ilock one but will |
440 | * the xfs_sync() code may need to drop the regular one but will | 440 | * still hold the iolock. |
441 | * still hold the io lock. | ||
442 | */ | 441 | */ |
443 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 442 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
444 | 443 | ||