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