aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/quota/xfs_qm.c7
-rw-r--r--fs/xfs/xfs_bmap.c75
-rw-r--r--fs/xfs/xfs_bmap.h2
-rw-r--r--fs/xfs/xfs_bmap_btree.c31
-rw-r--r--fs/xfs/xfs_bmap_btree.h26
-rw-r--r--fs/xfs/xfs_inode.c71
-rw-r--r--fs/xfs/xfs_inode.h10
7 files changed, 95 insertions, 127 deletions
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 6ff0f4de1630..9567d1846ee5 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1717,7 +1717,6 @@ xfs_qm_get_rtblks(
1717 xfs_extnum_t idx; /* extent record index */ 1717 xfs_extnum_t idx; /* extent record index */
1718 xfs_ifork_t *ifp; /* inode fork pointer */ 1718 xfs_ifork_t *ifp; /* inode fork pointer */
1719 xfs_extnum_t nextents; /* number of extent entries */ 1719 xfs_extnum_t nextents; /* number of extent entries */
1720 xfs_bmbt_rec_t *ep; /* pointer to an extent entry */
1721 int error; 1720 int error;
1722 1721
1723 ASSERT(XFS_IS_REALTIME_INODE(ip)); 1722 ASSERT(XFS_IS_REALTIME_INODE(ip));
@@ -1728,10 +1727,8 @@ xfs_qm_get_rtblks(
1728 } 1727 }
1729 rtblks = 0; 1728 rtblks = 0;
1730 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); 1729 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
1731 for (idx = 0; idx < nextents; idx++) { 1730 for (idx = 0; idx < nextents; idx++)
1732 ep = xfs_iext_get_ext(ifp, idx); 1731 rtblks += xfs_bmbt_get_blockcount(xfs_iext_get_ext(ifp, idx));
1733 rtblks += xfs_bmbt_get_blockcount(ep);
1734 }
1735 *O_rtblks = (xfs_qcnt_t)rtblks; 1732 *O_rtblks = (xfs_qcnt_t)rtblks;
1736 return 0; 1733 return 0;
1737} 1734}
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index aa19e1fee11f..bbef39432be2 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -248,7 +248,7 @@ xfs_bmap_local_to_extents(
248 * Else, *lastxp will be set to the index of the found 248 * Else, *lastxp will be set to the index of the found
249 * entry; *gotp will contain the entry. 249 * entry; *gotp will contain the entry.
250 */ 250 */
251STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ 251STATIC xfs_bmbt_rec_host_t * /* pointer to found extent entry */
252xfs_bmap_search_extents( 252xfs_bmap_search_extents(
253 xfs_inode_t *ip, /* incore inode pointer */ 253 xfs_inode_t *ip, /* incore inode pointer */
254 xfs_fileoff_t bno, /* block number searched for */ 254 xfs_fileoff_t bno, /* block number searched for */
@@ -273,21 +273,6 @@ xfs_bmap_isaeof(
273 273
274#ifdef XFS_BMAP_TRACE 274#ifdef XFS_BMAP_TRACE
275/* 275/*
276 * Add a bmap trace buffer entry. Base routine for the others.
277 */
278STATIC void
279xfs_bmap_trace_addentry(
280 int opcode, /* operation */
281 const char *fname, /* function name */
282 char *desc, /* operation description */
283 xfs_inode_t *ip, /* incore inode pointer */
284 xfs_extnum_t idx, /* index of entry(ies) */
285 xfs_extnum_t cnt, /* count of entries, 1 or 2 */
286 xfs_bmbt_rec_t *r1, /* first record */
287 xfs_bmbt_rec_t *r2, /* second record or null */
288 int whichfork); /* data or attr fork */
289
290/*
291 * Add bmap trace entry prior to a call to xfs_iext_remove. 276 * Add bmap trace entry prior to a call to xfs_iext_remove.
292 */ 277 */
293STATIC void 278STATIC void
@@ -714,7 +699,7 @@ xfs_bmap_add_extent_delay_real(
714{ 699{
715 xfs_btree_cur_t *cur; /* btree cursor */ 700 xfs_btree_cur_t *cur; /* btree cursor */
716 int diff; /* temp value */ 701 int diff; /* temp value */
717 xfs_bmbt_rec_t *ep; /* extent entry for idx */ 702 xfs_bmbt_rec_host_t *ep; /* extent entry for idx */
718 int error; /* error return value */ 703 int error; /* error return value */
719 int i; /* temp state */ 704 int i; /* temp state */
720 xfs_ifork_t *ifp; /* inode fork pointer */ 705 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -1270,7 +1255,7 @@ xfs_bmap_add_extent_unwritten_real(
1270 xfs_extdelta_t *delta) /* Change made to incore extents */ 1255 xfs_extdelta_t *delta) /* Change made to incore extents */
1271{ 1256{
1272 xfs_btree_cur_t *cur; /* btree cursor */ 1257 xfs_btree_cur_t *cur; /* btree cursor */
1273 xfs_bmbt_rec_t *ep; /* extent entry for idx */ 1258 xfs_bmbt_rec_host_t *ep; /* extent entry for idx */
1274 int error; /* error return value */ 1259 int error; /* error return value */
1275 int i; /* temp state */ 1260 int i; /* temp state */
1276 xfs_ifork_t *ifp; /* inode fork pointer */ 1261 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -1823,7 +1808,7 @@ xfs_bmap_add_extent_hole_delay(
1823 xfs_extdelta_t *delta, /* Change made to incore extents */ 1808 xfs_extdelta_t *delta, /* Change made to incore extents */
1824 int rsvd) /* OK to allocate reserved blocks */ 1809 int rsvd) /* OK to allocate reserved blocks */
1825{ 1810{
1826 xfs_bmbt_rec_t *ep; /* extent record for idx */ 1811 xfs_bmbt_rec_host_t *ep; /* extent record for idx */
1827 xfs_ifork_t *ifp; /* inode fork pointer */ 1812 xfs_ifork_t *ifp; /* inode fork pointer */
1828 xfs_bmbt_irec_t left; /* left neighbor extent entry */ 1813 xfs_bmbt_irec_t left; /* left neighbor extent entry */
1829 xfs_filblks_t newlen=0; /* new indirect size */ 1814 xfs_filblks_t newlen=0; /* new indirect size */
@@ -2012,7 +1997,7 @@ xfs_bmap_add_extent_hole_real(
2012 xfs_extdelta_t *delta, /* Change made to incore extents */ 1997 xfs_extdelta_t *delta, /* Change made to incore extents */
2013 int whichfork) /* data or attr fork */ 1998 int whichfork) /* data or attr fork */
2014{ 1999{
2015 xfs_bmbt_rec_t *ep; /* pointer to extent entry ins. point */ 2000 xfs_bmbt_rec_host_t *ep; /* pointer to extent entry ins. point */
2016 int error; /* error return value */ 2001 int error; /* error return value */
2017 int i; /* temp state */ 2002 int i; /* temp state */
2018 xfs_ifork_t *ifp; /* inode fork pointer */ 2003 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -3070,7 +3055,7 @@ xfs_bmap_del_extent(
3070 xfs_fileoff_t del_endoff; /* first offset past del */ 3055 xfs_fileoff_t del_endoff; /* first offset past del */
3071 int delay; /* current block is delayed allocated */ 3056 int delay; /* current block is delayed allocated */
3072 int do_fx; /* free extent at end of routine */ 3057 int do_fx; /* free extent at end of routine */
3073 xfs_bmbt_rec_t *ep; /* current extent entry pointer */ 3058 xfs_bmbt_rec_host_t *ep; /* current extent entry pointer */
3074 int error; /* error return value */ 3059 int error; /* error return value */
3075 int flags; /* inode logging flags */ 3060 int flags; /* inode logging flags */
3076 xfs_bmbt_irec_t got; /* current extent entry */ 3061 xfs_bmbt_irec_t got; /* current extent entry */
@@ -3418,7 +3403,7 @@ xfs_bmap_extents_to_btree(
3418 xfs_bmbt_rec_t *arp; /* child record pointer */ 3403 xfs_bmbt_rec_t *arp; /* child record pointer */
3419 xfs_bmbt_block_t *block; /* btree root block */ 3404 xfs_bmbt_block_t *block; /* btree root block */
3420 xfs_btree_cur_t *cur; /* bmap btree cursor */ 3405 xfs_btree_cur_t *cur; /* bmap btree cursor */
3421 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3406 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
3422 int error; /* error return value */ 3407 int error; /* error return value */
3423 xfs_extnum_t i, cnt; /* extent record index */ 3408 xfs_extnum_t i, cnt; /* extent record index */
3424 xfs_ifork_t *ifp; /* inode fork pointer */ 3409 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -3590,7 +3575,7 @@ xfs_bmap_local_to_extents(
3590 if (ifp->if_bytes) { 3575 if (ifp->if_bytes) {
3591 xfs_alloc_arg_t args; /* allocation arguments */ 3576 xfs_alloc_arg_t args; /* allocation arguments */
3592 xfs_buf_t *bp; /* buffer for extent block */ 3577 xfs_buf_t *bp; /* buffer for extent block */
3593 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3578 xfs_bmbt_rec_host_t *ep;/* extent record pointer */
3594 3579
3595 args.tp = tp; 3580 args.tp = tp;
3596 args.mp = ip->i_mount; 3581 args.mp = ip->i_mount;
@@ -3655,7 +3640,7 @@ done:
3655 * entry (null if none). Else, *lastxp will be set to the index 3640 * entry (null if none). Else, *lastxp will be set to the index
3656 * of the found entry; *gotp will contain the entry. 3641 * of the found entry; *gotp will contain the entry.
3657 */ 3642 */
3658xfs_bmbt_rec_t * /* pointer to found extent entry */ 3643xfs_bmbt_rec_host_t * /* pointer to found extent entry */
3659xfs_bmap_search_multi_extents( 3644xfs_bmap_search_multi_extents(
3660 xfs_ifork_t *ifp, /* inode fork pointer */ 3645 xfs_ifork_t *ifp, /* inode fork pointer */
3661 xfs_fileoff_t bno, /* block number searched for */ 3646 xfs_fileoff_t bno, /* block number searched for */
@@ -3664,7 +3649,7 @@ xfs_bmap_search_multi_extents(
3664 xfs_bmbt_irec_t *gotp, /* out: extent entry found */ 3649 xfs_bmbt_irec_t *gotp, /* out: extent entry found */
3665 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ 3650 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
3666{ 3651{
3667 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3652 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
3668 xfs_extnum_t lastx; /* last extent index */ 3653 xfs_extnum_t lastx; /* last extent index */
3669 3654
3670 /* 3655 /*
@@ -3706,7 +3691,7 @@ xfs_bmap_search_multi_extents(
3706 * Else, *lastxp will be set to the index of the found 3691 * Else, *lastxp will be set to the index of the found
3707 * entry; *gotp will contain the entry. 3692 * entry; *gotp will contain the entry.
3708 */ 3693 */
3709STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ 3694STATIC xfs_bmbt_rec_host_t * /* pointer to found extent entry */
3710xfs_bmap_search_extents( 3695xfs_bmap_search_extents(
3711 xfs_inode_t *ip, /* incore inode pointer */ 3696 xfs_inode_t *ip, /* incore inode pointer */
3712 xfs_fileoff_t bno, /* block number searched for */ 3697 xfs_fileoff_t bno, /* block number searched for */
@@ -3717,7 +3702,7 @@ xfs_bmap_search_extents(
3717 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ 3702 xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */
3718{ 3703{
3719 xfs_ifork_t *ifp; /* inode fork pointer */ 3704 xfs_ifork_t *ifp; /* inode fork pointer */
3720 xfs_bmbt_rec_t *ep; /* extent record pointer */ 3705 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
3721 3706
3722 XFS_STATS_INC(xs_look_exlist); 3707 XFS_STATS_INC(xs_look_exlist);
3723 ifp = XFS_IFORK_PTR(ip, fork); 3708 ifp = XFS_IFORK_PTR(ip, fork);
@@ -3757,11 +3742,11 @@ xfs_bmap_trace_addentry(
3757 xfs_inode_t *ip, /* incore inode pointer */ 3742 xfs_inode_t *ip, /* incore inode pointer */
3758 xfs_extnum_t idx, /* index of entry(ies) */ 3743 xfs_extnum_t idx, /* index of entry(ies) */
3759 xfs_extnum_t cnt, /* count of entries, 1 or 2 */ 3744 xfs_extnum_t cnt, /* count of entries, 1 or 2 */
3760 xfs_bmbt_rec_t *r1, /* first record */ 3745 xfs_bmbt_rec_host_t *r1, /* first record */
3761 xfs_bmbt_rec_t *r2, /* second record or null */ 3746 xfs_bmbt_rec_host_t *r2, /* second record or null */
3762 int whichfork) /* data or attr fork */ 3747 int whichfork) /* data or attr fork */
3763{ 3748{
3764 xfs_bmbt_rec_t tr2; 3749 xfs_bmbt_rec_host_t tr2;
3765 3750
3766 ASSERT(cnt == 1 || cnt == 2); 3751 ASSERT(cnt == 1 || cnt == 2);
3767 ASSERT(r1 != NULL); 3752 ASSERT(r1 != NULL);
@@ -3842,8 +3827,8 @@ xfs_bmap_trace_insert(
3842 xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ 3827 xfs_bmbt_irec_t *r2, /* inserted record 2 or null */
3843 int whichfork) /* data or attr fork */ 3828 int whichfork) /* data or attr fork */
3844{ 3829{
3845 xfs_bmbt_rec_t tr1; /* compressed record 1 */ 3830 xfs_bmbt_rec_host_t tr1; /* compressed record 1 */
3846 xfs_bmbt_rec_t tr2; /* compressed record 2 if needed */ 3831 xfs_bmbt_rec_host_t tr2; /* compressed record 2 if needed */
3847 3832
3848 xfs_bmbt_set_all(&tr1, r1); 3833 xfs_bmbt_set_all(&tr1, r1);
3849 if (cnt == 2) { 3834 if (cnt == 2) {
@@ -4316,7 +4301,6 @@ xfs_bmap_first_unused(
4316 xfs_fileoff_t *first_unused, /* unused block */ 4301 xfs_fileoff_t *first_unused, /* unused block */
4317 int whichfork) /* data or attr fork */ 4302 int whichfork) /* data or attr fork */
4318{ 4303{
4319 xfs_bmbt_rec_t *ep; /* pointer to an extent entry */
4320 int error; /* error return value */ 4304 int error; /* error return value */
4321 int idx; /* extent record index */ 4305 int idx; /* extent record index */
4322 xfs_ifork_t *ifp; /* inode fork pointer */ 4306 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -4340,7 +4324,7 @@ xfs_bmap_first_unused(
4340 lowest = *first_unused; 4324 lowest = *first_unused;
4341 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); 4325 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
4342 for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) { 4326 for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) {
4343 ep = xfs_iext_get_ext(ifp, idx); 4327 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx);
4344 off = xfs_bmbt_get_startoff(ep); 4328 off = xfs_bmbt_get_startoff(ep);
4345 /* 4329 /*
4346 * See if the hole before this extent will work. 4330 * See if the hole before this extent will work.
@@ -4371,7 +4355,7 @@ xfs_bmap_last_before(
4371{ 4355{
4372 xfs_fileoff_t bno; /* input file offset */ 4356 xfs_fileoff_t bno; /* input file offset */
4373 int eof; /* hit end of file */ 4357 int eof; /* hit end of file */
4374 xfs_bmbt_rec_t *ep; /* pointer to last extent */ 4358 xfs_bmbt_rec_host_t *ep; /* pointer to last extent */
4375 int error; /* error return value */ 4359 int error; /* error return value */
4376 xfs_bmbt_irec_t got; /* current extent value */ 4360 xfs_bmbt_irec_t got; /* current extent value */
4377 xfs_ifork_t *ifp; /* inode fork pointer */ 4361 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -4417,7 +4401,7 @@ xfs_bmap_last_offset(
4417 xfs_fileoff_t *last_block, /* last block */ 4401 xfs_fileoff_t *last_block, /* last block */
4418 int whichfork) /* data or attr fork */ 4402 int whichfork) /* data or attr fork */
4419{ 4403{
4420 xfs_bmbt_rec_t *ep; /* pointer to last extent */ 4404 xfs_bmbt_rec_host_t *ep; /* pointer to last extent */
4421 int error; /* error return value */ 4405 int error; /* error return value */
4422 xfs_ifork_t *ifp; /* inode fork pointer */ 4406 xfs_ifork_t *ifp; /* inode fork pointer */
4423 xfs_extnum_t nextents; /* number of extent entries */ 4407 xfs_extnum_t nextents; /* number of extent entries */
@@ -4454,7 +4438,7 @@ xfs_bmap_one_block(
4454 xfs_inode_t *ip, /* incore inode */ 4438 xfs_inode_t *ip, /* incore inode */
4455 int whichfork) /* data or attr fork */ 4439 int whichfork) /* data or attr fork */
4456{ 4440{
4457 xfs_bmbt_rec_t *ep; /* ptr to fork's extent */ 4441 xfs_bmbt_rec_host_t *ep; /* ptr to fork's extent */
4458 xfs_ifork_t *ifp; /* inode fork pointer */ 4442 xfs_ifork_t *ifp; /* inode fork pointer */
4459 int rval; /* return value */ 4443 int rval; /* return value */
4460 xfs_bmbt_irec_t s; /* internal version of extent */ 4444 xfs_bmbt_irec_t s; /* internal version of extent */
@@ -4549,7 +4533,7 @@ xfs_bmap_read_extents(
4549 * Loop over all leaf nodes. Copy information to the extent records. 4533 * Loop over all leaf nodes. Copy information to the extent records.
4550 */ 4534 */
4551 for (;;) { 4535 for (;;) {
4552 xfs_bmbt_rec_t *frp, *trp; 4536 xfs_bmbt_rec_t *frp;
4553 xfs_fsblock_t nextbno; 4537 xfs_fsblock_t nextbno;
4554 xfs_extnum_t num_recs; 4538 xfs_extnum_t num_recs;
4555 xfs_extnum_t start; 4539 xfs_extnum_t start;
@@ -4581,7 +4565,7 @@ xfs_bmap_read_extents(
4581 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1); 4565 frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1);
4582 start = i; 4566 start = i;
4583 for (j = 0; j < num_recs; j++, i++, frp++) { 4567 for (j = 0; j < num_recs; j++, i++, frp++) {
4584 trp = xfs_iext_get_ext(ifp, i); 4568 xfs_bmbt_rec_host_t *trp = xfs_iext_get_ext(ifp, i);
4585 trp->l0 = INT_GET(frp->l0, ARCH_CONVERT); 4569 trp->l0 = INT_GET(frp->l0, ARCH_CONVERT);
4586 trp->l1 = INT_GET(frp->l1, ARCH_CONVERT); 4570 trp->l1 = INT_GET(frp->l1, ARCH_CONVERT);
4587 } 4571 }
@@ -4631,7 +4615,7 @@ xfs_bmap_trace_exlist(
4631 xfs_extnum_t cnt, /* count of entries in the list */ 4615 xfs_extnum_t cnt, /* count of entries in the list */
4632 int whichfork) /* data or attr fork */ 4616 int whichfork) /* data or attr fork */
4633{ 4617{
4634 xfs_bmbt_rec_t *ep; /* current extent record */ 4618 xfs_bmbt_rec_host_t *ep; /* current extent record */
4635 xfs_extnum_t idx; /* extent record index */ 4619 xfs_extnum_t idx; /* extent record index */
4636 xfs_ifork_t *ifp; /* inode fork pointer */ 4620 xfs_ifork_t *ifp; /* inode fork pointer */
4637 xfs_bmbt_irec_t s; /* file extent record */ 4621 xfs_bmbt_irec_t s; /* file extent record */
@@ -4727,7 +4711,7 @@ xfs_bmapi(
4727 xfs_btree_cur_t *cur; /* bmap btree cursor */ 4711 xfs_btree_cur_t *cur; /* bmap btree cursor */
4728 xfs_fileoff_t end; /* end of mapped file region */ 4712 xfs_fileoff_t end; /* end of mapped file region */
4729 int eof; /* we've hit the end of extents */ 4713 int eof; /* we've hit the end of extents */
4730 xfs_bmbt_rec_t *ep; /* extent record pointer */ 4714 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
4731 int error; /* error return */ 4715 int error; /* error return */
4732 xfs_bmbt_irec_t got; /* current file extent record */ 4716 xfs_bmbt_irec_t got; /* current file extent record */
4733 xfs_ifork_t *ifp; /* inode fork pointer */ 4717 xfs_ifork_t *ifp; /* inode fork pointer */
@@ -5378,7 +5362,7 @@ xfs_bunmapi(
5378 xfs_btree_cur_t *cur; /* bmap btree cursor */ 5362 xfs_btree_cur_t *cur; /* bmap btree cursor */
5379 xfs_bmbt_irec_t del; /* extent being deleted */ 5363 xfs_bmbt_irec_t del; /* extent being deleted */
5380 int eof; /* is deleting at eof */ 5364 int eof; /* is deleting at eof */
5381 xfs_bmbt_rec_t *ep; /* extent record pointer */ 5365 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
5382 int error; /* error return value */ 5366 int error; /* error return value */
5383 xfs_extnum_t extno; /* extent number in list */ 5367 xfs_extnum_t extno; /* extent number in list */
5384 xfs_bmbt_irec_t got; /* current extent record */ 5368 xfs_bmbt_irec_t got; /* current extent record */
@@ -6004,7 +5988,7 @@ xfs_bmap_isaeof(
6004{ 5988{
6005 int error; /* error return value */ 5989 int error; /* error return value */
6006 xfs_ifork_t *ifp; /* inode fork pointer */ 5990 xfs_ifork_t *ifp; /* inode fork pointer */
6007 xfs_bmbt_rec_t *lastrec; /* extent record pointer */ 5991 xfs_bmbt_rec_host_t *lastrec; /* extent record pointer */
6008 xfs_extnum_t nextents; /* number of file extents */ 5992 xfs_extnum_t nextents; /* number of file extents */
6009 xfs_bmbt_irec_t s; /* expanded extent record */ 5993 xfs_bmbt_irec_t s; /* expanded extent record */
6010 5994
@@ -6048,7 +6032,7 @@ xfs_bmap_eof(
6048 xfs_fsblock_t blockcount; /* extent block count */ 6032 xfs_fsblock_t blockcount; /* extent block count */
6049 int error; /* error return value */ 6033 int error; /* error return value */
6050 xfs_ifork_t *ifp; /* inode fork pointer */ 6034 xfs_ifork_t *ifp; /* inode fork pointer */
6051 xfs_bmbt_rec_t *lastrec; /* extent record pointer */ 6035 xfs_bmbt_rec_host_t *lastrec; /* extent record pointer */
6052 xfs_extnum_t nextents; /* number of file extents */ 6036 xfs_extnum_t nextents; /* number of file extents */
6053 xfs_fileoff_t startoff; /* extent starting file offset */ 6037 xfs_fileoff_t startoff; /* extent starting file offset */
6054 6038
@@ -6495,10 +6479,9 @@ xfs_bmap_count_leaves(
6495 int *count) 6479 int *count)
6496{ 6480{
6497 int b; 6481 int b;
6498 xfs_bmbt_rec_t *frp;
6499 6482
6500 for (b = 0; b < numrecs; b++) { 6483 for (b = 0; b < numrecs; b++) {
6501 frp = xfs_iext_get_ext(ifp, idx + b); 6484 xfs_bmbt_rec_host_t *frp = xfs_iext_get_ext(ifp, idx + b);
6502 *count += xfs_bmbt_get_blockcount(frp); 6485 *count += xfs_bmbt_get_blockcount(frp);
6503 } 6486 }
6504 return 0; 6487 return 0;
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index 524b1c9d5246..a69ef30809fb 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -378,7 +378,7 @@ xfs_check_nostate_extents(
378 * entry (null if none). Else, *lastxp will be set to the index 378 * entry (null if none). Else, *lastxp will be set to the index
379 * of the found entry; *gotp will contain the entry. 379 * of the found entry; *gotp will contain the entry.
380 */ 380 */
381xfs_bmbt_rec_t * 381xfs_bmbt_rec_host_t *
382xfs_bmap_search_multi_extents(struct xfs_ifork *, xfs_fileoff_t, int *, 382xfs_bmap_search_multi_extents(struct xfs_ifork *, xfs_fileoff_t, int *,
383 xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *); 383 xfs_extnum_t *, xfs_bmbt_irec_t *, xfs_bmbt_irec_t *);
384 384
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 08184cc399be..e54c71e20e0e 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -260,13 +260,14 @@ xfs_bmbt_trace_cursor(
260 char *s, 260 char *s,
261 int line) 261 int line)
262{ 262{
263 xfs_bmbt_rec_t r; 263 xfs_bmbt_rec_host_t r;
264 264
265 xfs_bmbt_set_all(&r, &cur->bc_rec.b); 265 xfs_bmbt_set_all(&r, &cur->bc_rec.b);
266 xfs_bmbt_trace_enter(func, cur, s, XFS_BMBT_KTRACE_CUR, line, 266 xfs_bmbt_trace_enter(func, cur, s, XFS_BMBT_KTRACE_CUR, line,
267 (cur->bc_nlevels << 24) | (cur->bc_private.b.flags << 16) | 267 (cur->bc_nlevels << 24) | (cur->bc_private.b.flags << 16) |
268 cur->bc_private.b.allocated, 268 cur->bc_private.b.allocated,
269 INT_GET(r.l0, ARCH_CONVERT) >> 32, (int)INT_GET(r.l0, ARCH_CONVERT), INT_GET(r.l1, ARCH_CONVERT) >> 32, (int)INT_GET(r.l1, ARCH_CONVERT), 269 r.l0 >> 32, (int)r.l0,
270 r.l1 >> 32, (int)r.l1,
270 (unsigned long)cur->bc_bufs[0], (unsigned long)cur->bc_bufs[1], 271 (unsigned long)cur->bc_bufs[0], (unsigned long)cur->bc_bufs[1],
271 (unsigned long)cur->bc_bufs[2], (unsigned long)cur->bc_bufs[3], 272 (unsigned long)cur->bc_bufs[2], (unsigned long)cur->bc_bufs[3],
272 (cur->bc_ptrs[0] << 16) | cur->bc_ptrs[1], 273 (cur->bc_ptrs[0] << 16) | cur->bc_ptrs[1],
@@ -1826,7 +1827,7 @@ __xfs_bmbt_get_all(
1826 1827
1827void 1828void
1828xfs_bmbt_get_all( 1829xfs_bmbt_get_all(
1829 xfs_bmbt_rec_t *r, 1830 xfs_bmbt_rec_host_t *r,
1830 xfs_bmbt_irec_t *s) 1831 xfs_bmbt_irec_t *s)
1831{ 1832{
1832 __xfs_bmbt_get_all(r->l0, r->l1, s); 1833 __xfs_bmbt_get_all(r->l0, r->l1, s);
@@ -1862,7 +1863,7 @@ xfs_bmbt_get_block(
1862 */ 1863 */
1863xfs_filblks_t 1864xfs_filblks_t
1864xfs_bmbt_get_blockcount( 1865xfs_bmbt_get_blockcount(
1865 xfs_bmbt_rec_t *r) 1866 xfs_bmbt_rec_host_t *r)
1866{ 1867{
1867 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21)); 1868 return (xfs_filblks_t)(r->l1 & XFS_MASK64LO(21));
1868} 1869}
@@ -1872,7 +1873,7 @@ xfs_bmbt_get_blockcount(
1872 */ 1873 */
1873xfs_fsblock_t 1874xfs_fsblock_t
1874xfs_bmbt_get_startblock( 1875xfs_bmbt_get_startblock(
1875 xfs_bmbt_rec_t *r) 1876 xfs_bmbt_rec_host_t *r)
1876{ 1877{
1877#if XFS_BIG_BLKNOS 1878#if XFS_BIG_BLKNOS
1878 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) | 1879 return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) |
@@ -1896,7 +1897,7 @@ xfs_bmbt_get_startblock(
1896 */ 1897 */
1897xfs_fileoff_t 1898xfs_fileoff_t
1898xfs_bmbt_get_startoff( 1899xfs_bmbt_get_startoff(
1899 xfs_bmbt_rec_t *r) 1900 xfs_bmbt_rec_host_t *r)
1900{ 1901{
1901 return ((xfs_fileoff_t)r->l0 & 1902 return ((xfs_fileoff_t)r->l0 &
1902 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 1903 XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
@@ -1904,7 +1905,7 @@ xfs_bmbt_get_startoff(
1904 1905
1905xfs_exntst_t 1906xfs_exntst_t
1906xfs_bmbt_get_state( 1907xfs_bmbt_get_state(
1907 xfs_bmbt_rec_t *r) 1908 xfs_bmbt_rec_host_t *r)
1908{ 1909{
1909 int ext_flag; 1910 int ext_flag;
1910 1911
@@ -2294,7 +2295,7 @@ xfs_bmbt_newroot(
2294 */ 2295 */
2295void 2296void
2296xfs_bmbt_set_all( 2297xfs_bmbt_set_all(
2297 xfs_bmbt_rec_t *r, 2298 xfs_bmbt_rec_host_t *r,
2298 xfs_bmbt_irec_t *s) 2299 xfs_bmbt_irec_t *s)
2299{ 2300{
2300 int extent_flag; 2301 int extent_flag;
@@ -2336,7 +2337,7 @@ xfs_bmbt_set_all(
2336 */ 2337 */
2337void 2338void
2338xfs_bmbt_set_allf( 2339xfs_bmbt_set_allf(
2339 xfs_bmbt_rec_t *r, 2340 xfs_bmbt_rec_host_t *r,
2340 xfs_fileoff_t o, 2341 xfs_fileoff_t o,
2341 xfs_fsblock_t b, 2342 xfs_fsblock_t b,
2342 xfs_filblks_t c, 2343 xfs_filblks_t c,
@@ -2468,7 +2469,7 @@ xfs_bmbt_disk_set_allf(
2468 */ 2469 */
2469void 2470void
2470xfs_bmbt_set_blockcount( 2471xfs_bmbt_set_blockcount(
2471 xfs_bmbt_rec_t *r, 2472 xfs_bmbt_rec_host_t *r,
2472 xfs_filblks_t v) 2473 xfs_filblks_t v)
2473{ 2474{
2474 ASSERT((v & XFS_MASK64HI(43)) == 0); 2475 ASSERT((v & XFS_MASK64HI(43)) == 0);
@@ -2481,7 +2482,7 @@ xfs_bmbt_set_blockcount(
2481 */ 2482 */
2482void 2483void
2483xfs_bmbt_set_startblock( 2484xfs_bmbt_set_startblock(
2484 xfs_bmbt_rec_t *r, 2485 xfs_bmbt_rec_host_t *r,
2485 xfs_fsblock_t v) 2486 xfs_fsblock_t v)
2486{ 2487{
2487#if XFS_BIG_BLKNOS 2488#if XFS_BIG_BLKNOS
@@ -2509,7 +2510,7 @@ xfs_bmbt_set_startblock(
2509 */ 2510 */
2510void 2511void
2511xfs_bmbt_set_startoff( 2512xfs_bmbt_set_startoff(
2512 xfs_bmbt_rec_t *r, 2513 xfs_bmbt_rec_host_t *r,
2513 xfs_fileoff_t v) 2514 xfs_fileoff_t v)
2514{ 2515{
2515 ASSERT((v & XFS_MASK64HI(9)) == 0); 2516 ASSERT((v & XFS_MASK64HI(9)) == 0);
@@ -2523,7 +2524,7 @@ xfs_bmbt_set_startoff(
2523 */ 2524 */
2524void 2525void
2525xfs_bmbt_set_state( 2526xfs_bmbt_set_state(
2526 xfs_bmbt_rec_t *r, 2527 xfs_bmbt_rec_host_t *r,
2527 xfs_exntst_t v) 2528 xfs_exntst_t v)
2528{ 2529{
2529 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN); 2530 ASSERT(v == XFS_EXT_NORM || v == XFS_EXT_UNWRITTEN);
@@ -2624,10 +2625,8 @@ xfs_check_nostate_extents(
2624 xfs_extnum_t idx, 2625 xfs_extnum_t idx,
2625 xfs_extnum_t num) 2626 xfs_extnum_t num)
2626{ 2627{
2627 xfs_bmbt_rec_t *ep;
2628
2629 for (; num > 0; num--, idx++) { 2628 for (; num > 0; num--, idx++) {
2630 ep = xfs_iext_get_ext(ifp, idx); 2629 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx);
2631 if ((ep->l0 >> 2630 if ((ep->l0 >>
2632 (64 - BMBT_EXNTFLAG_BITLEN)) != 0) { 2631 (64 - BMBT_EXNTFLAG_BITLEN)) != 0) {
2633 ASSERT(0); 2632 ASSERT(0);
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index a77b1b753d0c..268289059022 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -89,6 +89,10 @@ typedef struct xfs_bmbt_rec_64
89typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */ 89typedef __uint64_t xfs_bmbt_rec_base_t; /* use this for casts */
90typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t; 90typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
91 91
92typedef struct xfs_bmbt_rec_host {
93 __uint64_t l0, l1;
94} xfs_bmbt_rec_host_t;
95
92/* 96/*
93 * Values and macros for delayed-allocation startblock fields. 97 * Values and macros for delayed-allocation startblock fields.
94 */ 98 */
@@ -281,13 +285,13 @@ extern ktrace_t *xfs_bmbt_trace_buf;
281extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int); 285extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int);
282extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *); 286extern int xfs_bmbt_decrement(struct xfs_btree_cur *, int, int *);
283extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *); 287extern int xfs_bmbt_delete(struct xfs_btree_cur *, int *);
284extern void xfs_bmbt_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 288extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s);
285extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur, 289extern xfs_bmbt_block_t *xfs_bmbt_get_block(struct xfs_btree_cur *cur,
286 int, struct xfs_buf **bpp); 290 int, struct xfs_buf **bpp);
287extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_t *r); 291extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r);
288extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_t *r); 292extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r);
289extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_t *r); 293extern xfs_fileoff_t xfs_bmbt_get_startoff(xfs_bmbt_rec_host_t *r);
290extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r); 294extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_host_t *r);
291 295
292#ifndef XFS_NATIVE_HOST 296#ifndef XFS_NATIVE_HOST
293extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 297extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
@@ -315,13 +319,13 @@ extern int xfs_bmbt_lookup_ge(struct xfs_btree_cur *, xfs_fileoff_t,
315 */ 319 */
316extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat); 320extern int xfs_bmbt_newroot(struct xfs_btree_cur *cur, int *lflags, int *stat);
317 321
318extern void xfs_bmbt_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 322extern void xfs_bmbt_set_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s);
319extern void xfs_bmbt_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, 323extern void xfs_bmbt_set_allf(xfs_bmbt_rec_host_t *r, xfs_fileoff_t o,
320 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); 324 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
321extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_t *r, xfs_filblks_t v); 325extern void xfs_bmbt_set_blockcount(xfs_bmbt_rec_host_t *r, xfs_filblks_t v);
322extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_t *r, xfs_fsblock_t v); 326extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v);
323extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_t *r, xfs_fileoff_t v); 327extern void xfs_bmbt_set_startoff(xfs_bmbt_rec_host_t *r, xfs_fileoff_t v);
324extern void xfs_bmbt_set_state(xfs_bmbt_rec_t *r, xfs_exntst_t v); 328extern void xfs_bmbt_set_state(xfs_bmbt_rec_host_t *r, xfs_exntst_t v);
325 329
326#ifndef XFS_NATIVE_HOST 330#ifndef XFS_NATIVE_HOST
327extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 331extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index cdc4c28926d0..ef8c31a14c92 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -67,7 +67,6 @@ STATIC int xfs_iformat_local(xfs_inode_t *, xfs_dinode_t *, int, int);
67STATIC int xfs_iformat_extents(xfs_inode_t *, xfs_dinode_t *, int); 67STATIC int xfs_iformat_extents(xfs_inode_t *, xfs_dinode_t *, int);
68STATIC int xfs_iformat_btree(xfs_inode_t *, xfs_dinode_t *, int); 68STATIC int xfs_iformat_btree(xfs_inode_t *, xfs_dinode_t *, int);
69 69
70
71#ifdef DEBUG 70#ifdef DEBUG
72/* 71/*
73 * Make sure that the extents in the given memory buffer 72 * Make sure that the extents in the given memory buffer
@@ -77,28 +76,23 @@ STATIC void
77xfs_validate_extents( 76xfs_validate_extents(
78 xfs_ifork_t *ifp, 77 xfs_ifork_t *ifp,
79 int nrecs, 78 int nrecs,
80 int disk,
81 xfs_exntfmt_t fmt) 79 xfs_exntfmt_t fmt)
82{ 80{
83 xfs_bmbt_rec_t *ep;
84 xfs_bmbt_irec_t irec; 81 xfs_bmbt_irec_t irec;
85 xfs_bmbt_rec_t rec; 82 xfs_bmbt_rec_host_t rec;
86 int i; 83 int i;
87 84
88 for (i = 0; i < nrecs; i++) { 85 for (i = 0; i < nrecs; i++) {
89 ep = xfs_iext_get_ext(ifp, i); 86 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
90 rec.l0 = get_unaligned((__uint64_t*)&ep->l0); 87 rec.l0 = get_unaligned(&ep->l0);
91 rec.l1 = get_unaligned((__uint64_t*)&ep->l1); 88 rec.l1 = get_unaligned(&ep->l1);
92 if (disk) 89 xfs_bmbt_get_all(&rec, &irec);
93 xfs_bmbt_disk_get_all(&rec, &irec);
94 else
95 xfs_bmbt_get_all(&rec, &irec);
96 if (fmt == XFS_EXTFMT_NOSTATE) 90 if (fmt == XFS_EXTFMT_NOSTATE)
97 ASSERT(irec.br_state == XFS_EXT_NORM); 91 ASSERT(irec.br_state == XFS_EXT_NORM);
98 } 92 }
99} 93}
100#else /* DEBUG */ 94#else /* DEBUG */
101#define xfs_validate_extents(ifp, nrecs, disk, fmt) 95#define xfs_validate_extents(ifp, nrecs, fmt)
102#endif /* DEBUG */ 96#endif /* DEBUG */
103 97
104/* 98/*
@@ -602,7 +596,7 @@ xfs_iformat_extents(
602 xfs_dinode_t *dip, 596 xfs_dinode_t *dip,
603 int whichfork) 597 int whichfork)
604{ 598{
605 xfs_bmbt_rec_t *ep, *dp; 599 xfs_bmbt_rec_t *dp;
606 xfs_ifork_t *ifp; 600 xfs_ifork_t *ifp;
607 int nex; 601 int nex;
608 int size; 602 int size;
@@ -637,9 +631,9 @@ xfs_iformat_extents(
637 ifp->if_bytes = size; 631 ifp->if_bytes = size;
638 if (size) { 632 if (size) {
639 dp = (xfs_bmbt_rec_t *) XFS_DFORK_PTR(dip, whichfork); 633 dp = (xfs_bmbt_rec_t *) XFS_DFORK_PTR(dip, whichfork);
640 xfs_validate_extents(ifp, nex, 1, XFS_EXTFMT_INODE(ip)); 634 xfs_validate_extents(ifp, nex, XFS_EXTFMT_INODE(ip));
641 for (i = 0; i < nex; i++, dp++) { 635 for (i = 0; i < nex; i++, dp++) {
642 ep = xfs_iext_get_ext(ifp, i); 636 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
643 ep->l0 = INT_GET(get_unaligned((__uint64_t*)&dp->l0), 637 ep->l0 = INT_GET(get_unaligned((__uint64_t*)&dp->l0),
644 ARCH_CONVERT); 638 ARCH_CONVERT);
645 ep->l1 = INT_GET(get_unaligned((__uint64_t*)&dp->l1), 639 ep->l1 = INT_GET(get_unaligned((__uint64_t*)&dp->l1),
@@ -1048,7 +1042,7 @@ xfs_iread_extents(
1048 ifp->if_flags &= ~XFS_IFEXTENTS; 1042 ifp->if_flags &= ~XFS_IFEXTENTS;
1049 return error; 1043 return error;
1050 } 1044 }
1051 xfs_validate_extents(ifp, nextents, 0, XFS_EXTFMT_INODE(ip)); 1045 xfs_validate_extents(ifp, nextents, XFS_EXTFMT_INODE(ip));
1052 return 0; 1046 return 0;
1053} 1047}
1054 1048
@@ -2887,12 +2881,10 @@ xfs_iunpin_wait(
2887int 2881int
2888xfs_iextents_copy( 2882xfs_iextents_copy(
2889 xfs_inode_t *ip, 2883 xfs_inode_t *ip,
2890 xfs_bmbt_rec_t *buffer, 2884 xfs_bmbt_rec_t *dp,
2891 int whichfork) 2885 int whichfork)
2892{ 2886{
2893 int copied; 2887 int copied;
2894 xfs_bmbt_rec_t *dest_ep;
2895 xfs_bmbt_rec_t *ep;
2896 int i; 2888 int i;
2897 xfs_ifork_t *ifp; 2889 xfs_ifork_t *ifp;
2898 int nrecs; 2890 int nrecs;
@@ -2912,10 +2904,9 @@ xfs_iextents_copy(
2912 * the delayed ones. There must be at least one 2904 * the delayed ones. There must be at least one
2913 * non-delayed extent. 2905 * non-delayed extent.
2914 */ 2906 */
2915 dest_ep = buffer;
2916 copied = 0; 2907 copied = 0;
2917 for (i = 0; i < nrecs; i++) { 2908 for (i = 0; i < nrecs; i++) {
2918 ep = xfs_iext_get_ext(ifp, i); 2909 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
2919 start_block = xfs_bmbt_get_startblock(ep); 2910 start_block = xfs_bmbt_get_startblock(ep);
2920 if (ISNULLSTARTBLOCK(start_block)) { 2911 if (ISNULLSTARTBLOCK(start_block)) {
2921 /* 2912 /*
@@ -2926,14 +2917,14 @@ xfs_iextents_copy(
2926 2917
2927 /* Translate to on disk format */ 2918 /* Translate to on disk format */
2928 put_unaligned(INT_GET(ep->l0, ARCH_CONVERT), 2919 put_unaligned(INT_GET(ep->l0, ARCH_CONVERT),
2929 (__uint64_t*)&dest_ep->l0); 2920 (__uint64_t*)&dp->l0);
2930 put_unaligned(INT_GET(ep->l1, ARCH_CONVERT), 2921 put_unaligned(INT_GET(ep->l1, ARCH_CONVERT),
2931 (__uint64_t*)&dest_ep->l1); 2922 (__uint64_t*)&dp->l1);
2932 dest_ep++; 2923 dp++;
2933 copied++; 2924 copied++;
2934 } 2925 }
2935 ASSERT(copied != 0); 2926 ASSERT(copied != 0);
2936 xfs_validate_extents(ifp, copied, 1, XFS_EXTFMT_INODE(ip)); 2927 xfs_validate_extents(ifp, copied, XFS_EXTFMT_INODE(ip));
2937 2928
2938 return (copied * (uint)sizeof(xfs_bmbt_rec_t)); 2929 return (copied * (uint)sizeof(xfs_bmbt_rec_t));
2939} 2930}
@@ -3711,7 +3702,7 @@ xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags, inst_t *ra)
3711/* 3702/*
3712 * Return a pointer to the extent record at file index idx. 3703 * Return a pointer to the extent record at file index idx.
3713 */ 3704 */
3714xfs_bmbt_rec_t * 3705xfs_bmbt_rec_host_t *
3715xfs_iext_get_ext( 3706xfs_iext_get_ext(
3716 xfs_ifork_t *ifp, /* inode fork pointer */ 3707 xfs_ifork_t *ifp, /* inode fork pointer */
3717 xfs_extnum_t idx) /* index of target extent */ 3708 xfs_extnum_t idx) /* index of target extent */
@@ -3744,15 +3735,12 @@ xfs_iext_insert(
3744 xfs_extnum_t count, /* number of inserted items */ 3735 xfs_extnum_t count, /* number of inserted items */
3745 xfs_bmbt_irec_t *new) /* items to insert */ 3736 xfs_bmbt_irec_t *new) /* items to insert */
3746{ 3737{
3747 xfs_bmbt_rec_t *ep; /* extent record pointer */
3748 xfs_extnum_t i; /* extent record index */ 3738 xfs_extnum_t i; /* extent record index */
3749 3739
3750 ASSERT(ifp->if_flags & XFS_IFEXTENTS); 3740 ASSERT(ifp->if_flags & XFS_IFEXTENTS);
3751 xfs_iext_add(ifp, idx, count); 3741 xfs_iext_add(ifp, idx, count);
3752 for (i = idx; i < idx + count; i++, new++) { 3742 for (i = idx; i < idx + count; i++, new++)
3753 ep = xfs_iext_get_ext(ifp, i); 3743 xfs_bmbt_set_all(xfs_iext_get_ext(ifp, i), new);
3754 xfs_bmbt_set_all(ep, new);
3755 }
3756} 3744}
3757 3745
3758/* 3746/*
@@ -4203,7 +4191,7 @@ xfs_iext_realloc_direct(
4203 rnew_size = xfs_iroundup(new_size); 4191 rnew_size = xfs_iroundup(new_size);
4204 } 4192 }
4205 if (rnew_size != ifp->if_real_bytes) { 4193 if (rnew_size != ifp->if_real_bytes) {
4206 ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) 4194 ifp->if_u1.if_extents =
4207 kmem_realloc(ifp->if_u1.if_extents, 4195 kmem_realloc(ifp->if_u1.if_extents,
4208 rnew_size, 4196 rnew_size,
4209 ifp->if_real_bytes, 4197 ifp->if_real_bytes,
@@ -4266,8 +4254,7 @@ xfs_iext_inline_to_direct(
4266 xfs_ifork_t *ifp, /* inode fork pointer */ 4254 xfs_ifork_t *ifp, /* inode fork pointer */
4267 int new_size) /* number of extents in file */ 4255 int new_size) /* number of extents in file */
4268{ 4256{
4269 ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) 4257 ifp->if_u1.if_extents = kmem_alloc(new_size, KM_SLEEP);
4270 kmem_alloc(new_size, KM_SLEEP);
4271 memset(ifp->if_u1.if_extents, 0, new_size); 4258 memset(ifp->if_u1.if_extents, 0, new_size);
4272 if (ifp->if_bytes) { 4259 if (ifp->if_bytes) {
4273 memcpy(ifp->if_u1.if_extents, ifp->if_u2.if_inline_ext, 4260 memcpy(ifp->if_u1.if_extents, ifp->if_u2.if_inline_ext,
@@ -4310,7 +4297,7 @@ void
4310xfs_iext_indirect_to_direct( 4297xfs_iext_indirect_to_direct(
4311 xfs_ifork_t *ifp) /* inode fork pointer */ 4298 xfs_ifork_t *ifp) /* inode fork pointer */
4312{ 4299{
4313 xfs_bmbt_rec_t *ep; /* extent record pointer */ 4300 xfs_bmbt_rec_host_t *ep; /* extent record pointer */
4314 xfs_extnum_t nextents; /* number of extents in file */ 4301 xfs_extnum_t nextents; /* number of extents in file */
4315 int size; /* size of file extents */ 4302 int size; /* size of file extents */
4316 4303
@@ -4362,15 +4349,15 @@ xfs_iext_destroy(
4362/* 4349/*
4363 * Return a pointer to the extent record for file system block bno. 4350 * Return a pointer to the extent record for file system block bno.
4364 */ 4351 */
4365xfs_bmbt_rec_t * /* pointer to found extent record */ 4352xfs_bmbt_rec_host_t * /* pointer to found extent record */
4366xfs_iext_bno_to_ext( 4353xfs_iext_bno_to_ext(
4367 xfs_ifork_t *ifp, /* inode fork pointer */ 4354 xfs_ifork_t *ifp, /* inode fork pointer */
4368 xfs_fileoff_t bno, /* block number to search for */ 4355 xfs_fileoff_t bno, /* block number to search for */
4369 xfs_extnum_t *idxp) /* index of target extent */ 4356 xfs_extnum_t *idxp) /* index of target extent */
4370{ 4357{
4371 xfs_bmbt_rec_t *base; /* pointer to first extent */ 4358 xfs_bmbt_rec_host_t *base; /* pointer to first extent */
4372 xfs_filblks_t blockcount = 0; /* number of blocks in extent */ 4359 xfs_filblks_t blockcount = 0; /* number of blocks in extent */
4373 xfs_bmbt_rec_t *ep = NULL; /* pointer to target extent */ 4360 xfs_bmbt_rec_host_t *ep = NULL; /* pointer to target extent */
4374 xfs_ext_irec_t *erp = NULL; /* indirection array pointer */ 4361 xfs_ext_irec_t *erp = NULL; /* indirection array pointer */
4375 int high; /* upper boundary in search */ 4362 int high; /* upper boundary in search */
4376 xfs_extnum_t idx = 0; /* index of target extent */ 4363 xfs_extnum_t idx = 0; /* index of target extent */
@@ -4545,8 +4532,7 @@ xfs_iext_irec_init(
4545 kmem_alloc(sizeof(xfs_ext_irec_t), KM_SLEEP); 4532 kmem_alloc(sizeof(xfs_ext_irec_t), KM_SLEEP);
4546 4533
4547 if (nextents == 0) { 4534 if (nextents == 0) {
4548 ifp->if_u1.if_extents = (xfs_bmbt_rec_t *) 4535 ifp->if_u1.if_extents = kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4549 kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4550 } else if (!ifp->if_real_bytes) { 4536 } else if (!ifp->if_real_bytes) {
4551 xfs_iext_inline_to_direct(ifp, XFS_IEXT_BUFSZ); 4537 xfs_iext_inline_to_direct(ifp, XFS_IEXT_BUFSZ);
4552 } else if (ifp->if_real_bytes < XFS_IEXT_BUFSZ) { 4538 } else if (ifp->if_real_bytes < XFS_IEXT_BUFSZ) {
@@ -4594,8 +4580,7 @@ xfs_iext_irec_new(
4594 4580
4595 /* Initialize new extent record */ 4581 /* Initialize new extent record */
4596 erp = ifp->if_u1.if_ext_irec; 4582 erp = ifp->if_u1.if_ext_irec;
4597 erp[erp_idx].er_extbuf = (xfs_bmbt_rec_t *) 4583 erp[erp_idx].er_extbuf = kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4598 kmem_alloc(XFS_IEXT_BUFSZ, KM_SLEEP);
4599 ifp->if_real_bytes = nlists * XFS_IEXT_BUFSZ; 4584 ifp->if_real_bytes = nlists * XFS_IEXT_BUFSZ;
4600 memset(erp[erp_idx].er_extbuf, 0, XFS_IEXT_BUFSZ); 4585 memset(erp[erp_idx].er_extbuf, 0, XFS_IEXT_BUFSZ);
4601 erp[erp_idx].er_extcount = 0; 4586 erp[erp_idx].er_extcount = 0;
@@ -4727,7 +4712,7 @@ void
4727xfs_iext_irec_compact_full( 4712xfs_iext_irec_compact_full(
4728 xfs_ifork_t *ifp) /* inode fork pointer */ 4713 xfs_ifork_t *ifp) /* inode fork pointer */
4729{ 4714{
4730 xfs_bmbt_rec_t *ep, *ep_next; /* extent record pointers */ 4715 xfs_bmbt_rec_host_t *ep, *ep_next; /* extent record pointers */
4731 xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */ 4716 xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */
4732 int erp_idx = 0; /* extent irec index */ 4717 int erp_idx = 0; /* extent irec index */
4733 int ext_avail; /* empty entries in ex list */ 4718 int ext_avail; /* empty entries in ex list */
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 012dfd4a958c..6fae71b42922 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -44,7 +44,7 @@
44 * it is possible that a third level of indirection may be required. 44 * it is possible that a third level of indirection may be required.
45 */ 45 */
46typedef struct xfs_ext_irec { 46typedef struct xfs_ext_irec {
47 xfs_bmbt_rec_t *er_extbuf; /* block of extent records */ 47 xfs_bmbt_rec_host_t *er_extbuf; /* block of extent records */
48 xfs_extnum_t er_extoff; /* extent offset in file */ 48 xfs_extnum_t er_extoff; /* extent offset in file */
49 xfs_extnum_t er_extcount; /* number of extents in page/block */ 49 xfs_extnum_t er_extcount; /* number of extents in page/block */
50} xfs_ext_irec_t; 50} xfs_ext_irec_t;
@@ -65,12 +65,12 @@ typedef struct xfs_ifork {
65 unsigned char if_ext_max; /* max # of extent records */ 65 unsigned char if_ext_max; /* max # of extent records */
66 xfs_extnum_t if_lastex; /* last if_extents used */ 66 xfs_extnum_t if_lastex; /* last if_extents used */
67 union { 67 union {
68 xfs_bmbt_rec_t *if_extents; /* linear map file exts */ 68 xfs_bmbt_rec_host_t *if_extents;/* linear map file exts */
69 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */ 69 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */
70 char *if_data; /* inline file data */ 70 char *if_data; /* inline file data */
71 } if_u1; 71 } if_u1;
72 union { 72 union {
73 xfs_bmbt_rec_t if_inline_ext[XFS_INLINE_EXTS]; 73 xfs_bmbt_rec_host_t if_inline_ext[XFS_INLINE_EXTS];
74 /* very small file extents */ 74 /* very small file extents */
75 char if_inline_data[XFS_INLINE_DATA]; 75 char if_inline_data[XFS_INLINE_DATA];
76 /* very small file data */ 76 /* very small file data */
@@ -549,7 +549,7 @@ xfs_inode_t *xfs_vtoi(struct bhv_vnode *vp);
549 549
550void xfs_synchronize_atime(xfs_inode_t *); 550void xfs_synchronize_atime(xfs_inode_t *);
551 551
552xfs_bmbt_rec_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t); 552xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
553void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t, 553void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
554 xfs_bmbt_irec_t *); 554 xfs_bmbt_irec_t *);
555void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int); 555void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int);
@@ -564,7 +564,7 @@ void xfs_iext_indirect_to_direct(xfs_ifork_t *);
564void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t); 564void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t);
565void xfs_iext_inline_to_direct(xfs_ifork_t *, int); 565void xfs_iext_inline_to_direct(xfs_ifork_t *, int);
566void xfs_iext_destroy(xfs_ifork_t *); 566void xfs_iext_destroy(xfs_ifork_t *);
567xfs_bmbt_rec_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *); 567xfs_bmbt_rec_host_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *);
568xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *); 568xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *);
569xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int); 569xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int);
570void xfs_iext_irec_init(xfs_ifork_t *); 570void xfs_iext_irec_init(xfs_ifork_t *);