Skip to content

Commit

Permalink
xfs: kill the unused XFS_QMOPT_* flush flags V2
Browse files Browse the repository at this point in the history
dquots are never flushed asynchronously. Remove the flag and the
async write support from the flush function. Make the default flush
a delwri flush to make the inode flush code, which leaves the
XFS_QMOPT_SYNC the only flag remaining.  Convert that to use
SYNC_WAIT instead, just like the inode flush code.

V2:
- just pass flush flags straight through

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Dave Chinner committed Feb 3, 2010
1 parent 7d6a7bd commit 20026d9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
13 changes: 6 additions & 7 deletions fs/xfs/quota/xfs_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ xfs_qm_dqflush(
* block, nada.
*/
if (!XFS_DQ_IS_DIRTY(dqp) ||
(!(flags & XFS_QMOPT_SYNC) && atomic_read(&dqp->q_pincount) > 0)) {
(!(flags & SYNC_WAIT) && atomic_read(&dqp->q_pincount) > 0)) {
xfs_dqfunlock(dqp);
return 0;
}
Expand Down Expand Up @@ -1251,18 +1251,17 @@ xfs_qm_dqflush(
xfs_log_force(mp, 0);
}

if (flags & XFS_QMOPT_DELWRI) {
xfs_bdwrite(mp, bp);
} else {
if (flags & SYNC_WAIT)
error = xfs_bwrite(mp, bp);
}
else
xfs_bdwrite(mp, bp);

trace_xfs_dqflush_done(dqp);

/*
* dqp is still locked, but caller is free to unlock it now.
*/
return (error);
return error;

}

Expand Down Expand Up @@ -1443,7 +1442,7 @@ xfs_qm_dqpurge(
* We don't care about getting disk errors here. We need
* to purge this dquot anyway, so we go ahead regardless.
*/
error = xfs_qm_dqflush(dqp, XFS_QMOPT_SYNC);
error = xfs_qm_dqflush(dqp, SYNC_WAIT);
if (error)
xfs_fs_cmn_err(CE_WARN, mp,
"xfs_qm_dqpurge: dquot %p flush failed", dqp);
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/quota/xfs_dquot_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ xfs_qm_dquot_logitem_push(
* lock without sleeping, then there must not have been
* anyone in the process of flushing the dquot.
*/
error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
error = xfs_qm_dqflush(dqp, 0);
if (error)
xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
"xfs_qm_dquot_logitem_push: push error %d on dqp %p",
Expand Down
14 changes: 6 additions & 8 deletions fs/xfs/quota/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ xfs_qm_unmount_quotas(
STATIC int
xfs_qm_dqflush_all(
xfs_mount_t *mp,
int flags)
int sync_mode)
{
int recl;
xfs_dquot_t *dqp;
Expand Down Expand Up @@ -486,7 +486,7 @@ xfs_qm_dqflush_all(
* across a disk write.
*/
xfs_qm_mplist_unlock(mp);
error = xfs_qm_dqflush(dqp, flags);
error = xfs_qm_dqflush(dqp, sync_mode);
xfs_dqunlock(dqp);
if (error)
return error;
Expand Down Expand Up @@ -926,13 +926,11 @@ xfs_qm_sync(
{
int recl, restarts;
xfs_dquot_t *dqp;
uint flush_flags;
int error;

if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
return 0;

flush_flags = (flags & SYNC_WAIT) ? XFS_QMOPT_SYNC : XFS_QMOPT_DELWRI;
restarts = 0;

again:
Expand Down Expand Up @@ -992,7 +990,7 @@ xfs_qm_sync(
* across a disk write
*/
xfs_qm_mplist_unlock(mp);
error = xfs_qm_dqflush(dqp, flush_flags);
error = xfs_qm_dqflush(dqp, flags);
xfs_dqunlock(dqp);
if (error && XFS_FORCED_SHUTDOWN(mp))
return 0; /* Need to prevent umount failure */
Expand Down Expand Up @@ -1796,7 +1794,7 @@ xfs_qm_quotacheck(
* successfully.
*/
if (!error)
error = xfs_qm_dqflush_all(mp, XFS_QMOPT_DELWRI);
error = xfs_qm_dqflush_all(mp, 0);

/*
* We can get this error if we couldn't do a dquot allocation inside
Expand Down Expand Up @@ -2018,7 +2016,7 @@ xfs_qm_shake_freelist(
* We flush it delayed write, so don't bother
* releasing the mplock.
*/
error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
error = xfs_qm_dqflush(dqp, 0);
if (error) {
xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
"xfs_qm_dqflush_all: dquot %p flush failed", dqp);
Expand Down Expand Up @@ -2201,7 +2199,7 @@ xfs_qm_dqreclaim_one(void)
* We flush it delayed write, so don't bother
* releasing the freelist lock.
*/
error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
error = xfs_qm_dqflush(dqp, 0);
if (error) {
xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
"xfs_qm_dqreclaim: dquot %p flush failed", dqp);
Expand Down
8 changes: 1 addition & 7 deletions fs/xfs/xfs_quota.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,10 @@ typedef struct xfs_qoff_logformat {
#define XFS_QMOPT_DELRTBCOUNT 0x0400000
#define XFS_QMOPT_RES_INOS 0x0800000

/*
* flags for dqflush and dqflush_all.
*/
#define XFS_QMOPT_SYNC 0x1000000
#define XFS_QMOPT_DELWRI 0x4000000

/*
* flags for dqalloc.
*/
#define XFS_QMOPT_INHERIT 0x8000000
#define XFS_QMOPT_INHERIT 0x1000000

/*
* flags to xfs_trans_mod_dquot.
Expand Down

0 comments on commit 20026d9

Please sign in to comment.