--- initial
+++ final
@@ -1,114 +1,113 @@
 int xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset, xfs_off_t len, int alloc_type) {
   xfs_mount_t *mp = ip->i_mount;
   xfs_off_t count;
   xfs_filblks_t allocated_fsb;
   xfs_filblks_t allocatesize_fsb;
   xfs_extlen_t extsz, temp;
   xfs_fileoff_t startoffset_fsb;
   xfs_fsblock_t firstfsb;
   int nimaps;
   int quota_flag;
   int rt;
   xfs_trans_t *tp;
   xfs_bmbt_irec_t imaps[1], *imapp;
   struct xfs_defer_ops dfops;
   uint qblocks, resblks, resrtextents;
   int error;
   trace_xfs_alloc_file_space(ip);
   if (XFS_FORCED_SHUTDOWN(mp)) return -EIO;
   error = xfs_qm_dqattach(ip);
   if (error) return error;
   if (len <= 0) return -EINVAL;
   rt = XFS_IS_REALTIME_INODE(ip);
   extsz = xfs_get_extsz_hint(ip);
   count = len;
   imapp = &imaps[0];
   nimaps = 1;
   startoffset_fsb = XFS_B_TO_FSBT(mp, offset);
   allocatesize_fsb = XFS_B_TO_FSB(mp, count);
   /*
    * Allocate file space until done or until there is an error
    */
   while (allocatesize_fsb && !error) {
     xfs_fileoff_t s, e;
     /*
      * Determine space reservations for data/realtime.
      */
     if (unlikely(extsz)) {
       s = startoffset_fsb;
       do_div(s, extsz);
       s *= extsz;
       e = startoffset_fsb + allocatesize_fsb;
       div_u64_rem(startoffset_fsb, extsz, &temp);
       if (temp) e += temp;
       div_u64_rem(e, extsz, &temp);
       if (temp) e += extsz - temp;
     } else {
       s = 0;
       e = allocatesize_fsb;
     }
     /*
      * The transaction reservation is limited to a 32-bit block
      * count, hence we need to limit the number of blocks we are
      * trying to reserve to avoid an overflow. We can't allocate
      * more than @nimaps extents, and an extent is limited on disk
      * to MAXEXTLEN (21 bits), so use that to enforce the limit.
      */
     resblks = min_t(xfs_fileoff_t, (e - s), (MAXEXTLEN * nimaps));
     if (unlikely(rt)) {
       resrtextents = qblocks = resblks;
       resrtextents /= mp->m_sb.sb_rextsize;
       resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0);
       quota_flag = XFS_QMOPT_RES_RTBLKS;
     } else {
       resrtextents = 0;
       resblks = qblocks = XFS_DIOSTRAT_SPACE_RES(mp, resblks);
       quota_flag = XFS_QMOPT_RES_REGBLKS;
     }
     /*
      * Allocate and setup the transaction.
      */
     error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, resrtextents, 0, &tp);
     /*
      * Check for running out of space
      */
     if (error) {
       /*
        * Free the transaction structure.
        */
       ASSERT(error == -ENOSPC || XFS_FORCED_SHUTDOWN(mp));
       break;
     }
     xfs_ilock(ip, XFS_ILOCK_EXCL);
     error = xfs_trans_reserve_quota_nblks(tp, ip, qblocks, 0, quota_flag);
     if (error) goto error1;
     xfs_trans_ijoin(tp, ip, 0);
-    xfs_defer_init(&dfops, &firstfsb);
-    tp->t_dfops = &dfops;
+    xfs_defer_init(tp, &dfops, &firstfsb);
     error = xfs_bmapi_write(tp, ip, startoffset_fsb, allocatesize_fsb, alloc_type, &firstfsb, resblks, imapp, &nimaps);
     if (error) goto error0;
     /*
      * Complete the transaction
      */
     error = xfs_defer_finish(&tp, tp->t_dfops);
     if (error) goto error0;
     error = xfs_trans_commit(tp);
     xfs_iunlock(ip, XFS_ILOCK_EXCL);
     if (error) break;
     allocated_fsb = imapp->br_blockcount;
     if (nimaps == 0) {
       error = -ENOSPC;
       break;
     }
     startoffset_fsb += allocated_fsb;
     allocatesize_fsb -= allocated_fsb;
   }
   return error;
 error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */
   xfs_defer_cancel(&dfops);
   xfs_trans_unreserve_quota_nblks(tp, ip, (long)qblocks, 0, quota_flag);
 error1: /* Just cancel transaction */
   xfs_trans_cancel(tp);
   xfs_iunlock(ip, XFS_ILOCK_EXCL);
   return error;
 }<sep>@@
expression e1,e2,tp;
@@

-		xfs_defer_init(e1, e2);
-		(tp)->t_dfops = e1;
+		xfs_defer_init(tp, e1, e2);