diff options
-rw-r--r-- | fs/xfs/xfs_alloc_btree.c | 16 | ||||
-rw-r--r-- | fs/xfs/xfs_alloc_btree.h | 7 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_btree.c | 74 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_btree.h | 48 | ||||
-rw-r--r-- | fs/xfs/xfs_btree.h | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_dinode.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc_btree.c | 16 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc_btree.h | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 26 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 34 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 12 |
13 files changed, 158 insertions, 122 deletions
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c index 9e63f8c180d9..6ff27b75b93f 100644 --- a/fs/xfs/xfs_alloc_btree.c +++ b/fs/xfs/xfs_alloc_btree.c | |||
@@ -480,3 +480,19 @@ xfs_allocbt_init_cursor( | |||
480 | 480 | ||
481 | return cur; | 481 | return cur; |
482 | } | 482 | } |
483 | |||
484 | /* | ||
485 | * Calculate number of records in an alloc btree block. | ||
486 | */ | ||
487 | int | ||
488 | xfs_allocbt_maxrecs( | ||
489 | struct xfs_mount *mp, | ||
490 | int blocklen, | ||
491 | int leaf) | ||
492 | { | ||
493 | blocklen -= sizeof(struct xfs_btree_sblock); | ||
494 | |||
495 | if (leaf) | ||
496 | return blocklen / sizeof(xfs_alloc_rec_t); | ||
497 | return blocklen / (sizeof(xfs_alloc_key_t) + sizeof(xfs_alloc_ptr_t)); | ||
498 | } | ||
diff --git a/fs/xfs/xfs_alloc_btree.h b/fs/xfs/xfs_alloc_btree.h index 22f1d709af7b..ff1f71d069c4 100644 --- a/fs/xfs/xfs_alloc_btree.h +++ b/fs/xfs/xfs_alloc_btree.h | |||
@@ -56,12 +56,6 @@ typedef struct xfs_btree_sblock xfs_alloc_block_t; | |||
56 | #define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)XFS_BUF_PTR(bp)) | 56 | #define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)XFS_BUF_PTR(bp)) |
57 | 57 | ||
58 | /* | 58 | /* |
59 | * Real block structures have a size equal to the disk block size. | ||
60 | */ | ||
61 | #define XFS_ALLOC_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_alloc_mxr[lev != 0]) | ||
62 | #define XFS_ALLOC_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_alloc_mnr[lev != 0]) | ||
63 | |||
64 | /* | ||
65 | * Minimum and maximum blocksize and sectorsize. | 59 | * Minimum and maximum blocksize and sectorsize. |
66 | * The blocksize upper limit is pretty much arbitrary. | 60 | * The blocksize upper limit is pretty much arbitrary. |
67 | * The sectorsize upper limit is due to sizeof(sb_sectsize). | 61 | * The sectorsize upper limit is due to sizeof(sb_sectsize). |
@@ -98,5 +92,6 @@ typedef struct xfs_btree_sblock xfs_alloc_block_t; | |||
98 | extern struct xfs_btree_cur *xfs_allocbt_init_cursor(struct xfs_mount *, | 92 | extern struct xfs_btree_cur *xfs_allocbt_init_cursor(struct xfs_mount *, |
99 | struct xfs_trans *, struct xfs_buf *, | 93 | struct xfs_trans *, struct xfs_buf *, |
100 | xfs_agnumber_t, xfs_btnum_t); | 94 | xfs_agnumber_t, xfs_btnum_t); |
95 | extern int xfs_allocbt_maxrecs(struct xfs_mount *, int, int); | ||
101 | 96 | ||
102 | #endif /* __XFS_ALLOC_BTREE_H__ */ | 97 | #endif /* __XFS_ALLOC_BTREE_H__ */ |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index b7f99d7576d0..09e4de4ed507 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -3051,15 +3051,15 @@ xfs_bmap_btree_to_extents( | |||
3051 | __be64 *pp; /* ptr to block address */ | 3051 | __be64 *pp; /* ptr to block address */ |
3052 | xfs_bmbt_block_t *rblock;/* root btree block */ | 3052 | xfs_bmbt_block_t *rblock;/* root btree block */ |
3053 | 3053 | ||
3054 | mp = ip->i_mount; | ||
3054 | ifp = XFS_IFORK_PTR(ip, whichfork); | 3055 | ifp = XFS_IFORK_PTR(ip, whichfork); |
3055 | ASSERT(ifp->if_flags & XFS_IFEXTENTS); | 3056 | ASSERT(ifp->if_flags & XFS_IFEXTENTS); |
3056 | ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE); | 3057 | ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE); |
3057 | rblock = ifp->if_broot; | 3058 | rblock = ifp->if_broot; |
3058 | ASSERT(be16_to_cpu(rblock->bb_level) == 1); | 3059 | ASSERT(be16_to_cpu(rblock->bb_level) == 1); |
3059 | ASSERT(be16_to_cpu(rblock->bb_numrecs) == 1); | 3060 | ASSERT(be16_to_cpu(rblock->bb_numrecs) == 1); |
3060 | ASSERT(XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes) == 1); | 3061 | ASSERT(xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0) == 1); |
3061 | mp = ip->i_mount; | 3062 | pp = XFS_BMAP_BROOT_PTR_ADDR(mp, rblock, 1, ifp->if_broot_bytes); |
3062 | pp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, ifp->if_broot_bytes); | ||
3063 | cbno = be64_to_cpu(*pp); | 3063 | cbno = be64_to_cpu(*pp); |
3064 | *logflagsp = 0; | 3064 | *logflagsp = 0; |
3065 | #ifdef DEBUG | 3065 | #ifdef DEBUG |
@@ -4221,7 +4221,7 @@ xfs_bmap_compute_maxlevels( | |||
4221 | maxleafents = MAXAEXTNUM; | 4221 | maxleafents = MAXAEXTNUM; |
4222 | sz = XFS_BMDR_SPACE_CALC(MINABTPTRS); | 4222 | sz = XFS_BMDR_SPACE_CALC(MINABTPTRS); |
4223 | } | 4223 | } |
4224 | maxrootrecs = (int)XFS_BTREE_BLOCK_MAXRECS(sz, xfs_bmdr, 0); | 4224 | maxrootrecs = xfs_bmdr_maxrecs(mp, sz, 0); |
4225 | minleafrecs = mp->m_bmap_dmnr[0]; | 4225 | minleafrecs = mp->m_bmap_dmnr[0]; |
4226 | minnoderecs = mp->m_bmap_dmnr[1]; | 4226 | minnoderecs = mp->m_bmap_dmnr[1]; |
4227 | maxblocks = (maxleafents + minleafrecs - 1) / minleafrecs; | 4227 | maxblocks = (maxleafents + minleafrecs - 1) / minleafrecs; |
@@ -4555,7 +4555,7 @@ xfs_bmap_read_extents( | |||
4555 | */ | 4555 | */ |
4556 | level = be16_to_cpu(block->bb_level); | 4556 | level = be16_to_cpu(block->bb_level); |
4557 | ASSERT(level > 0); | 4557 | ASSERT(level > 0); |
4558 | pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); | 4558 | pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes); |
4559 | bno = be64_to_cpu(*pp); | 4559 | bno = be64_to_cpu(*pp); |
4560 | ASSERT(bno != NULLDFSBNO); | 4560 | ASSERT(bno != NULLDFSBNO); |
4561 | ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount); | 4561 | ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount); |
@@ -6205,13 +6205,13 @@ xfs_check_block( | |||
6205 | */ | 6205 | */ |
6206 | 6206 | ||
6207 | if (root) { | 6207 | if (root) { |
6208 | pp = XFS_BMAP_BROOT_PTR_ADDR(block, i, sz); | 6208 | pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, i, sz); |
6209 | } else { | 6209 | } else { |
6210 | pp = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, i, dmxr); | 6210 | pp = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, i, dmxr); |
6211 | } | 6211 | } |
6212 | for (j = i+1; j <= be16_to_cpu(block->bb_numrecs); j++) { | 6212 | for (j = i+1; j <= be16_to_cpu(block->bb_numrecs); j++) { |
6213 | if (root) { | 6213 | if (root) { |
6214 | thispa = XFS_BMAP_BROOT_PTR_ADDR(block, j, sz); | 6214 | thispa = XFS_BMAP_BROOT_PTR_ADDR(mp, block, j, sz); |
6215 | } else { | 6215 | } else { |
6216 | thispa = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, j, | 6216 | thispa = XFS_BTREE_PTR_ADDR(xfs_bmbt, block, j, |
6217 | dmxr); | 6217 | dmxr); |
@@ -6266,7 +6266,7 @@ xfs_bmap_check_leaf_extents( | |||
6266 | level = be16_to_cpu(block->bb_level); | 6266 | level = be16_to_cpu(block->bb_level); |
6267 | ASSERT(level > 0); | 6267 | ASSERT(level > 0); |
6268 | xfs_check_block(block, mp, 1, ifp->if_broot_bytes); | 6268 | xfs_check_block(block, mp, 1, ifp->if_broot_bytes); |
6269 | pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); | 6269 | pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes); |
6270 | bno = be64_to_cpu(*pp); | 6270 | bno = be64_to_cpu(*pp); |
6271 | 6271 | ||
6272 | ASSERT(bno != NULLDFSBNO); | 6272 | ASSERT(bno != NULLDFSBNO); |
@@ -6426,7 +6426,7 @@ xfs_bmap_count_blocks( | |||
6426 | block = ifp->if_broot; | 6426 | block = ifp->if_broot; |
6427 | level = be16_to_cpu(block->bb_level); | 6427 | level = be16_to_cpu(block->bb_level); |
6428 | ASSERT(level > 0); | 6428 | ASSERT(level > 0); |
6429 | pp = XFS_BMAP_BROOT_PTR_ADDR(block, 1, ifp->if_broot_bytes); | 6429 | pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes); |
6430 | bno = be64_to_cpu(*pp); | 6430 | bno = be64_to_cpu(*pp); |
6431 | ASSERT(bno != NULLDFSBNO); | 6431 | ASSERT(bno != NULLDFSBNO); |
6432 | ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount); | 6432 | ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount); |
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c index c5eeb3241e25..853828c6b45e 100644 --- a/fs/xfs/xfs_bmap_btree.c +++ b/fs/xfs/xfs_bmap_btree.c | |||
@@ -66,6 +66,7 @@ xfs_extent_state( | |||
66 | */ | 66 | */ |
67 | void | 67 | void |
68 | xfs_bmdr_to_bmbt( | 68 | xfs_bmdr_to_bmbt( |
69 | struct xfs_mount *mp, | ||
69 | xfs_bmdr_block_t *dblock, | 70 | xfs_bmdr_block_t *dblock, |
70 | int dblocklen, | 71 | int dblocklen, |
71 | xfs_bmbt_block_t *rblock, | 72 | xfs_bmbt_block_t *rblock, |
@@ -83,11 +84,11 @@ xfs_bmdr_to_bmbt( | |||
83 | rblock->bb_numrecs = dblock->bb_numrecs; | 84 | rblock->bb_numrecs = dblock->bb_numrecs; |
84 | rblock->bb_leftsib = cpu_to_be64(NULLDFSBNO); | 85 | rblock->bb_leftsib = cpu_to_be64(NULLDFSBNO); |
85 | rblock->bb_rightsib = cpu_to_be64(NULLDFSBNO); | 86 | rblock->bb_rightsib = cpu_to_be64(NULLDFSBNO); |
86 | dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); | 87 | dmxr = xfs_bmdr_maxrecs(mp, dblocklen, 0); |
87 | fkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1); | 88 | fkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1); |
88 | tkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); | 89 | tkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); |
89 | fpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr); | 90 | fpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr); |
90 | tpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); | 91 | tpp = XFS_BMAP_BROOT_PTR_ADDR(mp, rblock, 1, rblocklen); |
91 | dmxr = be16_to_cpu(dblock->bb_numrecs); | 92 | dmxr = be16_to_cpu(dblock->bb_numrecs); |
92 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); | 93 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); |
93 | memcpy(tpp, fpp, sizeof(*fpp) * dmxr); | 94 | memcpy(tpp, fpp, sizeof(*fpp) * dmxr); |
@@ -428,6 +429,7 @@ xfs_bmbt_set_state( | |||
428 | */ | 429 | */ |
429 | void | 430 | void |
430 | xfs_bmbt_to_bmdr( | 431 | xfs_bmbt_to_bmdr( |
432 | struct xfs_mount *mp, | ||
431 | xfs_bmbt_block_t *rblock, | 433 | xfs_bmbt_block_t *rblock, |
432 | int rblocklen, | 434 | int rblocklen, |
433 | xfs_bmdr_block_t *dblock, | 435 | xfs_bmdr_block_t *dblock, |
@@ -445,10 +447,10 @@ xfs_bmbt_to_bmdr( | |||
445 | ASSERT(be16_to_cpu(rblock->bb_level) > 0); | 447 | ASSERT(be16_to_cpu(rblock->bb_level) > 0); |
446 | dblock->bb_level = rblock->bb_level; | 448 | dblock->bb_level = rblock->bb_level; |
447 | dblock->bb_numrecs = rblock->bb_numrecs; | 449 | dblock->bb_numrecs = rblock->bb_numrecs; |
448 | dmxr = (int)XFS_BTREE_BLOCK_MAXRECS(dblocklen, xfs_bmdr, 0); | 450 | dmxr = xfs_bmdr_maxrecs(mp, dblocklen, 0); |
449 | fkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); | 451 | fkp = XFS_BMAP_BROOT_KEY_ADDR(rblock, 1, rblocklen); |
450 | tkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1); | 452 | tkp = XFS_BTREE_KEY_ADDR(xfs_bmdr, dblock, 1); |
451 | fpp = XFS_BMAP_BROOT_PTR_ADDR(rblock, 1, rblocklen); | 453 | fpp = XFS_BMAP_BROOT_PTR_ADDR(mp, rblock, 1, rblocklen); |
452 | tpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr); | 454 | tpp = XFS_BTREE_PTR_ADDR(xfs_bmdr, dblock, 1, dmxr); |
453 | dmxr = be16_to_cpu(dblock->bb_numrecs); | 455 | dmxr = be16_to_cpu(dblock->bb_numrecs); |
454 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); | 456 | memcpy(tkp, fkp, sizeof(*fkp) * dmxr); |
@@ -626,15 +628,36 @@ xfs_bmbt_get_minrecs( | |||
626 | struct xfs_btree_cur *cur, | 628 | struct xfs_btree_cur *cur, |
627 | int level) | 629 | int level) |
628 | { | 630 | { |
629 | return XFS_BMAP_BLOCK_IMINRECS(level, cur); | 631 | if (level == cur->bc_nlevels - 1) { |
632 | struct xfs_ifork *ifp; | ||
633 | |||
634 | ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, | ||
635 | cur->bc_private.b.whichfork); | ||
636 | |||
637 | return xfs_bmbt_maxrecs(cur->bc_mp, | ||
638 | ifp->if_broot_bytes, level == 0) / 2; | ||
639 | } | ||
640 | |||
641 | return cur->bc_mp->m_bmap_dmnr[level != 0]; | ||
630 | } | 642 | } |
631 | 643 | ||
632 | STATIC int | 644 | int |
633 | xfs_bmbt_get_maxrecs( | 645 | xfs_bmbt_get_maxrecs( |
634 | struct xfs_btree_cur *cur, | 646 | struct xfs_btree_cur *cur, |
635 | int level) | 647 | int level) |
636 | { | 648 | { |
637 | return XFS_BMAP_BLOCK_IMAXRECS(level, cur); | 649 | if (level == cur->bc_nlevels - 1) { |
650 | struct xfs_ifork *ifp; | ||
651 | |||
652 | ifp = XFS_IFORK_PTR(cur->bc_private.b.ip, | ||
653 | cur->bc_private.b.whichfork); | ||
654 | |||
655 | return xfs_bmbt_maxrecs(cur->bc_mp, | ||
656 | ifp->if_broot_bytes, level == 0); | ||
657 | } | ||
658 | |||
659 | return cur->bc_mp->m_bmap_dmxr[level != 0]; | ||
660 | |||
638 | } | 661 | } |
639 | 662 | ||
640 | /* | 663 | /* |
@@ -651,7 +674,10 @@ xfs_bmbt_get_dmaxrecs( | |||
651 | struct xfs_btree_cur *cur, | 674 | struct xfs_btree_cur *cur, |
652 | int level) | 675 | int level) |
653 | { | 676 | { |
654 | return XFS_BMAP_BLOCK_DMAXRECS(level, cur); | 677 | if (level != cur->bc_nlevels - 1) |
678 | return cur->bc_mp->m_bmap_dmxr[level != 0]; | ||
679 | return xfs_bmdr_maxrecs(cur->bc_mp, cur->bc_private.b.forksize, | ||
680 | level == 0); | ||
655 | } | 681 | } |
656 | 682 | ||
657 | STATIC void | 683 | STATIC void |
@@ -871,3 +897,35 @@ xfs_bmbt_init_cursor( | |||
871 | 897 | ||
872 | return cur; | 898 | return cur; |
873 | } | 899 | } |
900 | |||
901 | /* | ||
902 | * Calculate number of records in a bmap btree block. | ||
903 | */ | ||
904 | int | ||
905 | xfs_bmbt_maxrecs( | ||
906 | struct xfs_mount *mp, | ||
907 | int blocklen, | ||
908 | int leaf) | ||
909 | { | ||
910 | blocklen -= sizeof(struct xfs_btree_lblock); | ||
911 | |||
912 | if (leaf) | ||
913 | return blocklen / sizeof(xfs_bmbt_rec_t); | ||
914 | return blocklen / (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)); | ||
915 | } | ||
916 | |||
917 | /* | ||
918 | * Calculate number of records in a bmap btree inode root. | ||
919 | */ | ||
920 | int | ||
921 | xfs_bmdr_maxrecs( | ||
922 | struct xfs_mount *mp, | ||
923 | int blocklen, | ||
924 | int leaf) | ||
925 | { | ||
926 | blocklen -= sizeof(xfs_bmdr_block_t); | ||
927 | |||
928 | if (leaf) | ||
929 | return blocklen / sizeof(xfs_bmdr_rec_t); | ||
930 | return blocklen / (sizeof(xfs_bmdr_key_t) + sizeof(xfs_bmdr_ptr_t)); | ||
931 | } | ||
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h index 5669242b52d3..835be2a84ca1 100644 --- a/fs/xfs/xfs_bmap_btree.h +++ b/fs/xfs/xfs_bmap_btree.h | |||
@@ -151,33 +151,6 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t; | |||
151 | 151 | ||
152 | #define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp)) | 152 | #define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp)) |
153 | 153 | ||
154 | #define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize) | ||
155 | #define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \ | ||
156 | ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \ | ||
157 | (cur)->bc_private.b.whichfork)->if_broot_bytes) | ||
158 | |||
159 | #define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \ | ||
160 | (((lev) == (cur)->bc_nlevels - 1 ? \ | ||
161 | XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ | ||
162 | xfs_bmdr, (lev) == 0) : \ | ||
163 | ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0]))) | ||
164 | #define XFS_BMAP_BLOCK_IMAXRECS(lev,cur) \ | ||
165 | (((lev) == (cur)->bc_nlevels - 1 ? \ | ||
166 | XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\ | ||
167 | xfs_bmbt, (lev) == 0) : \ | ||
168 | ((cur)->bc_mp->m_bmap_dmxr[(lev) != 0]))) | ||
169 | |||
170 | #define XFS_BMAP_BLOCK_DMINRECS(lev,cur) \ | ||
171 | (((lev) == (cur)->bc_nlevels - 1 ? \ | ||
172 | XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur),\ | ||
173 | xfs_bmdr, (lev) == 0) : \ | ||
174 | ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0]))) | ||
175 | #define XFS_BMAP_BLOCK_IMINRECS(lev,cur) \ | ||
176 | (((lev) == (cur)->bc_nlevels - 1 ? \ | ||
177 | XFS_BTREE_BLOCK_MINRECS(XFS_BMAP_RBLOCK_ISIZE(lev,cur),\ | ||
178 | xfs_bmbt, (lev) == 0) : \ | ||
179 | ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0]))) | ||
180 | |||
181 | #define XFS_BMAP_REC_DADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i)) | 154 | #define XFS_BMAP_REC_DADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i)) |
182 | 155 | ||
183 | #define XFS_BMAP_REC_IADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i)) | 156 | #define XFS_BMAP_REC_IADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i)) |
@@ -192,8 +165,8 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t; | |||
192 | (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ | 165 | (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \ |
193 | be16_to_cpu((bb)->bb_level), cur))) | 166 | be16_to_cpu((bb)->bb_level), cur))) |
194 | #define XFS_BMAP_PTR_IADDR(bb,i,cur) \ | 167 | #define XFS_BMAP_PTR_IADDR(bb,i,cur) \ |
195 | (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \ | 168 | (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, xfs_bmbt_get_maxrecs(cur, \ |
196 | be16_to_cpu((bb)->bb_level), cur))) | 169 | be16_to_cpu((bb)->bb_level)))) |
197 | 170 | ||
198 | /* | 171 | /* |
199 | * These are to be used when we know the size of the block and | 172 | * These are to be used when we know the size of the block and |
@@ -203,11 +176,8 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t; | |||
203 | (XFS_BTREE_REC_ADDR(xfs_bmbt,bb,i)) | 176 | (XFS_BTREE_REC_ADDR(xfs_bmbt,bb,i)) |
204 | #define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ | 177 | #define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ |
205 | (XFS_BTREE_KEY_ADDR(xfs_bmbt,bb,i)) | 178 | (XFS_BTREE_KEY_ADDR(xfs_bmbt,bb,i)) |
206 | #define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \ | 179 | #define XFS_BMAP_BROOT_PTR_ADDR(mp, bb,i,sz) \ |
207 | (XFS_BTREE_PTR_ADDR(xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) | 180 | (XFS_BTREE_PTR_ADDR(xfs_bmbt,bb,i,xfs_bmbt_maxrecs(mp, sz, 0))) |
208 | |||
209 | #define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs) | ||
210 | #define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0) | ||
211 | 181 | ||
212 | #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ | 182 | #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ |
213 | (int)(sizeof(xfs_bmbt_block_t) + \ | 183 | (int)(sizeof(xfs_bmbt_block_t) + \ |
@@ -234,7 +204,8 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t; | |||
234 | /* | 204 | /* |
235 | * Prototypes for xfs_bmap.c to call. | 205 | * Prototypes for xfs_bmap.c to call. |
236 | */ | 206 | */ |
237 | extern void xfs_bmdr_to_bmbt(xfs_bmdr_block_t *, int, xfs_bmbt_block_t *, int); | 207 | extern void xfs_bmdr_to_bmbt(struct xfs_mount *, xfs_bmdr_block_t *, int, |
208 | xfs_bmbt_block_t *, int); | ||
238 | extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); | 209 | extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); |
239 | extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r); | 210 | extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r); |
240 | extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); | 211 | extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); |
@@ -257,7 +228,12 @@ extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); | |||
257 | extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, | 228 | extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, |
258 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); | 229 | xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); |
259 | 230 | ||
260 | extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int); | 231 | extern void xfs_bmbt_to_bmdr(struct xfs_mount *, xfs_bmbt_block_t *, int, |
232 | xfs_bmdr_block_t *, int); | ||
233 | |||
234 | extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level); | ||
235 | extern int xfs_bmdr_maxrecs(struct xfs_mount *, int blocklen, int leaf); | ||
236 | extern int xfs_bmbt_maxrecs(struct xfs_mount *, int blocklen, int leaf); | ||
261 | 237 | ||
262 | extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *, | 238 | extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *, |
263 | struct xfs_trans *, struct xfs_inode *, int); | 239 | struct xfs_trans *, struct xfs_inode *, int); |
diff --git a/fs/xfs/xfs_btree.h b/fs/xfs/xfs_btree.h index 7425b2b4a254..795a124cee6f 100644 --- a/fs/xfs/xfs_btree.h +++ b/fs/xfs/xfs_btree.h | |||
@@ -148,19 +148,6 @@ do { \ | |||
148 | case XFS_BTNUM_MAX: ASSERT(0); /* fucking gcc */ ; break; \ | 148 | case XFS_BTNUM_MAX: ASSERT(0); /* fucking gcc */ ; break; \ |
149 | } \ | 149 | } \ |
150 | } while (0) | 150 | } while (0) |
151 | /* | ||
152 | * Maximum and minimum records in a btree block. | ||
153 | * Given block size, type prefix, and leaf flag (0 or 1). | ||
154 | * The divisor below is equivalent to lf ? (e1) : (e2) but that produces | ||
155 | * compiler warnings. | ||
156 | */ | ||
157 | #define XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) \ | ||
158 | ((int)(((bsz) - (uint)sizeof(t ## _block_t)) / \ | ||
159 | (((lf) * (uint)sizeof(t ## _rec_t)) + \ | ||
160 | ((1 - (lf)) * \ | ||
161 | ((uint)sizeof(t ## _key_t) + (uint)sizeof(t ## _ptr_t)))))) | ||
162 | #define XFS_BTREE_BLOCK_MINRECS(bsz,t,lf) \ | ||
163 | (XFS_BTREE_BLOCK_MAXRECS(bsz,t,lf) / 2) | ||
164 | 151 | ||
165 | /* | 152 | /* |
166 | * Record, key, and pointer address calculation macros. | 153 | * Record, key, and pointer address calculation macros. |
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index c9065eaf2a4d..2a00fcc36d8e 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h | |||
@@ -78,8 +78,7 @@ typedef struct xfs_dinode | |||
78 | xfs_dinode_core_t di_core; | 78 | xfs_dinode_core_t di_core; |
79 | /* | 79 | /* |
80 | * In adding anything between the core and the union, be | 80 | * In adding anything between the core and the union, be |
81 | * sure to update the macros like XFS_LITINO below and | 81 | * sure to update the macros like XFS_LITINO below. |
82 | * XFS_BMAP_RBLOCK_DSIZE in xfs_bmap_btree.h. | ||
83 | */ | 82 | */ |
84 | __be32 di_next_unlinked;/* agi unlinked list ptr */ | 83 | __be32 di_next_unlinked;/* agi unlinked list ptr */ |
85 | union { | 84 | union { |
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c index dcd4a956e73c..46aabb3fcbf3 100644 --- a/fs/xfs/xfs_ialloc_btree.c +++ b/fs/xfs/xfs_ialloc_btree.c | |||
@@ -365,3 +365,19 @@ xfs_inobt_init_cursor( | |||
365 | 365 | ||
366 | return cur; | 366 | return cur; |
367 | } | 367 | } |
368 | |||
369 | /* | ||
370 | * Calculate number of records in an inobt btree block. | ||
371 | */ | ||
372 | int | ||
373 | xfs_inobt_maxrecs( | ||
374 | struct xfs_mount *mp, | ||
375 | int blocklen, | ||
376 | int leaf) | ||
377 | { | ||
378 | blocklen -= sizeof(struct xfs_btree_sblock); | ||
379 | |||
380 | if (leaf) | ||
381 | return blocklen / sizeof(xfs_inobt_rec_t); | ||
382 | return blocklen / (sizeof(xfs_inobt_key_t) + sizeof(xfs_inobt_ptr_t)); | ||
383 | } | ||
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h index ff7406b4bac3..f0fc1e46e62b 100644 --- a/fs/xfs/xfs_ialloc_btree.h +++ b/fs/xfs/xfs_ialloc_btree.h | |||
@@ -85,14 +85,6 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t; | |||
85 | #define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) | 85 | #define XFS_INOBT_CLR_FREE(rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Real block structures have a size equal to the disk block size. | ||
89 | */ | ||
90 | #define XFS_INOBT_BLOCK_MAXRECS(lev,cur) ((cur)->bc_mp->m_inobt_mxr[lev != 0]) | ||
91 | #define XFS_INOBT_BLOCK_MINRECS(lev,cur) ((cur)->bc_mp->m_inobt_mnr[lev != 0]) | ||
92 | #define XFS_INOBT_IS_LAST_REC(cur) \ | ||
93 | ((cur)->bc_ptrs[0] == be16_to_cpu(XFS_BUF_TO_INOBT_BLOCK((cur)->bc_bufs[0])->bb_numrecs)) | ||
94 | |||
95 | /* | ||
96 | * Maximum number of inode btree levels. | 88 | * Maximum number of inode btree levels. |
97 | */ | 89 | */ |
98 | #define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels) | 90 | #define XFS_IN_MAXLEVELS(mp) ((mp)->m_in_maxlevels) |
@@ -118,5 +110,6 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t; | |||
118 | 110 | ||
119 | extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *, | 111 | extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *, |
120 | struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t); | 112 | struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t); |
113 | extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int); | ||
121 | 114 | ||
122 | #endif /* __XFS_IALLOC_BTREE_H__ */ | 115 | #endif /* __XFS_IALLOC_BTREE_H__ */ |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 0c65ba2faa43..73b604e15dcd 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -622,7 +622,7 @@ xfs_iformat_btree( | |||
622 | ifp = XFS_IFORK_PTR(ip, whichfork); | 622 | ifp = XFS_IFORK_PTR(ip, whichfork); |
623 | dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); | 623 | dfp = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork); |
624 | size = XFS_BMAP_BROOT_SPACE(dfp); | 624 | size = XFS_BMAP_BROOT_SPACE(dfp); |
625 | nrecs = XFS_BMAP_BROOT_NUMRECS(dfp); | 625 | nrecs = be16_to_cpu(dfp->bb_numrecs); |
626 | 626 | ||
627 | /* | 627 | /* |
628 | * blow out if -- fork has less extents than can fit in | 628 | * blow out if -- fork has less extents than can fit in |
@@ -650,8 +650,9 @@ xfs_iformat_btree( | |||
650 | * Copy and convert from the on-disk structure | 650 | * Copy and convert from the on-disk structure |
651 | * to the in-memory structure. | 651 | * to the in-memory structure. |
652 | */ | 652 | */ |
653 | xfs_bmdr_to_bmbt(dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), | 653 | xfs_bmdr_to_bmbt(ip->i_mount, dfp, |
654 | ifp->if_broot, size); | 654 | XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), |
655 | ifp->if_broot, size); | ||
655 | ifp->if_flags &= ~XFS_IFEXTENTS; | 656 | ifp->if_flags &= ~XFS_IFEXTENTS; |
656 | ifp->if_flags |= XFS_IFBROOT; | 657 | ifp->if_flags |= XFS_IFBROOT; |
657 | 658 | ||
@@ -2348,6 +2349,7 @@ xfs_iroot_realloc( | |||
2348 | int rec_diff, | 2349 | int rec_diff, |
2349 | int whichfork) | 2350 | int whichfork) |
2350 | { | 2351 | { |
2352 | struct xfs_mount *mp = ip->i_mount; | ||
2351 | int cur_max; | 2353 | int cur_max; |
2352 | xfs_ifork_t *ifp; | 2354 | xfs_ifork_t *ifp; |
2353 | xfs_bmbt_block_t *new_broot; | 2355 | xfs_bmbt_block_t *new_broot; |
@@ -2383,7 +2385,7 @@ xfs_iroot_realloc( | |||
2383 | * location. The records don't change location because | 2385 | * location. The records don't change location because |
2384 | * they are kept butted up against the btree block header. | 2386 | * they are kept butted up against the btree block header. |
2385 | */ | 2387 | */ |
2386 | cur_max = XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes); | 2388 | cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0); |
2387 | new_max = cur_max + rec_diff; | 2389 | new_max = cur_max + rec_diff; |
2388 | new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max); | 2390 | new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max); |
2389 | ifp->if_broot = (xfs_bmbt_block_t *) | 2391 | ifp->if_broot = (xfs_bmbt_block_t *) |
@@ -2391,10 +2393,10 @@ xfs_iroot_realloc( | |||
2391 | new_size, | 2393 | new_size, |
2392 | (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */ | 2394 | (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */ |
2393 | KM_SLEEP); | 2395 | KM_SLEEP); |
2394 | op = (char *)XFS_BMAP_BROOT_PTR_ADDR(ifp->if_broot, 1, | 2396 | op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, |
2395 | ifp->if_broot_bytes); | 2397 | ifp->if_broot_bytes); |
2396 | np = (char *)XFS_BMAP_BROOT_PTR_ADDR(ifp->if_broot, 1, | 2398 | np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, |
2397 | (int)new_size); | 2399 | (int)new_size); |
2398 | ifp->if_broot_bytes = (int)new_size; | 2400 | ifp->if_broot_bytes = (int)new_size; |
2399 | ASSERT(ifp->if_broot_bytes <= | 2401 | ASSERT(ifp->if_broot_bytes <= |
2400 | XFS_IFORK_SIZE(ip, whichfork) + XFS_BROOT_SIZE_ADJ); | 2402 | XFS_IFORK_SIZE(ip, whichfork) + XFS_BROOT_SIZE_ADJ); |
@@ -2408,7 +2410,7 @@ xfs_iroot_realloc( | |||
2408 | * records, just get rid of the root and clear the status bit. | 2410 | * records, just get rid of the root and clear the status bit. |
2409 | */ | 2411 | */ |
2410 | ASSERT((ifp->if_broot != NULL) && (ifp->if_broot_bytes > 0)); | 2412 | ASSERT((ifp->if_broot != NULL) && (ifp->if_broot_bytes > 0)); |
2411 | cur_max = XFS_BMAP_BROOT_MAXRECS(ifp->if_broot_bytes); | 2413 | cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0); |
2412 | new_max = cur_max + rec_diff; | 2414 | new_max = cur_max + rec_diff; |
2413 | ASSERT(new_max >= 0); | 2415 | ASSERT(new_max >= 0); |
2414 | if (new_max > 0) | 2416 | if (new_max > 0) |
@@ -2442,9 +2444,9 @@ xfs_iroot_realloc( | |||
2442 | /* | 2444 | /* |
2443 | * Then copy the pointers. | 2445 | * Then copy the pointers. |
2444 | */ | 2446 | */ |
2445 | op = (char *)XFS_BMAP_BROOT_PTR_ADDR(ifp->if_broot, 1, | 2447 | op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, |
2446 | ifp->if_broot_bytes); | 2448 | ifp->if_broot_bytes); |
2447 | np = (char *)XFS_BMAP_BROOT_PTR_ADDR(new_broot, 1, | 2449 | np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, new_broot, 1, |
2448 | (int)new_size); | 2450 | (int)new_size); |
2449 | memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t)); | 2451 | memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t)); |
2450 | } | 2452 | } |
@@ -2920,7 +2922,7 @@ xfs_iflush_fork( | |||
2920 | ASSERT(ifp->if_broot_bytes <= | 2922 | ASSERT(ifp->if_broot_bytes <= |
2921 | (XFS_IFORK_SIZE(ip, whichfork) + | 2923 | (XFS_IFORK_SIZE(ip, whichfork) + |
2922 | XFS_BROOT_SIZE_ADJ)); | 2924 | XFS_BROOT_SIZE_ADJ)); |
2923 | xfs_bmbt_to_bmdr(ifp->if_broot, ifp->if_broot_bytes, | 2925 | xfs_bmbt_to_bmdr(mp, ifp->if_broot, ifp->if_broot_bytes, |
2924 | (xfs_bmdr_block_t *)cp, | 2926 | (xfs_bmdr_block_t *)cp, |
2925 | XFS_DFORK_SIZE(dip, mp, whichfork)); | 2927 | XFS_DFORK_SIZE(dip, mp, whichfork)); |
2926 | } | 2928 | } |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 82d46ce69d5f..23c3a782a9e7 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -2452,7 +2452,7 @@ xlog_recover_do_inode_trans( | |||
2452 | break; | 2452 | break; |
2453 | 2453 | ||
2454 | case XFS_ILOG_DBROOT: | 2454 | case XFS_ILOG_DBROOT: |
2455 | xfs_bmbt_to_bmdr((xfs_bmbt_block_t *)src, len, | 2455 | xfs_bmbt_to_bmdr(mp, (xfs_bmbt_block_t *)src, len, |
2456 | &(dip->di_u.di_bmbt), | 2456 | &(dip->di_u.di_bmbt), |
2457 | XFS_DFORK_DSIZE(dip, mp)); | 2457 | XFS_DFORK_DSIZE(dip, mp)); |
2458 | break; | 2458 | break; |
@@ -2490,7 +2490,7 @@ xlog_recover_do_inode_trans( | |||
2490 | 2490 | ||
2491 | case XFS_ILOG_ABROOT: | 2491 | case XFS_ILOG_ABROOT: |
2492 | dest = XFS_DFORK_APTR(dip); | 2492 | dest = XFS_DFORK_APTR(dip); |
2493 | xfs_bmbt_to_bmdr((xfs_bmbt_block_t *)src, len, | 2493 | xfs_bmbt_to_bmdr(mp, (xfs_bmbt_block_t *)src, len, |
2494 | (xfs_bmdr_block_t*)dest, | 2494 | (xfs_bmdr_block_t*)dest, |
2495 | XFS_DFORK_ASIZE(dip, mp)); | 2495 | XFS_DFORK_ASIZE(dip, mp)); |
2496 | break; | 2496 | break; |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 5ec6032d230f..40338ff8fddd 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -567,8 +567,6 @@ xfs_readsb(xfs_mount_t *mp, int flags) | |||
567 | STATIC void | 567 | STATIC void |
568 | xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) | 568 | xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) |
569 | { | 569 | { |
570 | int i; | ||
571 | |||
572 | mp->m_agfrotor = mp->m_agirotor = 0; | 570 | mp->m_agfrotor = mp->m_agirotor = 0; |
573 | spin_lock_init(&mp->m_agirotor_lock); | 571 | spin_lock_init(&mp->m_agirotor_lock); |
574 | mp->m_maxagi = mp->m_sb.sb_agcount; | 572 | mp->m_maxagi = mp->m_sb.sb_agcount; |
@@ -605,24 +603,20 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) | |||
605 | } | 603 | } |
606 | ASSERT(mp->m_attroffset < XFS_LITINO(mp)); | 604 | ASSERT(mp->m_attroffset < XFS_LITINO(mp)); |
607 | 605 | ||
608 | for (i = 0; i < 2; i++) { | 606 | mp->m_alloc_mxr[0] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, 1); |
609 | mp->m_alloc_mxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize, | 607 | mp->m_alloc_mxr[1] = xfs_allocbt_maxrecs(mp, sbp->sb_blocksize, 0); |
610 | xfs_alloc, i == 0); | 608 | mp->m_alloc_mnr[0] = mp->m_alloc_mxr[0] / 2; |
611 | mp->m_alloc_mnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize, | 609 | mp->m_alloc_mnr[1] = mp->m_alloc_mxr[1] / 2; |
612 | xfs_alloc, i == 0); | 610 | |
613 | } | 611 | mp->m_inobt_mxr[0] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 1); |
614 | for (i = 0; i < 2; i++) { | 612 | mp->m_inobt_mxr[1] = xfs_inobt_maxrecs(mp, sbp->sb_blocksize, 0); |
615 | mp->m_bmap_dmxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize, | 613 | mp->m_inobt_mnr[0] = mp->m_inobt_mxr[0] / 2; |
616 | xfs_bmbt, i == 0); | 614 | mp->m_inobt_mnr[1] = mp->m_inobt_mxr[1] / 2; |
617 | mp->m_bmap_dmnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize, | 615 | |
618 | xfs_bmbt, i == 0); | 616 | mp->m_bmap_dmxr[0] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, 1); |
619 | } | 617 | mp->m_bmap_dmxr[1] = xfs_bmbt_maxrecs(mp, sbp->sb_blocksize, 0); |
620 | for (i = 0; i < 2; i++) { | 618 | mp->m_bmap_dmnr[0] = mp->m_bmap_dmxr[0] / 2; |
621 | mp->m_inobt_mxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize, | 619 | mp->m_bmap_dmnr[1] = mp->m_bmap_dmxr[1] / 2; |
622 | xfs_inobt, i == 0); | ||
623 | mp->m_inobt_mnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize, | ||
624 | xfs_inobt, i == 0); | ||
625 | } | ||
626 | 620 | ||
627 | mp->m_bsize = XFS_FSB_TO_BB(mp, 1); | 621 | mp->m_bsize = XFS_FSB_TO_BB(mp, 1); |
628 | mp->m_ialloc_inos = (int)MAX((__uint16_t)XFS_INODES_PER_CHUNK, | 622 | mp->m_ialloc_inos = (int)MAX((__uint16_t)XFS_INODES_PER_CHUNK, |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index c6846810936a..f4644d715484 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -276,12 +276,12 @@ typedef struct xfs_mount { | |||
276 | uint m_blockmask; /* sb_blocksize-1 */ | 276 | uint m_blockmask; /* sb_blocksize-1 */ |
277 | uint m_blockwsize; /* sb_blocksize in words */ | 277 | uint m_blockwsize; /* sb_blocksize in words */ |
278 | uint m_blockwmask; /* blockwsize-1 */ | 278 | uint m_blockwmask; /* blockwsize-1 */ |
279 | uint m_alloc_mxr[2]; /* XFS_ALLOC_BLOCK_MAXRECS */ | 279 | uint m_alloc_mxr[2]; /* max alloc btree records */ |
280 | uint m_alloc_mnr[2]; /* XFS_ALLOC_BLOCK_MINRECS */ | 280 | uint m_alloc_mnr[2]; /* min alloc btree records */ |
281 | uint m_bmap_dmxr[2]; /* XFS_BMAP_BLOCK_DMAXRECS */ | 281 | uint m_bmap_dmxr[2]; /* max bmap btree records */ |
282 | uint m_bmap_dmnr[2]; /* XFS_BMAP_BLOCK_DMINRECS */ | 282 | uint m_bmap_dmnr[2]; /* min bmap btree records */ |
283 | uint m_inobt_mxr[2]; /* XFS_INOBT_BLOCK_MAXRECS */ | 283 | uint m_inobt_mxr[2]; /* max inobt btree records */ |
284 | uint m_inobt_mnr[2]; /* XFS_INOBT_BLOCK_MINRECS */ | 284 | uint m_inobt_mnr[2]; /* min inobt btree records */ |
285 | uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ | 285 | uint m_ag_maxlevels; /* XFS_AG_MAXLEVELS */ |
286 | uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ | 286 | uint m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */ |
287 | uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ | 287 | uint m_in_maxlevels; /* XFS_IN_MAXLEVELS */ |