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>

authored by

Christoph Hellwig and committed by
Christoph Hellwig
8b5403a6 b0710ccc

+11 -30
+4 -4
fs/xfs/linux-2.6/xfs_sync.c
··· 353 * If this is xfssyncd() then only sync the superblock if we can 354 * lock it without sleeping and it is not pinned. 355 */ 356 - if (flags & SYNC_BDFLUSH) { 357 ASSERT(!(flags & SYNC_WAIT)); 358 359 bp = xfs_getsb(mp, XFS_BUF_TRYLOCK); ··· 418 419 /* push non-blocking */ 420 xfs_sync_data(mp, 0); 421 - xfs_qm_sync(mp, SYNC_BDFLUSH); 422 xfs_filestream_flush(mp); 423 424 /* push and block */ ··· 568 xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); 569 xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC); 570 /* dgc: errors ignored here */ 571 - error = xfs_qm_sync(mp, SYNC_BDFLUSH); 572 - error = xfs_sync_fsdata(mp, SYNC_BDFLUSH); 573 if (xfs_log_need_covered(mp)) 574 error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE); 575 }
··· 353 * If this is xfssyncd() then only sync the superblock if we can 354 * lock it without sleeping and it is not pinned. 355 */ 356 + if (flags & SYNC_TRYLOCK) { 357 ASSERT(!(flags & SYNC_WAIT)); 358 359 bp = xfs_getsb(mp, XFS_BUF_TRYLOCK); ··· 418 419 /* push non-blocking */ 420 xfs_sync_data(mp, 0); 421 + xfs_qm_sync(mp, SYNC_TRYLOCK); 422 xfs_filestream_flush(mp); 423 424 /* push and block */ ··· 568 xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); 569 xfs_reclaim_inodes(mp, XFS_IFLUSH_DELWRI_ELSE_ASYNC); 570 /* dgc: errors ignored here */ 571 + error = xfs_qm_sync(mp, SYNC_TRYLOCK); 572 + error = xfs_sync_fsdata(mp, SYNC_TRYLOCK); 573 if (xfs_log_need_covered(mp)) 574 error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE); 575 }
+2 -3
fs/xfs/linux-2.6/xfs_sync.h
··· 29 struct completion *w_completion; 30 } xfs_sync_work_t; 31 32 - #define SYNC_WAIT 0x0004 /* wait for i/o to complete */ 33 - #define SYNC_BDFLUSH 0x0008 /* BDFLUSH is calling -- don't block */ 34 - #define SYNC_TRYLOCK 0x0020 /* only try to lock inodes */ 35 36 int xfs_syncd_init(struct xfs_mount *mp); 37 void xfs_syncd_stop(struct xfs_mount *mp);
··· 29 struct completion *w_completion; 30 } xfs_sync_work_t; 31 32 + #define SYNC_WAIT 0x0001 /* wait for i/o to complete */ 33 + #define SYNC_TRYLOCK 0x0002 /* only try to lock inodes */ 34 35 int xfs_syncd_init(struct xfs_mount *mp); 36 void xfs_syncd_stop(struct xfs_mount *mp);
+5 -23
fs/xfs/quota/xfs_qm.c
··· 905 } 906 } 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 914 xfs_qm_sync( 915 xfs_mount_t *mp, ··· 913 int recl, restarts; 914 xfs_dquot_t *dqp; 915 uint flush_flags; 916 - boolean_t nowait; 917 int error; 918 919 if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) 920 return 0; 921 922 restarts = 0; 923 - /* 924 - * We won't block unless we are asked to. 925 - */ 926 - nowait = (boolean_t)(flags & SYNC_BDFLUSH || (flags & SYNC_WAIT) == 0); 927 928 again: 929 xfs_qm_mplist_lock(mp); ··· 939 * don't 'seem' to be dirty. ie. don't acquire dqlock. 940 * This is very similar to what xfs_sync does with inodes. 941 */ 942 - if (flags & SYNC_BDFLUSH) { 943 - if (! XFS_DQ_IS_DIRTY(dqp)) 944 continue; 945 - } 946 - 947 - if (nowait) { 948 - /* 949 - * Try to acquire the dquot lock. We are NOT out of 950 - * lock order, but we just don't want to wait for this 951 - * lock, unless somebody wanted us to. 952 - */ 953 - if (! xfs_qm_dqlock_nowait(dqp)) 954 continue; 955 } else { 956 xfs_dqlock(dqp); ··· 959 /* XXX a sentinel would be better */ 960 recl = XFS_QI_MPLRECLAIMS(mp); 961 if (!xfs_dqflock_nowait(dqp)) { 962 - if (nowait) { 963 xfs_dqunlock(dqp); 964 continue; 965 } ··· 977 * Let go of the mplist lock. We don't want to hold it 978 * across a disk write 979 */ 980 - flush_flags = (nowait) ? XFS_QMOPT_DELWRI : XFS_QMOPT_SYNC; 981 xfs_qm_mplist_unlock(mp); 982 xfs_dqtrace_entry(dqp, "XQM_SYNC: DQFLUSH"); 983 error = xfs_qm_dqflush(dqp, flush_flags);
··· 905 } 906 } 907 908 int 909 xfs_qm_sync( 910 xfs_mount_t *mp, ··· 918 int recl, restarts; 919 xfs_dquot_t *dqp; 920 uint flush_flags; 921 int error; 922 923 if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) 924 return 0; 925 926 + flush_flags = (flags & SYNC_WAIT) ? XFS_QMOPT_SYNC : XFS_QMOPT_DELWRI; 927 restarts = 0; 928 929 again: 930 xfs_qm_mplist_lock(mp); ··· 948 * don't 'seem' to be dirty. ie. don't acquire dqlock. 949 * This is very similar to what xfs_sync does with inodes. 950 */ 951 + if (flags & SYNC_TRYLOCK) { 952 + if (!XFS_DQ_IS_DIRTY(dqp)) 953 continue; 954 + if (!xfs_qm_dqlock_nowait(dqp)) 955 continue; 956 } else { 957 xfs_dqlock(dqp); ··· 976 /* XXX a sentinel would be better */ 977 recl = XFS_QI_MPLRECLAIMS(mp); 978 if (!xfs_dqflock_nowait(dqp)) { 979 + if (flags & SYNC_TRYLOCK) { 980 xfs_dqunlock(dqp); 981 continue; 982 } ··· 994 * Let go of the mplist lock. We don't want to hold it 995 * across a disk write 996 */ 997 xfs_qm_mplist_unlock(mp); 998 xfs_dqtrace_entry(dqp, "XQM_SYNC: DQFLUSH"); 999 error = xfs_qm_dqflush(dqp, flush_flags);