aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rtalloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 22:12:12 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 22:12:12 -0500
commit0b61a2ba5dfd1620731e717d686e6ade657fd975 (patch)
treedea84efd43934a7d6139048f87c4ba86d68d4b6d /fs/xfs/xfs_rtalloc.c
parenta13ff0bb3feda8b1fcffc69951320277ed7c4101 (diff)
parentde2eeea609b55e8c3994133a565b39edeaaaaf69 (diff)
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
* 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6: (62 commits) [XFS] add __init/__exit mark to specific init/cleanup functions [XFS] Fix oops in xfs_file_readdir() [XFS] kill xfs_root [XFS] keep i_nlink updated and use proper accessors [XFS] stop updating inode->i_blocks [XFS] Make xfs_ail_check check less by default [XFS] Move AIL pushing into it's own thread [XFS] use generic_permission [XFS] stop re-checking permissions in xfs_swapext [XFS] clean up xfs_swapext [XFS] remove permission check from xfs_change_file_space [XFS] prevent panic during log recovery due to bogus op_hdr length [XFS] Cleanup various fid related bits: [XFS] Fix xfs_lowbit64 [XFS] Remove CFORK macros and use code directly in IFORK and DFORK macros. [XFS] kill superflous buffer locking (2nd attempt) [XFS] Use kernel-supplied "roundup_pow_of_two" for simplicity [XFS] Remove the BPCSHIFT and NB* based macros from XFS. [XFS] Remove bogus assert [XFS] optimize XFS_IS_REALTIME_INODE w/o realtime config ...
Diffstat (limited to 'fs/xfs/xfs_rtalloc.c')
-rw-r--r--fs/xfs/xfs_rtalloc.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 47082c01872d..ca83ddf72af4 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -73,18 +73,6 @@ STATIC int xfs_rtmodify_summary(xfs_mount_t *, xfs_trans_t *, int,
73 */ 73 */
74 74
75/* 75/*
76 * xfs_lowbit32: get low bit set out of 32-bit argument, -1 if none set.
77 */
78STATIC int
79xfs_lowbit32(
80 __uint32_t v)
81{
82 if (v)
83 return ffs(v) - 1;
84 return -1;
85}
86
87/*
88 * Allocate space to the bitmap or summary file, and zero it, for growfs. 76 * Allocate space to the bitmap or summary file, and zero it, for growfs.
89 */ 77 */
90STATIC int /* error */ 78STATIC int /* error */
@@ -444,6 +432,7 @@ xfs_rtallocate_extent_near(
444 } 432 }
445 bbno = XFS_BITTOBLOCK(mp, bno); 433 bbno = XFS_BITTOBLOCK(mp, bno);
446 i = 0; 434 i = 0;
435 ASSERT(minlen != 0);
447 log2len = xfs_highbit32(minlen); 436 log2len = xfs_highbit32(minlen);
448 /* 437 /*
449 * Loop over all bitmap blocks (bbno + i is current block). 438 * Loop over all bitmap blocks (bbno + i is current block).
@@ -612,6 +601,8 @@ xfs_rtallocate_extent_size(
612 xfs_suminfo_t sum; /* summary information for extents */ 601 xfs_suminfo_t sum; /* summary information for extents */
613 602
614 ASSERT(minlen % prod == 0 && maxlen % prod == 0); 603 ASSERT(minlen % prod == 0 && maxlen % prod == 0);
604 ASSERT(maxlen != 0);
605
615 /* 606 /*
616 * Loop over all the levels starting with maxlen. 607 * Loop over all the levels starting with maxlen.
617 * At each level, look at all the bitmap blocks, to see if there 608 * At each level, look at all the bitmap blocks, to see if there
@@ -669,6 +660,9 @@ xfs_rtallocate_extent_size(
669 *rtblock = NULLRTBLOCK; 660 *rtblock = NULLRTBLOCK;
670 return 0; 661 return 0;
671 } 662 }
663 ASSERT(minlen != 0);
664 ASSERT(maxlen != 0);
665
672 /* 666 /*
673 * Loop over sizes, from maxlen down to minlen. 667 * Loop over sizes, from maxlen down to minlen.
674 * This time, when we do the allocations, allow smaller ones 668 * This time, when we do the allocations, allow smaller ones
@@ -1954,6 +1948,7 @@ xfs_growfs_rt(
1954 nsbp->sb_blocksize * nsbp->sb_rextsize); 1948 nsbp->sb_blocksize * nsbp->sb_rextsize);
1955 nsbp->sb_rextents = nsbp->sb_rblocks; 1949 nsbp->sb_rextents = nsbp->sb_rblocks;
1956 do_div(nsbp->sb_rextents, nsbp->sb_rextsize); 1950 do_div(nsbp->sb_rextents, nsbp->sb_rextsize);
1951 ASSERT(nsbp->sb_rextents != 0);
1957 nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents); 1952 nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents);
1958 nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1; 1953 nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1;
1959 nrsumsize = 1954 nrsumsize =