diff options
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.c')
-rw-r--r-- | fs/xfs/xfs_bmap_btree.c | 86 |
1 files changed, 5 insertions, 81 deletions
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c index a7b835bf870a..0bf192fea3eb 100644 --- a/fs/xfs/xfs_bmap_btree.c +++ b/fs/xfs/xfs_bmap_btree.c | |||
@@ -678,47 +678,6 @@ error0: | |||
678 | return error; | 678 | return error; |
679 | } | 679 | } |
680 | 680 | ||
681 | #ifdef DEBUG | ||
682 | /* | ||
683 | * Get the data from the pointed-to record. | ||
684 | */ | ||
685 | int | ||
686 | xfs_bmbt_get_rec( | ||
687 | xfs_btree_cur_t *cur, | ||
688 | xfs_fileoff_t *off, | ||
689 | xfs_fsblock_t *bno, | ||
690 | xfs_filblks_t *len, | ||
691 | xfs_exntst_t *state, | ||
692 | int *stat) | ||
693 | { | ||
694 | xfs_bmbt_block_t *block; | ||
695 | xfs_buf_t *bp; | ||
696 | #ifdef DEBUG | ||
697 | int error; | ||
698 | #endif | ||
699 | int ptr; | ||
700 | xfs_bmbt_rec_t *rp; | ||
701 | |||
702 | block = xfs_bmbt_get_block(cur, 0, &bp); | ||
703 | ptr = cur->bc_ptrs[0]; | ||
704 | #ifdef DEBUG | ||
705 | if ((error = xfs_btree_check_lblock(cur, block, 0, bp))) | ||
706 | return error; | ||
707 | #endif | ||
708 | if (ptr > be16_to_cpu(block->bb_numrecs) || ptr <= 0) { | ||
709 | *stat = 0; | ||
710 | return 0; | ||
711 | } | ||
712 | rp = XFS_BMAP_REC_IADDR(block, ptr, cur); | ||
713 | *off = xfs_bmbt_disk_get_startoff(rp); | ||
714 | *bno = xfs_bmbt_disk_get_startblock(rp); | ||
715 | *len = xfs_bmbt_disk_get_blockcount(rp); | ||
716 | *state = xfs_bmbt_disk_get_state(rp); | ||
717 | *stat = 1; | ||
718 | return 0; | ||
719 | } | ||
720 | #endif | ||
721 | |||
722 | /* | 681 | /* |
723 | * Insert one record/level. Return information to the caller | 682 | * Insert one record/level. Return information to the caller |
724 | * allowing the next level up to proceed if necessary. | 683 | * allowing the next level up to proceed if necessary. |
@@ -1731,9 +1690,9 @@ xfs_bmdr_to_bmbt( | |||
1731 | rblock->bb_leftsib = cpu_to_be64(NULLDFSBNO); | 1690 | rblock->bb_leftsib = cpu_to_be64(NULLDFSBNO); |
1732 | rblock->bb_rightsib = cpu_to_be64(NULLDFSBNO); | 1691 | rblock->bb_rightsib = cpu_to_be64(NULLDFSBNO); |
1733 | dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); | 1692 | dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); |
1734 | fkp = XFS_BTREE_KEY_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); | 1693 | fkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1); |
1735 | tkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); | 1694 | tkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); |
1736 | fpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); | 1695 | fpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr); |
1737 | tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); | 1696 | tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); |
1738 | dmxr = be16_to_cpu(dblock->bb_numrecs); | 1697 | dmxr = be16_to_cpu(dblock->bb_numrecs); |
1739 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); | 1698 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); |
@@ -1862,7 +1821,7 @@ xfs_bmbt_delete( | |||
1862 | * xfs_bmbt_get_startblock, xfs_bmbt_get_blockcount and xfs_bmbt_get_state. | 1821 | * xfs_bmbt_get_startblock, xfs_bmbt_get_blockcount and xfs_bmbt_get_state. |
1863 | */ | 1822 | */ |
1864 | 1823 | ||
1865 | STATIC __inline__ void | 1824 | STATIC_INLINE void |
1866 | __xfs_bmbt_get_all( | 1825 | __xfs_bmbt_get_all( |
1867 | __uint64_t l0, | 1826 | __uint64_t l0, |
1868 | __uint64_t l1, | 1827 | __uint64_t l1, |
@@ -2016,30 +1975,6 @@ xfs_bmbt_disk_get_blockcount( | |||
2016 | } | 1975 | } |
2017 | 1976 | ||
2018 | /* | 1977 | /* |
2019 | * Extract the startblock field from an on disk bmap extent record. | ||
2020 | */ | ||
2021 | xfs_fsblock_t | ||
2022 | xfs_bmbt_disk_get_startblock( | ||
2023 | xfs_bmbt_rec_t *r) | ||
2024 | { | ||
2025 | #if XFS_BIG_BLKNOS | ||
2026 | return (((xfs_fsblock_t)INT_GET(r->l0, ARCH_CONVERT) & XFS_MASK64LO(9)) << 43) | | ||
2027 | (((xfs_fsblock_t)INT_GET(r->l1, ARCH_CONVERT)) >> 21); | ||
2028 | #else | ||
2029 | #ifdef DEBUG | ||
2030 | xfs_dfsbno_t b; | ||
2031 | |||
2032 | b = (((xfs_dfsbno_t)INT_GET(r->l0, ARCH_CONVERT) & XFS_MASK64LO(9)) << 43) | | ||
2033 | (((xfs_dfsbno_t)INT_GET(r->l1, ARCH_CONVERT)) >> 21); | ||
2034 | ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); | ||
2035 | return (xfs_fsblock_t)b; | ||
2036 | #else /* !DEBUG */ | ||
2037 | return (xfs_fsblock_t)(((xfs_dfsbno_t)INT_GET(r->l1, ARCH_CONVERT)) >> 21); | ||
2038 | #endif /* DEBUG */ | ||
2039 | #endif /* XFS_BIG_BLKNOS */ | ||
2040 | } | ||
2041 | |||
2042 | /* | ||
2043 | * Extract the startoff field from a disk format bmap extent record. | 1978 | * Extract the startoff field from a disk format bmap extent record. |
2044 | */ | 1979 | */ |
2045 | xfs_fileoff_t | 1980 | xfs_fileoff_t |
@@ -2049,17 +1984,6 @@ xfs_bmbt_disk_get_startoff( | |||
2049 | return ((xfs_fileoff_t)INT_GET(r->l0, ARCH_CONVERT) & | 1984 | return ((xfs_fileoff_t)INT_GET(r->l0, ARCH_CONVERT) & |
2050 | XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; | 1985 | XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; |
2051 | } | 1986 | } |
2052 | |||
2053 | xfs_exntst_t | ||
2054 | xfs_bmbt_disk_get_state( | ||
2055 | xfs_bmbt_rec_t *r) | ||
2056 | { | ||
2057 | int ext_flag; | ||
2058 | |||
2059 | ext_flag = (int)((INT_GET(r->l0, ARCH_CONVERT)) >> (64 - BMBT_EXNTFLAG_BITLEN)); | ||
2060 | return xfs_extent_state(xfs_bmbt_disk_get_blockcount(r), | ||
2061 | ext_flag); | ||
2062 | } | ||
2063 | #endif /* XFS_NATIVE_HOST */ | 1987 | #endif /* XFS_NATIVE_HOST */ |
2064 | 1988 | ||
2065 | 1989 | ||
@@ -2684,9 +2608,9 @@ xfs_bmbt_to_bmdr( | |||
2684 | dblock->bb_numrecs = rblock->bb_numrecs; | 2608 | dblock->bb_numrecs = rblock->bb_numrecs; |
2685 | dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); | 2609 | dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); |
2686 | fkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); | 2610 | fkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); |
2687 | tkp = XFS_BTREE_KEY_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); | 2611 | tkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1); |
2688 | fpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); | 2612 | fpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); |
2689 | tpp = XFS_BTREE_PTR_ADDR(dblocklen, xfs_bmdr, dblock, 1, dmxr); | 2613 | tpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr); |
2690 | dmxr = be16_to_cpu(dblock->bb_numrecs); | 2614 | dmxr = be16_to_cpu(dblock->bb_numrecs); |
2691 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); | 2615 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); |
2692 | memcpy(tpp, fpp, sizeof(*fpp) * dmxr); | 2616 | memcpy(tpp, fpp, sizeof(*fpp) * dmxr); |