Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
[firefly-linux-kernel-4.4.55.git] / fs / xfs / xfs_bmap.c
index ff8675b41973ab4e12ca6945536e44a3fffaaafb..23f14e595c18cd3a8068796f5b73396fa9db98f9 100644 (file)
@@ -101,7 +101,6 @@ xfs_bmap_add_extent(
        xfs_fsblock_t           *first, /* pointer to firstblock variable */
        xfs_bmap_free_t         *flist, /* list of extents to be freed */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     whichfork, /* data or attr fork */
        int                     rsvd);  /* OK to allocate reserved blocks */
 
@@ -119,7 +118,6 @@ xfs_bmap_add_extent_delay_real(
        xfs_fsblock_t           *first, /* pointer to firstblock variable */
        xfs_bmap_free_t         *flist, /* list of extents to be freed */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     rsvd);  /* OK to allocate reserved blocks */
 
 /*
@@ -132,7 +130,6 @@ xfs_bmap_add_extent_hole_delay(
        xfs_extnum_t            idx,    /* extent number to update/insert */
        xfs_bmbt_irec_t         *new,   /* new data to add to file extents */
        int                     *logflagsp,/* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     rsvd);  /* OK to allocate reserved blocks */
 
 /*
@@ -146,7 +143,6 @@ xfs_bmap_add_extent_hole_real(
        xfs_btree_cur_t         *cur,   /* if null, not a btree */
        xfs_bmbt_irec_t         *new,   /* new data to add to file extents */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     whichfork); /* data or attr fork */
 
 /*
@@ -159,8 +155,7 @@ xfs_bmap_add_extent_unwritten_real(
        xfs_extnum_t            idx,    /* extent number to update/insert */
        xfs_btree_cur_t         **curp, /* if *curp is null, not a btree */
        xfs_bmbt_irec_t         *new,   /* new data to add to file extents */
-       int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta); /* Change made to incore extents */
+       int                     *logflagsp); /* inode logging flags */
 
 /*
  * xfs_bmap_alloc is called by xfs_bmapi to allocate an extent for a file.
@@ -197,7 +192,6 @@ xfs_bmap_del_extent(
        xfs_btree_cur_t         *cur,   /* if null, not a btree */
        xfs_bmbt_irec_t         *new,   /* new data to add to file extents */
        int                     *logflagsp,/* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     whichfork, /* data or attr fork */
        int                     rsvd);   /* OK to allocate reserved blocks */
 
@@ -486,7 +480,6 @@ xfs_bmap_add_extent(
        xfs_fsblock_t           *first, /* pointer to firstblock variable */
        xfs_bmap_free_t         *flist, /* list of extents to be freed */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     whichfork, /* data or attr fork */
        int                     rsvd)   /* OK to use reserved data blocks */
 {
@@ -521,15 +514,6 @@ xfs_bmap_add_extent(
                        logflags = XFS_ILOG_CORE | xfs_ilog_fext(whichfork);
                } else
                        logflags = 0;
-               /* DELTA: single new extent */
-               if (delta) {
-                       if (delta->xed_startoff > new->br_startoff)
-                               delta->xed_startoff = new->br_startoff;
-                       if (delta->xed_blockcount <
-                                       new->br_startoff + new->br_blockcount)
-                               delta->xed_blockcount = new->br_startoff +
-                                               new->br_blockcount;
-               }
        }
        /*
         * Any kind of new delayed allocation goes here.
@@ -539,7 +523,7 @@ xfs_bmap_add_extent(
                        ASSERT((cur->bc_private.b.flags &
                                XFS_BTCUR_BPRV_WASDEL) == 0);
                if ((error = xfs_bmap_add_extent_hole_delay(ip, idx, new,
-                               &logflags, delta, rsvd)))
+                               &logflags, rsvd)))
                        goto done;
        }
        /*
@@ -550,7 +534,7 @@ xfs_bmap_add_extent(
                        ASSERT((cur->bc_private.b.flags &
                                XFS_BTCUR_BPRV_WASDEL) == 0);
                if ((error = xfs_bmap_add_extent_hole_real(ip, idx, cur, new,
-                               &logflags, delta, whichfork)))
+                               &logflags, whichfork)))
                        goto done;
        } else {
                xfs_bmbt_irec_t prev;   /* old extent at offset idx */
@@ -575,17 +559,17 @@ xfs_bmap_add_extent(
                                                XFS_BTCUR_BPRV_WASDEL);
                                if ((error = xfs_bmap_add_extent_delay_real(ip,
                                        idx, &cur, new, &da_new, first, flist,
-                                       &logflags, delta, rsvd)))
+                                       &logflags, rsvd)))
                                        goto done;
                        } else if (new->br_state == XFS_EXT_NORM) {
                                ASSERT(new->br_state == XFS_EXT_NORM);
                                if ((error = xfs_bmap_add_extent_unwritten_real(
-                                       ip, idx, &cur, new, &logflags, delta)))
+                                       ip, idx, &cur, new, &logflags)))
                                        goto done;
                        } else {
                                ASSERT(new->br_state == XFS_EXT_UNWRITTEN);
                                if ((error = xfs_bmap_add_extent_unwritten_real(
-                                       ip, idx, &cur, new, &logflags, delta)))
+                                       ip, idx, &cur, new, &logflags)))
                                        goto done;
                        }
                        ASSERT(*curp == cur || *curp == NULL);
@@ -598,7 +582,7 @@ xfs_bmap_add_extent(
                                ASSERT((cur->bc_private.b.flags &
                                        XFS_BTCUR_BPRV_WASDEL) == 0);
                        if ((error = xfs_bmap_add_extent_hole_real(ip, idx, cur,
-                                       new, &logflags, delta, whichfork)))
+                                       new, &logflags, whichfork)))
                                goto done;
                }
        }
@@ -663,7 +647,6 @@ xfs_bmap_add_extent_delay_real(
        xfs_fsblock_t           *first, /* pointer to firstblock variable */
        xfs_bmap_free_t         *flist, /* list of extents to be freed */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     rsvd)   /* OK to use reserved data block allocation */
 {
        xfs_btree_cur_t         *cur;   /* btree cursor */
@@ -794,11 +777,6 @@ xfs_bmap_add_extent_delay_real(
                                goto done;
                }
                *dnew = 0;
-               /* DELTA: Three in-core extents are replaced by one. */
-               temp = LEFT.br_startoff;
-               temp2 = LEFT.br_blockcount +
-                       PREV.br_blockcount +
-                       RIGHT.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING | BMAP_LEFT_CONTIG:
@@ -829,10 +807,6 @@ xfs_bmap_add_extent_delay_real(
                                goto done;
                }
                *dnew = 0;
-               /* DELTA: Two in-core extents are replaced by one. */
-               temp = LEFT.br_startoff;
-               temp2 = LEFT.br_blockcount +
-                       PREV.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING | BMAP_RIGHT_CONTIG:
@@ -864,10 +838,6 @@ xfs_bmap_add_extent_delay_real(
                                goto done;
                }
                *dnew = 0;
-               /* DELTA: Two in-core extents are replaced by one. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount +
-                       RIGHT.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING:
@@ -897,9 +867,6 @@ xfs_bmap_add_extent_delay_real(
                        XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
                *dnew = 0;
-               /* DELTA: The in-core extent described by new changed type. */
-               temp = new->br_startoff;
-               temp2 = new->br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_LEFT_CONTIG:
@@ -939,10 +906,6 @@ xfs_bmap_add_extent_delay_real(
                xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
                trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
                *dnew = temp;
-               /* DELTA: The boundary between two in-core extents moved. */
-               temp = LEFT.br_startoff;
-               temp2 = LEFT.br_blockcount +
-                       PREV.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING:
@@ -987,9 +950,6 @@ xfs_bmap_add_extent_delay_real(
                xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
                trace_xfs_bmap_post_update(ip, idx + 1, state, _THIS_IP_);
                *dnew = temp;
-               /* DELTA: One in-core extent is split in two. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount;
                break;
 
        case BMAP_RIGHT_FILLING | BMAP_RIGHT_CONTIG:
@@ -1028,10 +988,6 @@ xfs_bmap_add_extent_delay_real(
                xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
                trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
                *dnew = temp;
-               /* DELTA: The boundary between two in-core extents moved. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount +
-                       RIGHT.br_blockcount;
                break;
 
        case BMAP_RIGHT_FILLING:
@@ -1075,9 +1031,6 @@ xfs_bmap_add_extent_delay_real(
                xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
                trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
                *dnew = temp;
-               /* DELTA: One in-core extent is split in two. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount;
                break;
 
        case 0:
@@ -1158,9 +1111,6 @@ xfs_bmap_add_extent_delay_real(
                        nullstartblock((int)temp2));
                trace_xfs_bmap_post_update(ip, idx + 2, state, _THIS_IP_);
                *dnew = temp + temp2;
-               /* DELTA: One in-core extent is split in three. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_LEFT_CONTIG | BMAP_RIGHT_CONTIG:
@@ -1176,13 +1126,6 @@ xfs_bmap_add_extent_delay_real(
                ASSERT(0);
        }
        *curp = cur;
-       if (delta) {
-               temp2 += temp;
-               if (delta->xed_startoff > temp)
-                       delta->xed_startoff = temp;
-               if (delta->xed_blockcount < temp2)
-                       delta->xed_blockcount = temp2;
-       }
 done:
        *logflagsp = rval;
        return error;
@@ -1201,8 +1144,7 @@ xfs_bmap_add_extent_unwritten_real(
        xfs_extnum_t            idx,    /* extent number to update/insert */
        xfs_btree_cur_t         **curp, /* if *curp is null, not a btree */
        xfs_bmbt_irec_t         *new,   /* new data to add to file extents */
-       int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta) /* Change made to incore extents */
+       int                     *logflagsp) /* inode logging flags */
 {
        xfs_btree_cur_t         *cur;   /* btree cursor */
        xfs_bmbt_rec_host_t     *ep;    /* extent entry for idx */
@@ -1216,8 +1158,6 @@ xfs_bmap_add_extent_unwritten_real(
                                        /* left is 0, right is 1, prev is 2 */
        int                     rval=0; /* return value (logging flags) */
        int                     state = 0;/* state bits, accessed thru macros */
-       xfs_filblks_t           temp=0;
-       xfs_filblks_t           temp2=0;
 
 #define        LEFT            r[0]
 #define        RIGHT           r[1]
@@ -1338,11 +1278,6 @@ xfs_bmap_add_extent_unwritten_real(
                                RIGHT.br_blockcount, LEFT.br_state)))
                                goto done;
                }
-               /* DELTA: Three in-core extents are replaced by one. */
-               temp = LEFT.br_startoff;
-               temp2 = LEFT.br_blockcount +
-                       PREV.br_blockcount +
-                       RIGHT.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING | BMAP_LEFT_CONTIG:
@@ -1379,10 +1314,6 @@ xfs_bmap_add_extent_unwritten_real(
                                LEFT.br_state)))
                                goto done;
                }
-               /* DELTA: Two in-core extents are replaced by one. */
-               temp = LEFT.br_startoff;
-               temp2 = LEFT.br_blockcount +
-                       PREV.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING | BMAP_RIGHT_CONTIG:
@@ -1419,10 +1350,6 @@ xfs_bmap_add_extent_unwritten_real(
                                newext)))
                                goto done;
                }
-               /* DELTA: Two in-core extents are replaced by one. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount +
-                       RIGHT.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_RIGHT_FILLING:
@@ -1450,9 +1377,6 @@ xfs_bmap_add_extent_unwritten_real(
                                newext)))
                                goto done;
                }
-               /* DELTA: The in-core extent described by new changed type. */
-               temp = new->br_startoff;
-               temp2 = new->br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_LEFT_CONTIG:
@@ -1498,10 +1422,6 @@ xfs_bmap_add_extent_unwritten_real(
                                LEFT.br_state))
                                goto done;
                }
-               /* DELTA: The boundary between two in-core extents moved. */
-               temp = LEFT.br_startoff;
-               temp2 = LEFT.br_blockcount +
-                       PREV.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING:
@@ -1541,9 +1461,6 @@ xfs_bmap_add_extent_unwritten_real(
                                goto done;
                        XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
-               /* DELTA: One in-core extent is split in two. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount;
                break;
 
        case BMAP_RIGHT_FILLING | BMAP_RIGHT_CONTIG:
@@ -1584,10 +1501,6 @@ xfs_bmap_add_extent_unwritten_real(
                                newext)))
                                goto done;
                }
-               /* DELTA: The boundary between two in-core extents moved. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount +
-                       RIGHT.br_blockcount;
                break;
 
        case BMAP_RIGHT_FILLING:
@@ -1627,9 +1540,6 @@ xfs_bmap_add_extent_unwritten_real(
                                goto done;
                        XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
-               /* DELTA: One in-core extent is split in two. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount;
                break;
 
        case 0:
@@ -1689,9 +1599,6 @@ xfs_bmap_add_extent_unwritten_real(
                                goto done;
                        XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
-               /* DELTA: One in-core extent is split in three. */
-               temp = PREV.br_startoff;
-               temp2 = PREV.br_blockcount;
                break;
 
        case BMAP_LEFT_FILLING | BMAP_LEFT_CONTIG | BMAP_RIGHT_CONTIG:
@@ -1707,13 +1614,6 @@ xfs_bmap_add_extent_unwritten_real(
                ASSERT(0);
        }
        *curp = cur;
-       if (delta) {
-               temp2 += temp;
-               if (delta->xed_startoff > temp)
-                       delta->xed_startoff = temp;
-               if (delta->xed_blockcount < temp2)
-                       delta->xed_blockcount = temp2;
-       }
 done:
        *logflagsp = rval;
        return error;
@@ -1733,7 +1633,6 @@ xfs_bmap_add_extent_hole_delay(
        xfs_extnum_t            idx,    /* extent number to update/insert */
        xfs_bmbt_irec_t         *new,   /* new data to add to file extents */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     rsvd)           /* OK to allocate reserved blocks */
 {
        xfs_bmbt_rec_host_t     *ep;    /* extent record for idx */
@@ -1744,7 +1643,6 @@ xfs_bmap_add_extent_hole_delay(
        xfs_bmbt_irec_t         right;  /* right neighbor extent entry */
        int                     state;  /* state bits, accessed thru macros */
        xfs_filblks_t           temp=0; /* temp for indirect calculations */
-       xfs_filblks_t           temp2=0;
 
        ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
        ep = xfs_iext_get_ext(ifp, idx);
@@ -1816,9 +1714,6 @@ xfs_bmap_add_extent_hole_delay(
 
                xfs_iext_remove(ip, idx, 1, state);
                ip->i_df.if_lastex = idx - 1;
-               /* DELTA: Two in-core extents were replaced by one. */
-               temp2 = temp;
-               temp = left.br_startoff;
                break;
 
        case BMAP_LEFT_CONTIG:
@@ -1838,9 +1733,6 @@ xfs_bmap_add_extent_hole_delay(
                trace_xfs_bmap_post_update(ip, idx - 1, state, _THIS_IP_);
 
                ip->i_df.if_lastex = idx - 1;
-               /* DELTA: One in-core extent grew into a hole. */
-               temp2 = temp;
-               temp = left.br_startoff;
                break;
 
        case BMAP_RIGHT_CONTIG:
@@ -1859,9 +1751,6 @@ xfs_bmap_add_extent_hole_delay(
                trace_xfs_bmap_post_update(ip, idx, state, _THIS_IP_);
 
                ip->i_df.if_lastex = idx;
-               /* DELTA: One in-core extent grew into a hole. */
-               temp2 = temp;
-               temp = new->br_startoff;
                break;
 
        case 0:
@@ -1873,9 +1762,6 @@ xfs_bmap_add_extent_hole_delay(
                oldlen = newlen = 0;
                xfs_iext_insert(ip, idx, 1, new, state);
                ip->i_df.if_lastex = idx;
-               /* DELTA: A new in-core extent was added in a hole. */
-               temp2 = new->br_blockcount;
-               temp = new->br_startoff;
                break;
        }
        if (oldlen != newlen) {
@@ -1886,13 +1772,6 @@ xfs_bmap_add_extent_hole_delay(
                 * Nothing to do for disk quota accounting here.
                 */
        }
-       if (delta) {
-               temp2 += temp;
-               if (delta->xed_startoff > temp)
-                       delta->xed_startoff = temp;
-               if (delta->xed_blockcount < temp2)
-                       delta->xed_blockcount = temp2;
-       }
        *logflagsp = 0;
        return 0;
 }
@@ -1908,7 +1787,6 @@ xfs_bmap_add_extent_hole_real(
        xfs_btree_cur_t         *cur,   /* if null, not a btree */
        xfs_bmbt_irec_t         *new,   /* new data to add to file extents */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     whichfork) /* data or attr fork */
 {
        xfs_bmbt_rec_host_t     *ep;    /* pointer to extent entry ins. point */
@@ -1919,8 +1797,6 @@ xfs_bmap_add_extent_hole_real(
        xfs_bmbt_irec_t         right;  /* right neighbor extent entry */
        int                     rval=0; /* return value (logging flags) */
        int                     state;  /* state bits, accessed thru macros */
-       xfs_filblks_t           temp=0;
-       xfs_filblks_t           temp2=0;
 
        ifp = XFS_IFORK_PTR(ip, whichfork);
        ASSERT(idx <= ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t));
@@ -2017,11 +1893,6 @@ xfs_bmap_add_extent_hole_real(
                                        left.br_state)))
                                goto done;
                }
-               /* DELTA: Two in-core extents were replaced by one. */
-               temp = left.br_startoff;
-               temp2 = left.br_blockcount +
-                       new->br_blockcount +
-                       right.br_blockcount;
                break;
 
        case BMAP_LEFT_CONTIG:
@@ -2053,10 +1924,6 @@ xfs_bmap_add_extent_hole_real(
                                        left.br_state)))
                                goto done;
                }
-               /* DELTA: One in-core extent grew. */
-               temp = left.br_startoff;
-               temp2 = left.br_blockcount +
-                       new->br_blockcount;
                break;
 
        case BMAP_RIGHT_CONTIG:
@@ -2089,10 +1956,6 @@ xfs_bmap_add_extent_hole_real(
                                        right.br_state)))
                                goto done;
                }
-               /* DELTA: One in-core extent grew. */
-               temp = new->br_startoff;
-               temp2 = new->br_blockcount +
-                       right.br_blockcount;
                break;
 
        case 0:
@@ -2120,18 +1983,8 @@ xfs_bmap_add_extent_hole_real(
                                goto done;
                        XFS_WANT_CORRUPTED_GOTO(i == 1, done);
                }
-               /* DELTA: A new extent was added in a hole. */
-               temp = new->br_startoff;
-               temp2 = new->br_blockcount;
                break;
        }
-       if (delta) {
-               temp2 += temp;
-               if (delta->xed_startoff > temp)
-                       delta->xed_startoff = temp;
-               if (delta->xed_blockcount < temp2)
-                       delta->xed_blockcount = temp2;
-       }
 done:
        *logflagsp = rval;
        return error;
@@ -2956,7 +2809,6 @@ xfs_bmap_del_extent(
        xfs_btree_cur_t         *cur,   /* if null, not a btree */
        xfs_bmbt_irec_t         *del,   /* data to remove from extents */
        int                     *logflagsp, /* inode logging flags */
-       xfs_extdelta_t          *delta, /* Change made to incore extents */
        int                     whichfork, /* data or attr fork */
        int                     rsvd)   /* OK to allocate reserved blocks */
 {
@@ -3262,14 +3114,6 @@ xfs_bmap_del_extent(
        if (da_old > da_new)
                xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, (int64_t)(da_old - da_new),
                        rsvd);
-       if (delta) {
-               /* DELTA: report the original extent. */
-               if (delta->xed_startoff > got.br_startoff)
-                       delta->xed_startoff = got.br_startoff;
-               if (delta->xed_blockcount < got.br_startoff+got.br_blockcount)
-                       delta->xed_blockcount = got.br_startoff +
-                                                       got.br_blockcount;
-       }
 done:
        *logflagsp = flags;
        return error;
@@ -3751,9 +3595,10 @@ xfs_bmap_add_attrfork(
                ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
        }
        ASSERT(ip->i_d.di_anextents == 0);
-       IHOLD(ip);
-       xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
+
+       xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+
        switch (ip->i_d.di_format) {
        case XFS_DINODE_FMT_DEV:
                ip->i_d.di_forkoff = roundup(sizeof(xfs_dev_t), 8) >> 3;
@@ -4480,8 +4325,7 @@ xfs_bmapi(
        xfs_extlen_t    total,          /* total blocks needed */
        xfs_bmbt_irec_t *mval,          /* output: map values */
        int             *nmap,          /* i/o: mval size/count */
-       xfs_bmap_free_t *flist,         /* i/o: list extents to free */
-       xfs_extdelta_t  *delta)         /* o: change made to incore extents */
+       xfs_bmap_free_t *flist)         /* i/o: list extents to free */
 {
        xfs_fsblock_t   abno;           /* allocated block number */
        xfs_extlen_t    alen;           /* allocated extent length */
@@ -4593,10 +4437,7 @@ xfs_bmapi(
        end = bno + len;
        obno = bno;
        bma.ip = NULL;
-       if (delta) {
-               delta->xed_startoff = NULLFILEOFF;
-               delta->xed_blockcount = 0;
-       }
+
        while (bno < end && n < *nmap) {
                /*
                 * Reading past eof, act as though there's a hole
@@ -4617,19 +4458,13 @@ xfs_bmapi(
                         * allocate the stuff asked for in this bmap call
                         * but that wouldn't be as good.
                         */
-                       if (wasdelay && !(flags & XFS_BMAPI_EXACT)) {
+                       if (wasdelay) {
                                alen = (xfs_extlen_t)got.br_blockcount;
                                aoff = got.br_startoff;
                                if (lastx != NULLEXTNUM && lastx) {
                                        ep = xfs_iext_get_ext(ifp, lastx - 1);
                                        xfs_bmbt_get_all(ep, &prev);
                                }
-                       } else if (wasdelay) {
-                               alen = (xfs_extlen_t)
-                                       XFS_FILBLKS_MIN(len,
-                                               (got.br_startoff +
-                                                got.br_blockcount) - bno);
-                               aoff = bno;
                        } else {
                                alen = (xfs_extlen_t)
                                        XFS_FILBLKS_MIN(len, MAXEXTLEN);
@@ -4828,7 +4663,7 @@ xfs_bmapi(
                                        got.br_state = XFS_EXT_UNWRITTEN;
                        }
                        error = xfs_bmap_add_extent(ip, lastx, &cur, &got,
-                               firstblock, flist, &tmp_logflags, delta,
+                               firstblock, flist, &tmp_logflags,
                                whichfork, (flags & XFS_BMAPI_RSVBLOCKS));
                        logflags |= tmp_logflags;
                        if (error)
@@ -4924,7 +4759,7 @@ xfs_bmapi(
                        }
                        mval->br_state = XFS_EXT_NORM;
                        error = xfs_bmap_add_extent(ip, lastx, &cur, mval,
-                               firstblock, flist, &tmp_logflags, delta,
+                               firstblock, flist, &tmp_logflags,
                                whichfork, (flags & XFS_BMAPI_RSVBLOCKS));
                        logflags |= tmp_logflags;
                        if (error)
@@ -5014,14 +4849,6 @@ xfs_bmapi(
        ASSERT(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE ||
               XFS_IFORK_NEXTENTS(ip, whichfork) > ifp->if_ext_max);
        error = 0;
-       if (delta && delta->xed_startoff != NULLFILEOFF) {
-               /* A change was actually made.
-                * Note that delta->xed_blockount is an offset at this
-                * point and needs to be converted to a block count.
-                */
-               ASSERT(delta->xed_blockcount > delta->xed_startoff);
-               delta->xed_blockcount -= delta->xed_startoff;
-       }
 error0:
        /*
         * Log everything.  Do this after conversion, there's no point in
@@ -5133,8 +4960,6 @@ xfs_bunmapi(
        xfs_fsblock_t           *firstblock,    /* first allocated block
                                                   controls a.g. for allocs */
        xfs_bmap_free_t         *flist,         /* i/o: list extents to free */
-       xfs_extdelta_t          *delta,         /* o: change made to incore
-                                                  extents */
        int                     *done)          /* set if not done yet */
 {
        xfs_btree_cur_t         *cur;           /* bmap btree cursor */
@@ -5193,10 +5018,7 @@ xfs_bunmapi(
        bno = start + len - 1;
        ep = xfs_bmap_search_extents(ip, bno, whichfork, &eof, &lastx, &got,
                &prev);
-       if (delta) {
-               delta->xed_startoff = NULLFILEOFF;
-               delta->xed_blockcount = 0;
-       }
+
        /*
         * Check to see if the given block number is past the end of the
         * file, back up to the last block if so...
@@ -5294,7 +5116,7 @@ xfs_bunmapi(
                        }
                        del.br_state = XFS_EXT_UNWRITTEN;
                        error = xfs_bmap_add_extent(ip, lastx, &cur, &del,
-                               firstblock, flist, &logflags, delta,
+                               firstblock, flist, &logflags,
                                XFS_DATA_FORK, 0);
                        if (error)
                                goto error0;
@@ -5349,7 +5171,7 @@ xfs_bunmapi(
                                prev.br_state = XFS_EXT_UNWRITTEN;
                                error = xfs_bmap_add_extent(ip, lastx - 1, &cur,
                                        &prev, firstblock, flist, &logflags,
-                                       delta, XFS_DATA_FORK, 0);
+                                       XFS_DATA_FORK, 0);
                                if (error)
                                        goto error0;
                                goto nodelete;
@@ -5358,7 +5180,7 @@ xfs_bunmapi(
                                del.br_state = XFS_EXT_UNWRITTEN;
                                error = xfs_bmap_add_extent(ip, lastx, &cur,
                                        &del, firstblock, flist, &logflags,
-                                       delta, XFS_DATA_FORK, 0);
+                                       XFS_DATA_FORK, 0);
                                if (error)
                                        goto error0;
                                goto nodelete;
@@ -5411,7 +5233,7 @@ xfs_bunmapi(
                        goto error0;
                }
                error = xfs_bmap_del_extent(ip, tp, lastx, flist, cur, &del,
-                               &tmp_logflags, delta, whichfork, rsvd);
+                               &tmp_logflags, whichfork, rsvd);
                logflags |= tmp_logflags;
                if (error)
                        goto error0;
@@ -5468,14 +5290,6 @@ nodelete:
        ASSERT(ifp->if_ext_max ==
               XFS_IFORK_SIZE(ip, whichfork) / (uint)sizeof(xfs_bmbt_rec_t));
        error = 0;
-       if (delta && delta->xed_startoff != NULLFILEOFF) {
-               /* A change was actually made.
-                * Note that delta->xed_blockount is an offset at this
-                * point and needs to be converted to a block count.
-                */
-               ASSERT(delta->xed_blockcount > delta->xed_startoff);
-               delta->xed_blockcount -= delta->xed_startoff;
-       }
 error0:
        /*
         * Log everything.  Do this after conversion, there's no point in
@@ -5688,7 +5502,7 @@ xfs_getbmap(
                error = xfs_bmapi(NULL, ip, XFS_BB_TO_FSBT(mp, bmv->bmv_offset),
                                  XFS_BB_TO_FSB(mp, bmv->bmv_length),
                                  bmapi_flags, NULL, 0, map, &nmap,
-                                 NULL, NULL);
+                                 NULL);
                if (error)
                        goto out_free_map;
                ASSERT(nmap <= subnex);
@@ -5834,41 +5648,34 @@ xfs_bmap_eof(
 }
 
 #ifdef DEBUG
-STATIC
-xfs_buf_t *
+STATIC struct xfs_buf *
 xfs_bmap_get_bp(
-       xfs_btree_cur_t         *cur,
+       struct xfs_btree_cur    *cur,
        xfs_fsblock_t           bno)
 {
-       int i;
-       xfs_buf_t *bp;
+       struct xfs_log_item_desc *lidp;
+       int                     i;
 
        if (!cur)
-               return(NULL);
-
-       bp = NULL;
-       for(i = 0; i < XFS_BTREE_MAXLEVELS; i++) {
-               bp = cur->bc_bufs[i];
-               if (!bp) break;
-               if (XFS_BUF_ADDR(bp) == bno)
-                       break;  /* Found it */
+               return NULL;
+
+       for (i = 0; i < XFS_BTREE_MAXLEVELS; i++) {
+               if (!cur->bc_bufs[i])
+                       break;
+               if (XFS_BUF_ADDR(cur->bc_bufs[i]) == bno)
+                       return cur->bc_bufs[i];
        }
-       if (i == XFS_BTREE_MAXLEVELS)
-               bp = NULL;
 
-       if (!bp) { /* Chase down all the log items to see if the bp is there */
-               struct xfs_log_item_desc *lidp;
+       /* Chase down all the log items to see if the bp is there */
+       list_for_each_entry(lidp, &cur->bc_tp->t_items, lid_trans) {
                struct xfs_buf_log_item *bip;
-
-               list_for_each_entry(lidp, &cur->bc_tp->t_items, lid_trans) {
-                       bip = (struct xfs_buf_log_item *)lidp->lid_item;
-                       if (bip->bli_item.li_type == XFS_LI_BUF &&
-                           XFS_BUF_ADDR(bip->bli_buf) == bno)
-                               return bip->bli_buf;
-               }
+               bip = (struct xfs_buf_log_item *)lidp->lid_item;
+               if (bip->bli_item.li_type == XFS_LI_BUF &&
+                   XFS_BUF_ADDR(bip->bli_buf) == bno)
+                       return bip->bli_buf;
        }
 
-       return bp;
+       return NULL;
 }
 
 STATIC void