|
@@ -515,7 +515,7 @@ xfs_bmap_trace_exlist(
|
|
|
state |= BMAP_ATTRFORK;
|
|
|
|
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
|
- ASSERT(cnt == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)));
|
|
|
+ ASSERT(cnt == xfs_iext_count(ifp));
|
|
|
for (idx = 0; idx < cnt; idx++)
|
|
|
trace_xfs_extlist(ip, idx, whichfork, caller_ip);
|
|
|
}
|
|
@@ -811,7 +811,7 @@ try_another_ag:
|
|
|
XFS_BTREE_LONG_PTRS);
|
|
|
|
|
|
arp = XFS_BMBT_REC_ADDR(mp, ablock, 1);
|
|
|
- nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
|
|
|
+ nextents = xfs_iext_count(ifp);
|
|
|
for (cnt = i = 0; i < nextents; i++) {
|
|
|
ep = xfs_iext_get_ext(ifp, i);
|
|
|
if (!isnullstartblock(xfs_bmbt_get_startblock(ep))) {
|
|
@@ -1296,7 +1296,7 @@ xfs_bmap_read_extents(
|
|
|
/*
|
|
|
* Here with bp and block set to the leftmost leaf node in the tree.
|
|
|
*/
|
|
|
- room = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
|
|
|
+ room = xfs_iext_count(ifp);
|
|
|
i = 0;
|
|
|
/*
|
|
|
* Loop over all leaf nodes. Copy information to the extent records.
|
|
@@ -1361,7 +1361,7 @@ xfs_bmap_read_extents(
|
|
|
return error;
|
|
|
block = XFS_BUF_TO_BLOCK(bp);
|
|
|
}
|
|
|
- ASSERT(i == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)));
|
|
|
+ ASSERT(i == xfs_iext_count(ifp));
|
|
|
ASSERT(i == XFS_IFORK_NEXTENTS(ip, whichfork));
|
|
|
XFS_BMAP_TRACE_EXLIST(ip, i, whichfork);
|
|
|
return 0;
|
|
@@ -1404,7 +1404,7 @@ xfs_bmap_search_multi_extents(
|
|
|
if (lastx > 0) {
|
|
|
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, lastx - 1), prevp);
|
|
|
}
|
|
|
- if (lastx < (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t))) {
|
|
|
+ if (lastx < xfs_iext_count(ifp)) {
|
|
|
xfs_bmbt_get_all(ep, gotp);
|
|
|
*eofp = 0;
|
|
|
} else {
|
|
@@ -1497,7 +1497,7 @@ xfs_bmap_first_unused(
|
|
|
(error = xfs_iread_extents(tp, ip, whichfork)))
|
|
|
return error;
|
|
|
lowest = *first_unused;
|
|
|
- nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
|
|
|
+ nextents = xfs_iext_count(ifp);
|
|
|
for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) {
|
|
|
xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx);
|
|
|
off = xfs_bmbt_get_startoff(ep);
|
|
@@ -1582,7 +1582,7 @@ xfs_bmap_last_extent(
|
|
|
return error;
|
|
|
}
|
|
|
|
|
|
- nextents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t);
|
|
|
+ nextents = xfs_iext_count(ifp);
|
|
|
if (nextents == 0) {
|
|
|
*is_empty = 1;
|
|
|
return 0;
|
|
@@ -1735,7 +1735,7 @@ xfs_bmap_add_extent_delay_real(
|
|
|
&bma->ip->i_d.di_nextents);
|
|
|
|
|
|
ASSERT(bma->idx >= 0);
|
|
|
- ASSERT(bma->idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec));
|
|
|
+ ASSERT(bma->idx <= xfs_iext_count(ifp));
|
|
|
ASSERT(!isnullstartblock(new->br_startblock));
|
|
|
ASSERT(!bma->cur ||
|
|
|
(bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL));
|
|
@@ -1794,7 +1794,7 @@ xfs_bmap_add_extent_delay_real(
|
|
|
* Don't set contiguous if the combined extent would be too large.
|
|
|
* Also check for all-three-contiguous being too large.
|
|
|
*/
|
|
|
- if (bma->idx < ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1) {
|
|
|
+ if (bma->idx < xfs_iext_count(ifp) - 1) {
|
|
|
state |= BMAP_RIGHT_VALID;
|
|
|
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, bma->idx + 1), &RIGHT);
|
|
|
|
|
@@ -2300,7 +2300,7 @@ xfs_bmap_add_extent_unwritten_real(
|
|
|
ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
|
|
|
|
|
|
ASSERT(*idx >= 0);
|
|
|
- ASSERT(*idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec));
|
|
|
+ ASSERT(*idx <= xfs_iext_count(ifp));
|
|
|
ASSERT(!isnullstartblock(new->br_startblock));
|
|
|
|
|
|
XFS_STATS_INC(mp, xs_add_exlist);
|
|
@@ -2356,7 +2356,7 @@ xfs_bmap_add_extent_unwritten_real(
|
|
|
* Don't set contiguous if the combined extent would be too large.
|
|
|
* Also check for all-three-contiguous being too large.
|
|
|
*/
|
|
|
- if (*idx < ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1) {
|
|
|
+ if (*idx < xfs_iext_count(&ip->i_df) - 1) {
|
|
|
state |= BMAP_RIGHT_VALID;
|
|
|
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, *idx + 1), &RIGHT);
|
|
|
if (isnullstartblock(RIGHT.br_startblock))
|
|
@@ -2836,7 +2836,7 @@ xfs_bmap_add_extent_hole_delay(
|
|
|
* Check and set flags if the current (right) segment exists.
|
|
|
* If it doesn't exist, we're converting the hole at end-of-file.
|
|
|
*/
|
|
|
- if (*idx < ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)) {
|
|
|
+ if (*idx < xfs_iext_count(ifp)) {
|
|
|
state |= BMAP_RIGHT_VALID;
|
|
|
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, *idx), &right);
|
|
|
|
|
@@ -2966,7 +2966,7 @@ xfs_bmap_add_extent_hole_real(
|
|
|
ifp = XFS_IFORK_PTR(bma->ip, whichfork);
|
|
|
|
|
|
ASSERT(bma->idx >= 0);
|
|
|
- ASSERT(bma->idx <= ifp->if_bytes / sizeof(struct xfs_bmbt_rec));
|
|
|
+ ASSERT(bma->idx <= xfs_iext_count(ifp));
|
|
|
ASSERT(!isnullstartblock(new->br_startblock));
|
|
|
ASSERT(!bma->cur ||
|
|
|
!(bma->cur->bc_private.b.flags & XFS_BTCUR_BPRV_WASDEL));
|
|
@@ -2992,7 +2992,7 @@ xfs_bmap_add_extent_hole_real(
|
|
|
* Check and set flags if this segment has a current value.
|
|
|
* Not true if we're inserting into the "hole" at eof.
|
|
|
*/
|
|
|
- if (bma->idx < ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)) {
|
|
|
+ if (bma->idx < xfs_iext_count(ifp)) {
|
|
|
state |= BMAP_RIGHT_VALID;
|
|
|
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, bma->idx), &right);
|
|
|
if (isnullstartblock(right.br_startblock))
|
|
@@ -4221,7 +4221,7 @@ xfs_bmapi_read(
|
|
|
break;
|
|
|
|
|
|
/* Else go on to the next record. */
|
|
|
- if (++lastx < ifp->if_bytes / sizeof(xfs_bmbt_rec_t))
|
|
|
+ if (++lastx < xfs_iext_count(ifp))
|
|
|
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, lastx), &got);
|
|
|
else
|
|
|
eof = 1;
|
|
@@ -4733,7 +4733,7 @@ xfs_bmapi_write(
|
|
|
|
|
|
/* Else go on to the next record. */
|
|
|
bma.prev = bma.got;
|
|
|
- if (++bma.idx < ifp->if_bytes / sizeof(xfs_bmbt_rec_t)) {
|
|
|
+ if (++bma.idx < xfs_iext_count(ifp)) {
|
|
|
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, bma.idx),
|
|
|
&bma.got);
|
|
|
} else
|
|
@@ -4885,7 +4885,7 @@ xfs_bmap_del_extent_delay(
|
|
|
da_new = 0;
|
|
|
|
|
|
ASSERT(*idx >= 0);
|
|
|
- ASSERT(*idx < ifp->if_bytes / sizeof(struct xfs_bmbt_rec));
|
|
|
+ ASSERT(*idx <= xfs_iext_count(ifp));
|
|
|
ASSERT(del->br_blockcount > 0);
|
|
|
ASSERT(got->br_startoff <= del->br_startoff);
|
|
|
ASSERT(got_endoff >= del_endoff);
|
|
@@ -5013,7 +5013,7 @@ xfs_bmap_del_extent_cow(
|
|
|
got_endoff = got->br_startoff + got->br_blockcount;
|
|
|
|
|
|
ASSERT(*idx >= 0);
|
|
|
- ASSERT(*idx < ifp->if_bytes / sizeof(struct xfs_bmbt_rec));
|
|
|
+ ASSERT(*idx <= xfs_iext_count(ifp));
|
|
|
ASSERT(del->br_blockcount > 0);
|
|
|
ASSERT(got->br_startoff <= del->br_startoff);
|
|
|
ASSERT(got_endoff >= del_endoff);
|
|
@@ -5119,8 +5119,7 @@ xfs_bmap_del_extent(
|
|
|
state |= BMAP_COWFORK;
|
|
|
|
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
|
- ASSERT((*idx >= 0) && (*idx < ifp->if_bytes /
|
|
|
- (uint)sizeof(xfs_bmbt_rec_t)));
|
|
|
+ ASSERT((*idx >= 0) && (*idx < xfs_iext_count(ifp)));
|
|
|
ASSERT(del->br_blockcount > 0);
|
|
|
ep = xfs_iext_get_ext(ifp, *idx);
|
|
|
xfs_bmbt_get_all(ep, &got);
|
|
@@ -5445,7 +5444,6 @@ __xfs_bunmapi(
|
|
|
int logflags; /* transaction logging flags */
|
|
|
xfs_extlen_t mod; /* rt extent offset */
|
|
|
xfs_mount_t *mp; /* mount structure */
|
|
|
- xfs_extnum_t nextents; /* number of file extents */
|
|
|
xfs_bmbt_irec_t prev; /* previous extent record */
|
|
|
xfs_fileoff_t start; /* first file offset deleted */
|
|
|
int tmp_logflags; /* partial logging flags */
|
|
@@ -5477,8 +5475,7 @@ __xfs_bunmapi(
|
|
|
if (!(ifp->if_flags & XFS_IFEXTENTS) &&
|
|
|
(error = xfs_iread_extents(tp, ip, whichfork)))
|
|
|
return error;
|
|
|
- nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
|
|
|
- if (nextents == 0) {
|
|
|
+ if (xfs_iext_count(ifp) == 0) {
|
|
|
*rlen = 0;
|
|
|
return 0;
|
|
|
}
|
|
@@ -5963,7 +5960,7 @@ xfs_bmse_shift_one(
|
|
|
|
|
|
mp = ip->i_mount;
|
|
|
ifp = XFS_IFORK_PTR(ip, whichfork);
|
|
|
- total_extents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t);
|
|
|
+ total_extents = xfs_iext_count(ifp);
|
|
|
|
|
|
xfs_bmbt_get_all(gotp, &got);
|
|
|
|
|
@@ -6140,7 +6137,7 @@ xfs_bmap_shift_extents(
|
|
|
* are collapsing out, so we cannot use the count of real extents here.
|
|
|
* Instead we have to calculate it from the incore fork.
|
|
|
*/
|
|
|
- total_extents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t);
|
|
|
+ total_extents = xfs_iext_count(ifp);
|
|
|
if (total_extents == 0) {
|
|
|
*done = 1;
|
|
|
goto del_cursor;
|
|
@@ -6200,7 +6197,7 @@ xfs_bmap_shift_extents(
|
|
|
* count can change. Update the total and grade the next record.
|
|
|
*/
|
|
|
if (direction == SHIFT_LEFT) {
|
|
|
- total_extents = ifp->if_bytes / sizeof(xfs_bmbt_rec_t);
|
|
|
+ total_extents = xfs_iext_count(ifp);
|
|
|
stop_extent = total_extents;
|
|
|
}
|
|
|
|