diff options
author | Christoph Hellwig <hch@lst.de> | 2009-06-08 09:37:16 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@brick.lst.de> | 2009-06-08 09:37:16 -0400 |
commit | 8b5403a6d772d340541cfb30a668fde119c40ac1 (patch) | |
tree | 0a81b174351ca56555d7ccc53ecd76c0b27edcee /fs/xfs | |
parent | b0710ccc6d9fa8fb908b5f6d1b0782a09d80e24f (diff) |
xfs: remove SYNC_BDFLUSH
SYNC_BDFLUSH is a leftover from IRIX and rather misnamed for todays
code. Make xfs_sync_fsdata and xfs_dq_sync use the SYNC_TRYLOCK flag
for not blocking on logs just as the inode sync code already does.
For xfs_sync_fsdata it's a trivial 1:1 replacement, but for xfs_qm_sync
I use the opportunity to decouple the non-blocking lock case from the
different flushing modes, similar to the inode sync code.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 8 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.h | 5 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 28 |
3 files changed, 11 insertions, 30 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c index 32abd96b1095..b619d6b8ca43 100644 --- a/fs/xfs/linux-2.6/xfs_sync.c +++ b/fs/xfs/linux-2.6/xfs_sync.c | |||
@@ -353,7 +353,7 @@ xfs_sync_fsdata( | |||
353 | * If this is xfssyncd() then only sync the superblock if we can | 353 | * If this is xfssyncd() then only sync the superblock if we can |
354 | * lock it without sleeping and it is not pinned. | 354 | * lock it without sleeping and it is not pinned. |
355 | */ | 355 | */ |
356 | if (flags & SYNC_BDFLUSH) { | 356 | if (flags & SYNC_TRYLOCK) { |
357 | ASSERT(!(flags & SYNC_WAIT)); | 357 | ASSERT(!(flags & SYNC_WAIT)); |
358 | 358 | ||
359 | bp = xfs_getsb(mp, XFS_BUF_TRYLOCK); | 359 | bp = xfs_getsb(mp, XFS_BUF_TRYLOCK); |
@@ -418,7 +418,7 @@ xfs_quiesce_data( | |||
418 | 418 | ||
419 | /* push non-blocking */ | 419 | /* push non-blocking */ |
420 | xfs_sync_data(mp, 0); | 420 | xfs_sync_data(mp, 0); |
421 | xfs_qm_sync(mp, SYNC_BDFLUSH); | 421 | xfs_qm_sync(mp, SYNC_TRYLOCK); |
422 | xfs_filestream_flush(mp); | 422 | xfs_filestream_flush(mp); |
423 | 423 | ||
424 | /* push and block */ | 424 | /* push and block */ |
@@ -568,8 +568,8 @@ xfs_sync_worker( | |||
568 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); | 568 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); |
569 | xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC); | 569 | xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC); |
570 | /* dgc: errors ignored here */ | 570 | /* dgc: errors ignored here */ |
571 | error = xfs_qm_sync(mp, SYNC_BDFLUSH); | 571 | error = xfs_qm_sync(mp, SYNC_TRYLOCK); |
572 | error = xfs_sync_fsdata(mp, SYNC_BDFLUSH); | 572 | error = xfs_sync_fsdata(mp, SYNC_TRYLOCK); |
573 | if (xfs_log_need_covered(mp)) | 573 | if (xfs_log_need_covered(mp)) |
574 | error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE); | 574 | error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE); |
575 | } | 575 | } |
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h index bda33a03e12b..2a10301c99c7 100644 --- a/fs/xfs/linux-2.6/xfs_sync.h +++ b/fs/xfs/linux-2.6/xfs_sync.h | |||
@@ -29,9 +29,8 @@ typedef struct xfs_sync_work { | |||
29 | struct completion *w_completion; | 29 | struct completion *w_completion; |
30 | } xfs_sync_work_t; | 30 | } xfs_sync_work_t; |
31 | 31 | ||
32 | #define SYNC_WAIT 0x0004 /* wait for i/o to complete */ | 32 | #define SYNC_WAIT 0x0001 /* wait for i/o to complete */ |
33 | #define SYNC_BDFLUSH 0x0008 /* BDFLUSH is calling -- don't block */ | 33 | #define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */ |
34 | #define SYNC_TRYLOCK 0x0020 /* only try to lock inodes */ | ||
35 | 34 | ||
36 | int xfs_syncd_init(struct xfs_mount *mp); | 35 | int xfs_syncd_init(struct xfs_mount *mp); |
37 | void xfs_syncd_stop(struct xfs_mount *mp); | 36 | void xfs_syncd_stop(struct xfs_mount *mp); |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index aa5d8212661c..22b7c8d364e8 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -905,11 +905,6 @@ xfs_qm_dqdetach( | |||
905 | } | 905 | } |
906 | } | 906 | } |
907 | 907 | ||
908 | /* | ||
909 | * This is called to sync quotas. We can be told to use non-blocking | ||
910 | * semantics by either the SYNC_BDFLUSH flag or the absence of the | ||
911 | * SYNC_WAIT flag. | ||
912 | */ | ||
913 | int | 908 | int |
914 | xfs_qm_sync( | 909 | xfs_qm_sync( |
915 | xfs_mount_t *mp, | 910 | xfs_mount_t *mp, |
@@ -918,17 +913,13 @@ xfs_qm_sync( | |||
918 | int recl, restarts; | 913 | int recl, restarts; |
919 | xfs_dquot_t *dqp; | 914 | xfs_dquot_t *dqp; |
920 | uint flush_flags; | 915 | uint flush_flags; |
921 | boolean_t nowait; | ||
922 | int error; | 916 | int error; |
923 | 917 | ||
924 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) | 918 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
925 | return 0; | 919 | return 0; |
926 | 920 | ||
921 | flush_flags = (flags & SYNC_WAIT) ? XFS_QMOPT_SYNC : XFS_QMOPT_DELWRI; | ||
927 | restarts = 0; | 922 | restarts = 0; |
928 | /* | ||
929 | * We won't block unless we are asked to. | ||
930 | */ | ||
931 | nowait = (boolean_t)(flags & SYNC_BDFLUSH || (flags & SYNC_WAIT) == 0); | ||
932 | 923 | ||
933 | again: | 924 | again: |
934 | xfs_qm_mplist_lock(mp); | 925 | xfs_qm_mplist_lock(mp); |
@@ -948,18 +939,10 @@ xfs_qm_sync( | |||
948 | * don't 'seem' to be dirty. ie. don't acquire dqlock. | 939 | * don't 'seem' to be dirty. ie. don't acquire dqlock. |
949 | * This is very similar to what xfs_sync does with inodes. | 940 | * This is very similar to what xfs_sync does with inodes. |
950 | */ | 941 | */ |
951 | if (flags & SYNC_BDFLUSH) { | 942 | if (flags & SYNC_TRYLOCK) { |
952 | if (! XFS_DQ_IS_DIRTY(dqp)) | 943 | if (!XFS_DQ_IS_DIRTY(dqp)) |
953 | continue; | 944 | continue; |
954 | } | 945 | if (!xfs_qm_dqlock_nowait(dqp)) |
955 | |||
956 | if (nowait) { | ||
957 | /* | ||
958 | * Try to acquire the dquot lock. We are NOT out of | ||
959 | * lock order, but we just don't want to wait for this | ||
960 | * lock, unless somebody wanted us to. | ||
961 | */ | ||
962 | if (! xfs_qm_dqlock_nowait(dqp)) | ||
963 | continue; | 946 | continue; |
964 | } else { | 947 | } else { |
965 | xfs_dqlock(dqp); | 948 | xfs_dqlock(dqp); |
@@ -976,7 +959,7 @@ xfs_qm_sync( | |||
976 | /* XXX a sentinel would be better */ | 959 | /* XXX a sentinel would be better */ |
977 | recl = XFS_QI_MPLRECLAIMS(mp); | 960 | recl = XFS_QI_MPLRECLAIMS(mp); |
978 | if (!xfs_dqflock_nowait(dqp)) { | 961 | if (!xfs_dqflock_nowait(dqp)) { |
979 | if (nowait) { | 962 | if (flags & SYNC_TRYLOCK) { |
980 | xfs_dqunlock(dqp); | 963 | xfs_dqunlock(dqp); |
981 | continue; | 964 | continue; |
982 | } | 965 | } |
@@ -994,7 +977,6 @@ xfs_qm_sync( | |||
994 | * Let go of the mplist lock. We don't want to hold it | 977 | * Let go of the mplist lock. We don't want to hold it |
995 | * across a disk write | 978 | * across a disk write |
996 | */ | 979 | */ |
997 | flush_flags = (nowait) ? XFS_QMOPT_DELWRI : XFS_QMOPT_SYNC; | ||
998 | xfs_qm_mplist_unlock(mp); | 980 | xfs_qm_mplist_unlock(mp); |
999 | xfs_dqtrace_entry(dqp, "XQM_SYNC: DQFLUSH"); | 981 | xfs_dqtrace_entry(dqp, "XQM_SYNC: DQFLUSH"); |
1000 | error = xfs_qm_dqflush(dqp, flush_flags); | 982 | error = xfs_qm_dqflush(dqp, flush_flags); |