aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/quota/xfs_dquot.c91
-rw-r--r--fs/xfs/xfs_buf_item.c13
-rw-r--r--fs/xfs/xfs_buf_item.h2
-rw-r--r--fs/xfs/xfs_inode.c10
-rw-r--r--fs/xfs/xfs_inode_item.c23
-rw-r--r--fs/xfs/xfs_inode_item.h4
-rw-r--r--fs/xfs/xfs_trans_buf.c7
7 files changed, 68 insertions, 82 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index f152af8cfab0..6526e87cade0 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -54,8 +54,6 @@
54 flush lock - ditto. 54 flush lock - ditto.
55*/ 55*/
56 56
57STATIC void xfs_qm_dqflush_done(xfs_buf_t *, xfs_dq_logitem_t *);
58
59#ifdef DEBUG 57#ifdef DEBUG
60xfs_buftarg_t *xfs_dqerror_target; 58xfs_buftarg_t *xfs_dqerror_target;
61int xfs_do_dqerror; 59int xfs_do_dqerror;
@@ -1131,6 +1129,46 @@ xfs_qm_dqrele(
1131 xfs_qm_dqput(dqp); 1129 xfs_qm_dqput(dqp);
1132} 1130}
1133 1131
1132/*
1133 * This is the dquot flushing I/O completion routine. It is called
1134 * from interrupt level when the buffer containing the dquot is
1135 * flushed to disk. It is responsible for removing the dquot logitem
1136 * from the AIL if it has not been re-logged, and unlocking the dquot's
1137 * flush lock. This behavior is very similar to that of inodes..
1138 */
1139STATIC void
1140xfs_qm_dqflush_done(
1141 struct xfs_buf *bp,
1142 struct xfs_log_item *lip)
1143{
1144 xfs_dq_logitem_t *qip = (struct xfs_dq_logitem *)lip;
1145 xfs_dquot_t *dqp = qip->qli_dquot;
1146 struct xfs_ail *ailp = lip->li_ailp;
1147
1148 /*
1149 * We only want to pull the item from the AIL if its
1150 * location in the log has not changed since we started the flush.
1151 * Thus, we only bother if the dquot's lsn has
1152 * not changed. First we check the lsn outside the lock
1153 * since it's cheaper, and then we recheck while
1154 * holding the lock before removing the dquot from the AIL.
1155 */
1156 if ((lip->li_flags & XFS_LI_IN_AIL) &&
1157 lip->li_lsn == qip->qli_flush_lsn) {
1158
1159 /* xfs_trans_ail_delete() drops the AIL lock. */
1160 spin_lock(&ailp->xa_lock);
1161 if (lip->li_lsn == qip->qli_flush_lsn)
1162 xfs_trans_ail_delete(ailp, lip);
1163 else
1164 spin_unlock(&ailp->xa_lock);
1165 }
1166
1167 /*
1168 * Release the dq's flush lock since we're done with it.
1169 */
1170 xfs_dqfunlock(dqp);
1171}
1134 1172
1135/* 1173/*
1136 * Write a modified dquot to disk. 1174 * Write a modified dquot to disk.
@@ -1212,8 +1250,9 @@ xfs_qm_dqflush(
1212 * Attach an iodone routine so that we can remove this dquot from the 1250 * Attach an iodone routine so that we can remove this dquot from the
1213 * AIL and release the flush lock once the dquot is synced to disk. 1251 * AIL and release the flush lock once the dquot is synced to disk.
1214 */ 1252 */
1215 xfs_buf_attach_iodone(bp, (void(*)(xfs_buf_t *, xfs_log_item_t *)) 1253 xfs_buf_attach_iodone(bp, xfs_qm_dqflush_done,
1216 xfs_qm_dqflush_done, &(dqp->q_logitem.qli_item)); 1254 &dqp->q_logitem.qli_item);
1255
1217 /* 1256 /*
1218 * If the buffer is pinned then push on the log so we won't 1257 * If the buffer is pinned then push on the log so we won't
1219 * get stuck waiting in the write for too long. 1258 * get stuck waiting in the write for too long.
@@ -1237,50 +1276,6 @@ xfs_qm_dqflush(
1237 1276
1238} 1277}
1239 1278
1240/*
1241 * This is the dquot flushing I/O completion routine. It is called
1242 * from interrupt level when the buffer containing the dquot is
1243 * flushed to disk. It is responsible for removing the dquot logitem
1244 * from the AIL if it has not been re-logged, and unlocking the dquot's
1245 * flush lock. This behavior is very similar to that of inodes..
1246 */
1247/*ARGSUSED*/
1248STATIC void
1249xfs_qm_dqflush_done(
1250 xfs_buf_t *bp,
1251 xfs_dq_logitem_t *qip)
1252{
1253 xfs_dquot_t *dqp;
1254 struct xfs_ail *ailp;
1255
1256 dqp = qip->qli_dquot;
1257 ailp = qip->qli_item.li_ailp;
1258
1259 /*
1260 * We only want to pull the item from the AIL if its
1261 * location in the log has not changed since we started the flush.
1262 * Thus, we only bother if the dquot's lsn has
1263 * not changed. First we check the lsn outside the lock
1264 * since it's cheaper, and then we recheck while
1265 * holding the lock before removing the dquot from the AIL.
1266 */
1267 if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
1268 qip->qli_item.li_lsn == qip->qli_flush_lsn) {
1269
1270 /* xfs_trans_ail_delete() drops the AIL lock. */
1271 spin_lock(&ailp->xa_lock);
1272 if (qip->qli_item.li_lsn == qip->qli_flush_lsn)
1273 xfs_trans_ail_delete(ailp, (xfs_log_item_t*)qip);
1274 else
1275 spin_unlock(&ailp->xa_lock);
1276 }
1277
1278 /*
1279 * Release the dq's flush lock since we're done with it.
1280 */
1281 xfs_dqfunlock(dqp);
1282}
1283
1284int 1279int
1285xfs_qm_dqlock_nowait( 1280xfs_qm_dqlock_nowait(
1286 xfs_dquot_t *dqp) 1281 xfs_dquot_t *dqp)
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 992d6be101cb..60e063d96f8d 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -1079,15 +1079,14 @@ xfs_buf_error_relse(
1079 * It is called by xfs_buf_iodone_callbacks() above which will take 1079 * It is called by xfs_buf_iodone_callbacks() above which will take
1080 * care of cleaning up the buffer itself. 1080 * care of cleaning up the buffer itself.
1081 */ 1081 */
1082/* ARGSUSED */
1083void 1082void
1084xfs_buf_iodone( 1083xfs_buf_iodone(
1085 xfs_buf_t *bp, 1084 struct xfs_buf *bp,
1086 xfs_buf_log_item_t *bip) 1085 struct xfs_log_item *lip)
1087{ 1086{
1088 struct xfs_ail *ailp = bip->bli_item.li_ailp; 1087 struct xfs_ail *ailp = lip->li_ailp;
1089 1088
1090 ASSERT(bip->bli_buf == bp); 1089 ASSERT(BUF_ITEM(lip)->bli_buf == bp);
1091 1090
1092 xfs_buf_rele(bp); 1091 xfs_buf_rele(bp);
1093 1092
@@ -1101,6 +1100,6 @@ xfs_buf_iodone(
1101 * Either way, AIL is useless if we're forcing a shutdown. 1100 * Either way, AIL is useless if we're forcing a shutdown.
1102 */ 1101 */
1103 spin_lock(&ailp->xa_lock); 1102 spin_lock(&ailp->xa_lock);
1104 xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip); 1103 xfs_trans_ail_delete(ailp, lip);
1105 xfs_buf_item_free(bip); 1104 xfs_buf_item_free(BUF_ITEM(lip));
1106} 1105}
diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h
index f20bb472d582..0e2ed43f16c7 100644
--- a/fs/xfs/xfs_buf_item.h
+++ b/fs/xfs/xfs_buf_item.h
@@ -124,7 +124,7 @@ void xfs_buf_attach_iodone(struct xfs_buf *,
124 void(*)(struct xfs_buf *, xfs_log_item_t *), 124 void(*)(struct xfs_buf *, xfs_log_item_t *),
125 xfs_log_item_t *); 125 xfs_log_item_t *);
126void xfs_buf_iodone_callbacks(struct xfs_buf *); 126void xfs_buf_iodone_callbacks(struct xfs_buf *);
127void xfs_buf_iodone(struct xfs_buf *, xfs_buf_log_item_t *); 127void xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *);
128 128
129#ifdef XFS_TRANS_DEBUG 129#ifdef XFS_TRANS_DEBUG
130void 130void
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index dde2e5dc6c62..c7c48da97ad4 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1981,7 +1981,7 @@ xfs_ifree_cluster(
1981 if (lip->li_type == XFS_LI_INODE) { 1981 if (lip->li_type == XFS_LI_INODE) {
1982 iip = (xfs_inode_log_item_t *)lip; 1982 iip = (xfs_inode_log_item_t *)lip;
1983 ASSERT(iip->ili_logged == 1); 1983 ASSERT(iip->ili_logged == 1);
1984 lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done; 1984 lip->li_cb = xfs_istale_done;
1985 xfs_trans_ail_copy_lsn(mp->m_ail, 1985 xfs_trans_ail_copy_lsn(mp->m_ail,
1986 &iip->ili_flush_lsn, 1986 &iip->ili_flush_lsn,
1987 &iip->ili_item.li_lsn); 1987 &iip->ili_item.li_lsn);
@@ -2051,9 +2051,8 @@ xfs_ifree_cluster(
2051 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn, 2051 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn,
2052 &iip->ili_item.li_lsn); 2052 &iip->ili_item.li_lsn);
2053 2053
2054 xfs_buf_attach_iodone(bp, 2054 xfs_buf_attach_iodone(bp, xfs_istale_done,
2055 (void(*)(xfs_buf_t*,xfs_log_item_t*)) 2055 &iip->ili_item);
2056 xfs_istale_done, (xfs_log_item_t *)iip);
2057 2056
2058 if (ip != free_ip) 2057 if (ip != free_ip)
2059 xfs_iunlock(ip, XFS_ILOCK_EXCL); 2058 xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -3065,8 +3064,7 @@ xfs_iflush_int(
3065 * and unlock the inode's flush lock when the inode is 3064 * and unlock the inode's flush lock when the inode is
3066 * completely written to disk. 3065 * completely written to disk.
3067 */ 3066 */
3068 xfs_buf_attach_iodone(bp, (void(*)(xfs_buf_t*,xfs_log_item_t*)) 3067 xfs_buf_attach_iodone(bp, xfs_iflush_done, &iip->ili_item);
3069 xfs_iflush_done, (xfs_log_item_t *)iip);
3070 3068
3071 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 3069 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
3072 ASSERT(XFS_BUF_IODONE_FUNC(bp) != NULL); 3070 ASSERT(XFS_BUF_IODONE_FUNC(bp) != NULL);
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 2626aaca42f2..c7e70d708345 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -867,14 +867,14 @@ xfs_inode_item_destroy(
867 * from the AIL if it has not been re-logged, and unlocking the inode's 867 * from the AIL if it has not been re-logged, and unlocking the inode's
868 * flush lock. 868 * flush lock.
869 */ 869 */
870/*ARGSUSED*/
871void 870void
872xfs_iflush_done( 871xfs_iflush_done(
873 xfs_buf_t *bp, 872 struct xfs_buf *bp,
874 xfs_inode_log_item_t *iip) 873 struct xfs_log_item *lip)
875{ 874{
875 struct xfs_inode_log_item *iip = INODE_ITEM(lip);
876 xfs_inode_t *ip = iip->ili_inode; 876 xfs_inode_t *ip = iip->ili_inode;
877 struct xfs_ail *ailp = iip->ili_item.li_ailp; 877 struct xfs_ail *ailp = lip->li_ailp;
878 878
879 /* 879 /*
880 * We only want to pull the item from the AIL if it is 880 * We only want to pull the item from the AIL if it is
@@ -885,12 +885,11 @@ xfs_iflush_done(
885 * the lock since it's cheaper, and then we recheck while 885 * the lock since it's cheaper, and then we recheck while
886 * holding the lock before removing the inode from the AIL. 886 * holding the lock before removing the inode from the AIL.
887 */ 887 */
888 if (iip->ili_logged && 888 if (iip->ili_logged && lip->li_lsn == iip->ili_flush_lsn) {
889 (iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
890 spin_lock(&ailp->xa_lock); 889 spin_lock(&ailp->xa_lock);
891 if (iip->ili_item.li_lsn == iip->ili_flush_lsn) { 890 if (lip->li_lsn == iip->ili_flush_lsn) {
892 /* xfs_trans_ail_delete() drops the AIL lock. */ 891 /* xfs_trans_ail_delete() drops the AIL lock. */
893 xfs_trans_ail_delete(ailp, (xfs_log_item_t*)iip); 892 xfs_trans_ail_delete(ailp, lip);
894 } else { 893 } else {
895 spin_unlock(&ailp->xa_lock); 894 spin_unlock(&ailp->xa_lock);
896 } 895 }
@@ -908,8 +907,6 @@ xfs_iflush_done(
908 * Release the inode's flush lock since we're done with it. 907 * Release the inode's flush lock since we're done with it.
909 */ 908 */
910 xfs_ifunlock(ip); 909 xfs_ifunlock(ip);
911
912 return;
913} 910}
914 911
915/* 912/*
@@ -959,10 +956,10 @@ xfs_iflush_abort(
959 956
960void 957void
961xfs_istale_done( 958xfs_istale_done(
962 xfs_buf_t *bp, 959 struct xfs_buf *bp,
963 xfs_inode_log_item_t *iip) 960 struct xfs_log_item *lip)
964{ 961{
965 xfs_iflush_abort(iip->ili_inode); 962 xfs_iflush_abort(INODE_ITEM(lip)->ili_inode);
966} 963}
967 964
968/* 965/*
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
index 9a467958ecdd..b6a97ff1c3ab 100644
--- a/fs/xfs/xfs_inode_item.h
+++ b/fs/xfs/xfs_inode_item.h
@@ -161,8 +161,8 @@ static inline int xfs_inode_clean(xfs_inode_t *ip)
161 161
162extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); 162extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
163extern void xfs_inode_item_destroy(struct xfs_inode *); 163extern void xfs_inode_item_destroy(struct xfs_inode *);
164extern void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *); 164extern void xfs_iflush_done(struct xfs_buf *, struct xfs_log_item *);
165extern void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *); 165extern void xfs_istale_done(struct xfs_buf *, struct xfs_log_item *);
166extern void xfs_iflush_abort(struct xfs_inode *); 166extern void xfs_iflush_abort(struct xfs_inode *);
167extern int xfs_inode_item_format_convert(xfs_log_iovec_t *, 167extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
168 xfs_inode_log_format_t *); 168 xfs_inode_log_format_t *);
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index 74a1c33e4098..90af025e6839 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -658,7 +658,7 @@ xfs_trans_log_buf(xfs_trans_t *tp,
658 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 658 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
659 ASSERT(atomic_read(&bip->bli_refcount) > 0); 659 ASSERT(atomic_read(&bip->bli_refcount) > 0);
660 XFS_BUF_SET_IODONE_FUNC(bp, xfs_buf_iodone_callbacks); 660 XFS_BUF_SET_IODONE_FUNC(bp, xfs_buf_iodone_callbacks);
661 bip->bli_item.li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*))xfs_buf_iodone; 661 bip->bli_item.li_cb = xfs_buf_iodone;
662 662
663 trace_xfs_trans_log_buf(bip); 663 trace_xfs_trans_log_buf(bip);
664 664
@@ -815,12 +815,9 @@ xfs_trans_stale_inode_buf(
815 ASSERT(atomic_read(&bip->bli_refcount) > 0); 815 ASSERT(atomic_read(&bip->bli_refcount) > 0);
816 816
817 bip->bli_flags |= XFS_BLI_STALE_INODE; 817 bip->bli_flags |= XFS_BLI_STALE_INODE;
818 bip->bli_item.li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) 818 bip->bli_item.li_cb = xfs_buf_iodone;
819 xfs_buf_iodone;
820} 819}
821 820
822
823
824/* 821/*
825 * Mark the buffer as being one which contains newly allocated 822 * Mark the buffer as being one which contains newly allocated
826 * inodes. We need to make sure that even if this buffer is 823 * inodes. We need to make sure that even if this buffer is