|
|
| version 1.373, 2007/07/24 06:15:02 | version 1.374, 2007/08/02 16:04:40 |
|---|---|
| Line 248 xfs_bmap_local_to_extents( | Line 248 xfs_bmap_local_to_extents( |
| * Else, *lastxp will be set to the index of the found | * Else, *lastxp will be set to the index of the found |
| * entry; *gotp will contain the entry. | * entry; *gotp will contain the entry. |
| */ | */ |
| STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ | STATIC xfs_bmbt_rec_host_t * /* pointer to found extent entry */ |
| xfs_bmap_search_extents( | xfs_bmap_search_extents( |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_fileoff_t bno, /* block number searched for */ | xfs_fileoff_t bno, /* block number searched for */ |
| Line 273 xfs_bmap_isaeof( | Line 273 xfs_bmap_isaeof( |
| #ifdef XFS_BMAP_TRACE | #ifdef XFS_BMAP_TRACE |
| /* | /* |
| * Add a bmap trace buffer entry. Base routine for the others. | |
| */ | |
| STATIC void | |
| xfs_bmap_trace_addentry( | |
| int opcode, /* operation */ | |
| const char *fname, /* function name */ | |
| char *desc, /* operation description */ | |
| xfs_inode_t *ip, /* incore inode pointer */ | |
| xfs_extnum_t idx, /* index of entry(ies) */ | |
| xfs_extnum_t cnt, /* count of entries, 1 or 2 */ | |
| xfs_bmbt_rec_t *r1, /* first record */ | |
| xfs_bmbt_rec_t *r2, /* second record or null */ | |
| int whichfork); /* data or attr fork */ | |
| /* | |
| * Add bmap trace entry prior to a call to xfs_iext_remove. | * Add bmap trace entry prior to a call to xfs_iext_remove. |
| */ | */ |
| STATIC void | STATIC void |
| Line 714 xfs_bmap_add_extent_delay_real( | Line 699 xfs_bmap_add_extent_delay_real( |
| { | { |
| xfs_btree_cur_t *cur; /* btree cursor */ | xfs_btree_cur_t *cur; /* btree cursor */ |
| int diff; /* temp value */ | int diff; /* temp value */ |
| xfs_bmbt_rec_t *ep; /* extent entry for idx */ | xfs_bmbt_rec_host_t *ep; /* extent entry for idx */ |
| int error; /* error return value */ | int error; /* error return value */ |
| int i; /* temp state */ | int i; /* temp state */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| Line 1270 xfs_bmap_add_extent_unwritten_real( | Line 1255 xfs_bmap_add_extent_unwritten_real( |
| xfs_extdelta_t *delta) /* Change made to incore extents */ | xfs_extdelta_t *delta) /* Change made to incore extents */ |
| { | { |
| xfs_btree_cur_t *cur; /* btree cursor */ | xfs_btree_cur_t *cur; /* btree cursor */ |
| xfs_bmbt_rec_t *ep; /* extent entry for idx */ | xfs_bmbt_rec_host_t *ep; /* extent entry for idx */ |
| int error; /* error return value */ | int error; /* error return value */ |
| int i; /* temp state */ | int i; /* temp state */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| Line 1823 xfs_bmap_add_extent_hole_delay( | Line 1808 xfs_bmap_add_extent_hole_delay( |
| xfs_extdelta_t *delta, /* Change made to incore extents */ | xfs_extdelta_t *delta, /* Change made to incore extents */ |
| int rsvd) /* OK to allocate reserved blocks */ | int rsvd) /* OK to allocate reserved blocks */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* extent record for idx */ | xfs_bmbt_rec_host_t *ep; /* extent record for idx */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_bmbt_irec_t left; /* left neighbor extent entry */ | xfs_bmbt_irec_t left; /* left neighbor extent entry */ |
| xfs_filblks_t newlen=0; /* new indirect size */ | xfs_filblks_t newlen=0; /* new indirect size */ |
| Line 2012 xfs_bmap_add_extent_hole_real( | Line 1997 xfs_bmap_add_extent_hole_real( |
| xfs_extdelta_t *delta, /* Change made to incore extents */ | xfs_extdelta_t *delta, /* Change made to incore extents */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* pointer to extent entry ins. point */ | xfs_bmbt_rec_host_t *ep; /* pointer to extent entry ins. point */ |
| int error; /* error return value */ | int error; /* error return value */ |
| int i; /* temp state */ | int i; /* temp state */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| Line 3070 xfs_bmap_del_extent( | Line 3055 xfs_bmap_del_extent( |
| xfs_fileoff_t del_endoff; /* first offset past del */ | xfs_fileoff_t del_endoff; /* first offset past del */ |
| int delay; /* current block is delayed allocated */ | int delay; /* current block is delayed allocated */ |
| int do_fx; /* free extent at end of routine */ | int do_fx; /* free extent at end of routine */ |
| xfs_bmbt_rec_t *ep; /* current extent entry pointer */ | xfs_bmbt_rec_host_t *ep; /* current extent entry pointer */ |
| int error; /* error return value */ | int error; /* error return value */ |
| int flags; /* inode logging flags */ | int flags; /* inode logging flags */ |
| xfs_bmbt_irec_t got; /* current extent entry */ | xfs_bmbt_irec_t got; /* current extent entry */ |
| Line 3418 xfs_bmap_extents_to_btree( | Line 3403 xfs_bmap_extents_to_btree( |
| xfs_bmbt_rec_t *arp; /* child record pointer */ | xfs_bmbt_rec_t *arp; /* child record pointer */ |
| xfs_bmbt_block_t *block; /* btree root block */ | xfs_bmbt_block_t *block; /* btree root block */ |
| xfs_btree_cur_t *cur; /* bmap btree cursor */ | xfs_btree_cur_t *cur; /* bmap btree cursor */ |
| xfs_bmbt_rec_t *ep; /* extent record pointer */ | xfs_bmbt_rec_host_t *ep; /* extent record pointer */ |
| int error; /* error return value */ | int error; /* error return value */ |
| xfs_extnum_t i, cnt; /* extent record index */ | xfs_extnum_t i, cnt; /* extent record index */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| Line 3590 xfs_bmap_local_to_extents( | Line 3575 xfs_bmap_local_to_extents( |
| if (ifp->if_bytes) { | if (ifp->if_bytes) { |
| xfs_alloc_arg_t args; /* allocation arguments */ | xfs_alloc_arg_t args; /* allocation arguments */ |
| xfs_buf_t *bp; /* buffer for extent block */ | xfs_buf_t *bp; /* buffer for extent block */ |
| xfs_bmbt_rec_t *ep; /* extent record pointer */ | xfs_bmbt_rec_host_t *ep;/* extent record pointer */ |
| args.tp = tp; | args.tp = tp; |
| args.mp = ip->i_mount; | args.mp = ip->i_mount; |
| Line 3655 done: | Line 3640 done: |
| * entry (null if none). Else, *lastxp will be set to the index | * entry (null if none). Else, *lastxp will be set to the index |
| * of the found entry; *gotp will contain the entry. | * of the found entry; *gotp will contain the entry. |
| */ | */ |
| xfs_bmbt_rec_t * /* pointer to found extent entry */ | xfs_bmbt_rec_host_t * /* pointer to found extent entry */ |
| xfs_bmap_search_multi_extents( | xfs_bmap_search_multi_extents( |
| xfs_ifork_t *ifp, /* inode fork pointer */ | xfs_ifork_t *ifp, /* inode fork pointer */ |
| xfs_fileoff_t bno, /* block number searched for */ | xfs_fileoff_t bno, /* block number searched for */ |
| Line 3664 xfs_bmap_search_multi_extents( | Line 3649 xfs_bmap_search_multi_extents( |
| xfs_bmbt_irec_t *gotp, /* out: extent entry found */ | xfs_bmbt_irec_t *gotp, /* out: extent entry found */ |
| xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ | xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* extent record pointer */ | xfs_bmbt_rec_host_t *ep; /* extent record pointer */ |
| xfs_extnum_t lastx; /* last extent index */ | xfs_extnum_t lastx; /* last extent index */ |
| /* | /* |
| Line 3706 xfs_bmap_search_multi_extents( | Line 3691 xfs_bmap_search_multi_extents( |
| * Else, *lastxp will be set to the index of the found | * Else, *lastxp will be set to the index of the found |
| * entry; *gotp will contain the entry. | * entry; *gotp will contain the entry. |
| */ | */ |
| STATIC xfs_bmbt_rec_t * /* pointer to found extent entry */ | STATIC xfs_bmbt_rec_host_t * /* pointer to found extent entry */ |
| xfs_bmap_search_extents( | xfs_bmap_search_extents( |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_fileoff_t bno, /* block number searched for */ | xfs_fileoff_t bno, /* block number searched for */ |
| Line 3717 xfs_bmap_search_extents( | Line 3702 xfs_bmap_search_extents( |
| xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ | xfs_bmbt_irec_t *prevp) /* out: previous extent entry found */ |
| { | { |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_bmbt_rec_t *ep; /* extent record pointer */ | xfs_bmbt_rec_host_t *ep; /* extent record pointer */ |
| XFS_STATS_INC(xs_look_exlist); | XFS_STATS_INC(xs_look_exlist); |
| ifp = XFS_IFORK_PTR(ip, fork); | ifp = XFS_IFORK_PTR(ip, fork); |
| Line 3757 xfs_bmap_trace_addentry( | Line 3742 xfs_bmap_trace_addentry( |
| xfs_inode_t *ip, /* incore inode pointer */ | xfs_inode_t *ip, /* incore inode pointer */ |
| xfs_extnum_t idx, /* index of entry(ies) */ | xfs_extnum_t idx, /* index of entry(ies) */ |
| xfs_extnum_t cnt, /* count of entries, 1 or 2 */ | xfs_extnum_t cnt, /* count of entries, 1 or 2 */ |
| xfs_bmbt_rec_t *r1, /* first record */ | xfs_bmbt_rec_host_t *r1, /* first record */ |
| xfs_bmbt_rec_t *r2, /* second record or null */ | xfs_bmbt_rec_host_t *r2, /* second record or null */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| { | { |
| xfs_bmbt_rec_t tr2; | xfs_bmbt_rec_host_t tr2; |
| ASSERT(cnt == 1 || cnt == 2); | ASSERT(cnt == 1 || cnt == 2); |
| ASSERT(r1 != NULL); | ASSERT(r1 != NULL); |
| Line 3842 xfs_bmap_trace_insert( | Line 3827 xfs_bmap_trace_insert( |
| xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ | xfs_bmbt_irec_t *r2, /* inserted record 2 or null */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| { | { |
| xfs_bmbt_rec_t tr1; /* compressed record 1 */ | xfs_bmbt_rec_host_t tr1; /* compressed record 1 */ |
| xfs_bmbt_rec_t tr2; /* compressed record 2 if needed */ | xfs_bmbt_rec_host_t tr2; /* compressed record 2 if needed */ |
| xfs_bmbt_set_all(&tr1, r1); | xfs_bmbt_set_all(&tr1, r1); |
| if (cnt == 2) { | if (cnt == 2) { |
| Line 4316 xfs_bmap_first_unused( | Line 4301 xfs_bmap_first_unused( |
| xfs_fileoff_t *first_unused, /* unused block */ | xfs_fileoff_t *first_unused, /* unused block */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* pointer to an extent entry */ | |
| int error; /* error return value */ | int error; /* error return value */ |
| int idx; /* extent record index */ | int idx; /* extent record index */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| Line 4340 xfs_bmap_first_unused( | Line 4324 xfs_bmap_first_unused( |
| lowest = *first_unused; | lowest = *first_unused; |
| nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); | nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); |
| for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) { | for (idx = 0, lastaddr = 0, max = lowest; idx < nextents; idx++) { |
| ep = xfs_iext_get_ext(ifp, idx); | xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, idx); |
| off = xfs_bmbt_get_startoff(ep); | off = xfs_bmbt_get_startoff(ep); |
| /* | /* |
| * See if the hole before this extent will work. | * See if the hole before this extent will work. |
| Line 4371 xfs_bmap_last_before( | Line 4355 xfs_bmap_last_before( |
| { | { |
| xfs_fileoff_t bno; /* input file offset */ | xfs_fileoff_t bno; /* input file offset */ |
| int eof; /* hit end of file */ | int eof; /* hit end of file */ |
| xfs_bmbt_rec_t *ep; /* pointer to last extent */ | xfs_bmbt_rec_host_t *ep; /* pointer to last extent */ |
| int error; /* error return value */ | int error; /* error return value */ |
| xfs_bmbt_irec_t got; /* current extent value */ | xfs_bmbt_irec_t got; /* current extent value */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| Line 4417 xfs_bmap_last_offset( | Line 4401 xfs_bmap_last_offset( |
| xfs_fileoff_t *last_block, /* last block */ | xfs_fileoff_t *last_block, /* last block */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* pointer to last extent */ | xfs_bmbt_rec_host_t *ep; /* pointer to last extent */ |
| int error; /* error return value */ | int error; /* error return value */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_extnum_t nextents; /* number of extent entries */ | xfs_extnum_t nextents; /* number of extent entries */ |
| Line 4454 xfs_bmap_one_block( | Line 4438 xfs_bmap_one_block( |
| xfs_inode_t *ip, /* incore inode */ | xfs_inode_t *ip, /* incore inode */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* ptr to fork's extent */ | xfs_bmbt_rec_host_t *ep; /* ptr to fork's extent */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| int rval; /* return value */ | int rval; /* return value */ |
| xfs_bmbt_irec_t s; /* internal version of extent */ | xfs_bmbt_irec_t s; /* internal version of extent */ |
| Line 4549 xfs_bmap_read_extents( | Line 4533 xfs_bmap_read_extents( |
| * Loop over all leaf nodes. Copy information to the extent records. | * Loop over all leaf nodes. Copy information to the extent records. |
| */ | */ |
| for (;;) { | for (;;) { |
| xfs_bmbt_rec_t *frp, *trp; | xfs_bmbt_rec_t *frp; |
| xfs_fsblock_t nextbno; | xfs_fsblock_t nextbno; |
| xfs_extnum_t num_recs; | xfs_extnum_t num_recs; |
| xfs_extnum_t start; | xfs_extnum_t start; |
| Line 4581 xfs_bmap_read_extents( | Line 4565 xfs_bmap_read_extents( |
| frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1); | frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, 1); |
| start = i; | start = i; |
| for (j = 0; j < num_recs; j++, i++, frp++) { | for (j = 0; j < num_recs; j++, i++, frp++) { |
| trp = xfs_iext_get_ext(ifp, i); | xfs_bmbt_rec_host_t *trp = xfs_iext_get_ext(ifp, i); |
| trp->l0 = INT_GET(frp->l0, ARCH_CONVERT); | trp->l0 = INT_GET(frp->l0, ARCH_CONVERT); |
| trp->l1 = INT_GET(frp->l1, ARCH_CONVERT); | trp->l1 = INT_GET(frp->l1, ARCH_CONVERT); |
| } | } |
| Line 4631 xfs_bmap_trace_exlist( | Line 4615 xfs_bmap_trace_exlist( |
| xfs_extnum_t cnt, /* count of entries in the list */ | xfs_extnum_t cnt, /* count of entries in the list */ |
| int whichfork) /* data or attr fork */ | int whichfork) /* data or attr fork */ |
| { | { |
| xfs_bmbt_rec_t *ep; /* current extent record */ | xfs_bmbt_rec_host_t *ep; /* current extent record */ |
| xfs_extnum_t idx; /* extent record index */ | xfs_extnum_t idx; /* extent record index */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_bmbt_irec_t s; /* file extent record */ | xfs_bmbt_irec_t s; /* file extent record */ |
| Line 4727 xfs_bmapi( | Line 4711 xfs_bmapi( |
| xfs_btree_cur_t *cur; /* bmap btree cursor */ | xfs_btree_cur_t *cur; /* bmap btree cursor */ |
| xfs_fileoff_t end; /* end of mapped file region */ | xfs_fileoff_t end; /* end of mapped file region */ |
| int eof; /* we've hit the end of extents */ | int eof; /* we've hit the end of extents */ |
| xfs_bmbt_rec_t *ep; /* extent record pointer */ | xfs_bmbt_rec_host_t *ep; /* extent record pointer */ |
| int error; /* error return */ | int error; /* error return */ |
| xfs_bmbt_irec_t got; /* current file extent record */ | xfs_bmbt_irec_t got; /* current file extent record */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| Line 5378 xfs_bunmapi( | Line 5362 xfs_bunmapi( |
| xfs_btree_cur_t *cur; /* bmap btree cursor */ | xfs_btree_cur_t *cur; /* bmap btree cursor */ |
| xfs_bmbt_irec_t del; /* extent being deleted */ | xfs_bmbt_irec_t del; /* extent being deleted */ |
| int eof; /* is deleting at eof */ | int eof; /* is deleting at eof */ |
| xfs_bmbt_rec_t *ep; /* extent record pointer */ | xfs_bmbt_rec_host_t *ep; /* extent record pointer */ |
| int error; /* error return value */ | int error; /* error return value */ |
| xfs_extnum_t extno; /* extent number in list */ | xfs_extnum_t extno; /* extent number in list */ |
| xfs_bmbt_irec_t got; /* current extent record */ | xfs_bmbt_irec_t got; /* current extent record */ |
| Line 6004 xfs_bmap_isaeof( | Line 5988 xfs_bmap_isaeof( |
| { | { |
| int error; /* error return value */ | int error; /* error return value */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_bmbt_rec_t *lastrec; /* extent record pointer */ | xfs_bmbt_rec_host_t *lastrec; /* extent record pointer */ |
| xfs_extnum_t nextents; /* number of file extents */ | xfs_extnum_t nextents; /* number of file extents */ |
| xfs_bmbt_irec_t s; /* expanded extent record */ | xfs_bmbt_irec_t s; /* expanded extent record */ |
| Line 6048 xfs_bmap_eof( | Line 6032 xfs_bmap_eof( |
| xfs_fsblock_t blockcount; /* extent block count */ | xfs_fsblock_t blockcount; /* extent block count */ |
| int error; /* error return value */ | int error; /* error return value */ |
| xfs_ifork_t *ifp; /* inode fork pointer */ | xfs_ifork_t *ifp; /* inode fork pointer */ |
| xfs_bmbt_rec_t *lastrec; /* extent record pointer */ | xfs_bmbt_rec_host_t *lastrec; /* extent record pointer */ |
| xfs_extnum_t nextents; /* number of file extents */ | xfs_extnum_t nextents; /* number of file extents */ |
| xfs_fileoff_t startoff; /* extent starting file offset */ | xfs_fileoff_t startoff; /* extent starting file offset */ |
| Line 6495 xfs_bmap_count_leaves( | Line 6479 xfs_bmap_count_leaves( |
| int *count) | int *count) |
| { | { |
| int b; | int b; |
| xfs_bmbt_rec_t *frp; | |
| for (b = 0; b < numrecs; b++) { | for (b = 0; b < numrecs; b++) { |
| frp = xfs_iext_get_ext(ifp, idx + b); | xfs_bmbt_rec_host_t *frp = xfs_iext_get_ext(ifp, idx + b); |
| *count += xfs_bmbt_get_blockcount(frp); | *count += xfs_bmbt_get_blockcount(frp); |
| } | } |
| return 0; | return 0; |