aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dquot.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-04-23 01:58:37 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:29 -0400
commitfe7257fd4b8ae9a3e354d9edb61890973e373ef0 (patch)
tree471b9ecc1cb21207cb95291d1ec5b81c393b060f /fs/xfs/xfs_dquot.c
parent4c46819a8097a75d3b378c5e56d2bcf47bb7408d (diff)
xfs: do not write the buffer from xfs_qm_dqflush
Instead of writing the buffer directly from inside xfs_qm_dqflush return it to the caller and let the caller decide what to do with the buffer. Also remove the pincount check in xfs_qm_dqflush that all non-blocking callers already implement and the now unused flags parameter and the XFS_DQ_IS_DIRTY check that all callers already perform. [ Dave Chinner: fixed build error cause by missing '{'. ] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_dquot.c')
-rw-r--r--fs/xfs/xfs_dquot.c43
1 files changed, 13 insertions, 30 deletions
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 786a61e1cccd..53757d83e4f6 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -878,8 +878,8 @@ xfs_qm_dqflush_done(
878 */ 878 */
879int 879int
880xfs_qm_dqflush( 880xfs_qm_dqflush(
881 xfs_dquot_t *dqp, 881 struct xfs_dquot *dqp,
882 uint flags) 882 struct xfs_buf **bpp)
883{ 883{
884 struct xfs_mount *mp = dqp->q_mount; 884 struct xfs_mount *mp = dqp->q_mount;
885 struct xfs_buf *bp; 885 struct xfs_buf *bp;
@@ -891,14 +891,8 @@ xfs_qm_dqflush(
891 891
892 trace_xfs_dqflush(dqp); 892 trace_xfs_dqflush(dqp);
893 893
894 /* 894 *bpp = NULL;
895 * If not dirty, or it's pinned and we are not supposed to block, nada. 895
896 */
897 if (!XFS_DQ_IS_DIRTY(dqp) ||
898 ((flags & SYNC_TRYLOCK) && atomic_read(&dqp->q_pincount) > 0)) {
899 xfs_dqfunlock(dqp);
900 return 0;
901 }
902 xfs_qm_dqunpin_wait(dqp); 896 xfs_qm_dqunpin_wait(dqp);
903 897
904 /* 898 /*
@@ -918,9 +912,8 @@ xfs_qm_dqflush(
918 xfs_trans_ail_delete(mp->m_ail, lip); 912 xfs_trans_ail_delete(mp->m_ail, lip);
919 else 913 else
920 spin_unlock(&mp->m_ail->xa_lock); 914 spin_unlock(&mp->m_ail->xa_lock);
921 915 error = XFS_ERROR(EIO);
922 xfs_dqfunlock(dqp); 916 goto out_unlock;
923 return XFS_ERROR(EIO);
924 } 917 }
925 918
926 /* 919 /*
@@ -928,11 +921,8 @@ xfs_qm_dqflush(
928 */ 921 */
929 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, 922 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
930 mp->m_quotainfo->qi_dqchunklen, 0, &bp); 923 mp->m_quotainfo->qi_dqchunklen, 0, &bp);
931 if (error) { 924 if (error)
932 ASSERT(error != ENOENT); 925 goto out_unlock;
933 xfs_dqfunlock(dqp);
934 return error;
935 }
936 926
937 /* 927 /*
938 * Calculate the location of the dquot inside the buffer. 928 * Calculate the location of the dquot inside the buffer.
@@ -978,20 +968,13 @@ xfs_qm_dqflush(
978 xfs_log_force(mp, 0); 968 xfs_log_force(mp, 0);
979 } 969 }
980 970
981 if (flags & SYNC_WAIT)
982 error = xfs_bwrite(bp);
983 else
984 xfs_buf_delwri_queue(bp);
985
986 xfs_buf_relse(bp);
987
988 trace_xfs_dqflush_done(dqp); 971 trace_xfs_dqflush_done(dqp);
972 *bpp = bp;
973 return 0;
989 974
990 /* 975out_unlock:
991 * dqp is still locked, but caller is free to unlock it now. 976 xfs_dqfunlock(dqp);
992 */ 977 return XFS_ERROR(EIO);
993 return error;
994
995} 978}
996 979
997/* 980/*