aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota/xfs_qm.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-06-08 09:37:16 -0400
committerChristoph Hellwig <hch@brick.lst.de>2009-06-08 09:37:16 -0400
commit8b5403a6d772d340541cfb30a668fde119c40ac1 (patch)
tree0a81b174351ca56555d7ccc53ecd76c0b27edcee /fs/xfs/quota/xfs_qm.c
parentb0710ccc6d9fa8fb908b5f6d1b0782a09d80e24f (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/quota/xfs_qm.c')
-rw-r--r--fs/xfs/quota/xfs_qm.c28
1 files changed, 5 insertions, 23 deletions
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 */
913int 908int
914xfs_qm_sync( 909xfs_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);