- *gotp = got;
- return ep;
-}
-
-/*
- * Call xfs_bmap_do_search_extents() to search for the extent
- * record containing block bno. If in multi-level in-core extent
- * allocation mode, find and extract the target extent buffer,
- * otherwise just use the direct extent list.
- */
-xfs_bmbt_rec_t * /* pointer to found extent entry */
-xfs_bmap_search_multi_extents(
- xfs_ifork_t *ifp, /* inode fork pointer */
- xfs_fileoff_t bno, /* block number searched for */
- int *eofp, /* out: end of file found */
- xfs_extnum_t *lastxp, /* out: last extent index */
- xfs_bmbt_irec_t *gotp, /* out: extent entry found */
- xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
-{
- xfs_bmbt_rec_t *base; /* base of extent records */
- xfs_bmbt_rec_t *ep; /* extent record pointer */
- xfs_ext_irec_t *erp = NULL; /* indirection array pointer */
- xfs_extnum_t lastx; /* last extent index */
- xfs_extnum_t nextents; /* number of file extents */
-
- /*
- * For multi-level extent allocation mode, find the
- * target extent list and pass only the contiguous
- * list to xfs_bmap_do_search_extents. Convert lastx
- * from a file extent index to an index within the
- * target extent list.
- */
- if (ifp->if_flags & XFS_IFEXTIREC) {
- int erp_idx = 0;
- erp = xfs_iext_bno_to_irec(ifp, bno, &erp_idx);
- base = erp->er_extbuf;
- nextents = erp->er_extcount;
- lastx = ifp->if_lastex - erp->er_extoff;
- } else {
- base = &ifp->if_u1.if_extents[0];
- nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
- lastx = ifp->if_lastex;
- }
- ep = xfs_bmap_do_search_extents(base, lastx, nextents, bno,
- eofp, lastxp, gotp, prevp);
- /* Convert lastx back to file-based index */
- if (ifp->if_flags & XFS_IFEXTIREC) {
- *lastxp += erp->er_extoff;
- }