Commit ca30b2a7b7ac899ac4da6030ccbebf2f137b8e6d

Authored by Christoph Hellwig
Committed by Alex Elder
1 parent 7bfa31d8e0

xfs: give li_cb callbacks the correct prototype

Stop the function pointer casting madness and give all the li_cb instances
correct prototype.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>

Showing 7 changed files with 68 additions and 82 deletions Side-by-side Diff

fs/xfs/quota/xfs_dquot.c
... ... @@ -54,8 +54,6 @@
54 54 flush lock - ditto.
55 55 */
56 56  
57   -STATIC void xfs_qm_dqflush_done(xfs_buf_t *, xfs_dq_logitem_t *);
58   -
59 57 #ifdef DEBUG
60 58 xfs_buftarg_t *xfs_dqerror_target;
61 59 int xfs_do_dqerror;
62 60  
... ... @@ -1131,7 +1129,47 @@
1131 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 + */
  1139 +STATIC void
  1140 +xfs_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;
1134 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 +}
  1172 +
1135 1173 /*
1136 1174 * Write a modified dquot to disk.
1137 1175 * The dquot must be locked and the flush lock too taken by caller.
... ... @@ -1212,8 +1250,9 @@
1212 1250 * Attach an iodone routine so that we can remove this dquot from the
1213 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 *))
1216   - xfs_qm_dqflush_done, &(dqp->q_logitem.qli_item));
  1253 + xfs_buf_attach_iodone(bp, xfs_qm_dqflush_done,
  1254 + &dqp->q_logitem.qli_item);
  1255 +
1217 1256 /*
1218 1257 * If the buffer is pinned then push on the log so we won't
1219 1258 * get stuck waiting in the write for too long.
... ... @@ -1235,50 +1274,6 @@
1235 1274 */
1236 1275 return error;
1237 1276  
1238   -}
1239   -
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*/
1248   -STATIC void
1249   -xfs_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 1277 }
1283 1278  
1284 1279 int
fs/xfs/xfs_buf_item.c
... ... @@ -1079,15 +1079,14 @@
1079 1079 * It is called by xfs_buf_iodone_callbacks() above which will take
1080 1080 * care of cleaning up the buffer itself.
1081 1081 */
1082   -/* ARGSUSED */
1083 1082 void
1084 1083 xfs_buf_iodone(
1085   - xfs_buf_t *bp,
1086   - xfs_buf_log_item_t *bip)
  1084 + struct xfs_buf *bp,
  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 1091 xfs_buf_rele(bp);
1093 1092  
... ... @@ -1101,7 +1100,7 @@
1101 1100 * Either way, AIL is useless if we're forcing a shutdown.
1102 1101 */
1103 1102 spin_lock(&ailp->xa_lock);
1104   - xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip);
1105   - xfs_buf_item_free(bip);
  1103 + xfs_trans_ail_delete(ailp, lip);
  1104 + xfs_buf_item_free(BUF_ITEM(lip));
1106 1105 }
fs/xfs/xfs_buf_item.h
... ... @@ -124,7 +124,7 @@
124 124 void(*)(struct xfs_buf *, xfs_log_item_t *),
125 125 xfs_log_item_t *);
126 126 void xfs_buf_iodone_callbacks(struct xfs_buf *);
127   -void xfs_buf_iodone(struct xfs_buf *, xfs_buf_log_item_t *);
  127 +void xfs_buf_iodone(struct xfs_buf *, struct xfs_log_item *);
128 128  
129 129 #ifdef XFS_TRANS_DEBUG
130 130 void
... ... @@ -1981,7 +1981,7 @@
1981 1981 if (lip->li_type == XFS_LI_INODE) {
1982 1982 iip = (xfs_inode_log_item_t *)lip;
1983 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 1985 xfs_trans_ail_copy_lsn(mp->m_ail,
1986 1986 &iip->ili_flush_lsn,
1987 1987 &iip->ili_item.li_lsn);
... ... @@ -2051,9 +2051,8 @@
2051 2051 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn,
2052 2052 &iip->ili_item.li_lsn);
2053 2053  
2054   - xfs_buf_attach_iodone(bp,
2055   - (void(*)(xfs_buf_t*,xfs_log_item_t*))
2056   - xfs_istale_done, (xfs_log_item_t *)iip);
  2054 + xfs_buf_attach_iodone(bp, xfs_istale_done,
  2055 + &iip->ili_item);
2057 2056  
2058 2057 if (ip != free_ip)
2059 2058 xfs_iunlock(ip, XFS_ILOCK_EXCL);
... ... @@ -3065,8 +3064,7 @@
3065 3064 * and unlock the inode's flush lock when the inode is
3066 3065 * completely written to disk.
3067 3066 */
3068   - xfs_buf_attach_iodone(bp, (void(*)(xfs_buf_t*,xfs_log_item_t*))
3069   - xfs_iflush_done, (xfs_log_item_t *)iip);
  3067 + xfs_buf_attach_iodone(bp, xfs_iflush_done, &iip->ili_item);
3070 3068  
3071 3069 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
3072 3070 ASSERT(XFS_BUF_IODONE_FUNC(bp) != NULL);
fs/xfs/xfs_inode_item.c
... ... @@ -867,14 +867,14 @@
867 867 * from the AIL if it has not been re-logged, and unlocking the inode's
868 868 * flush lock.
869 869 */
870   -/*ARGSUSED*/
871 870 void
872 871 xfs_iflush_done(
873   - xfs_buf_t *bp,
874   - xfs_inode_log_item_t *iip)
  872 + struct xfs_buf *bp,
  873 + struct xfs_log_item *lip)
875 874 {
  875 + struct xfs_inode_log_item *iip = INODE_ITEM(lip);
876 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 880 * We only want to pull the item from the AIL if it is
881 881  
882 882  
... ... @@ -885,12 +885,11 @@
885 885 * the lock since it's cheaper, and then we recheck while
886 886 * holding the lock before removing the inode from the AIL.
887 887 */
888   - if (iip->ili_logged &&
889   - (iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
  888 + if (iip->ili_logged && lip->li_lsn == iip->ili_flush_lsn) {
890 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 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 893 } else {
895 894 spin_unlock(&ailp->xa_lock);
896 895 }
... ... @@ -908,8 +907,6 @@
908 907 * Release the inode's flush lock since we're done with it.
909 908 */
910 909 xfs_ifunlock(ip);
911   -
912   - return;
913 910 }
914 911  
915 912 /*
916 913  
... ... @@ -959,10 +956,10 @@
959 956  
960 957 void
961 958 xfs_istale_done(
962   - xfs_buf_t *bp,
963   - xfs_inode_log_item_t *iip)
  959 + struct xfs_buf *bp,
  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 /*
fs/xfs/xfs_inode_item.h
... ... @@ -161,8 +161,8 @@
161 161  
162 162 extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
163 163 extern void xfs_inode_item_destroy(struct xfs_inode *);
164   -extern void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *);
165   -extern void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *);
  164 +extern void xfs_iflush_done(struct xfs_buf *, struct xfs_log_item *);
  165 +extern void xfs_istale_done(struct xfs_buf *, struct xfs_log_item *);
166 166 extern void xfs_iflush_abort(struct xfs_inode *);
167 167 extern int xfs_inode_item_format_convert(xfs_log_iovec_t *,
168 168 xfs_inode_log_format_t *);
fs/xfs/xfs_trans_buf.c
... ... @@ -658,7 +658,7 @@
658 658 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
659 659 ASSERT(atomic_read(&bip->bli_refcount) > 0);
660 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 663 trace_xfs_trans_log_buf(bip);
664 664  
665 665  
... ... @@ -815,11 +815,8 @@
815 815 ASSERT(atomic_read(&bip->bli_refcount) > 0);
816 816  
817 817 bip->bli_flags |= XFS_BLI_STALE_INODE;
818   - bip->bli_item.li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*))
819   - xfs_buf_iodone;
  818 + bip->bli_item.li_cb = xfs_buf_iodone;
820 819 }
821   -
822   -
823 820  
824 821 /*
825 822 * Mark the buffer as being one which contains newly allocated