diff options
author | Robert P. J. Day <rpjday@crashcourse.ca> | 2007-11-23 00:30:51 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-02-07 02:18:19 -0500 |
commit | 40ebd81d1a7635cf92a59c387a599fce4863206b (patch) | |
tree | f8ffb52395e17a27951168a37b4bbb845c64e3a9 /fs/xfs/xfs_inode.c | |
parent | e6a4b37f38dca6e86b2648d172946700ee921e12 (diff) |
[XFS] Use kernel-supplied "roundup_pow_of_two" for simplicity
SGI-PV: 971186
SGI-Modid: xfs-linux-melb:xfs-kern:30098a
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r-- | fs/xfs/xfs_inode.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 815ae978e3bd..dc4b8bd33f4f 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -15,6 +15,8 @@ | |||
15 | * along with this program; if not, write the Free Software Foundation, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | #include <linux/log2.h> | ||
19 | |||
18 | #include "xfs.h" | 20 | #include "xfs.h" |
19 | #include "xfs_fs.h" | 21 | #include "xfs_fs.h" |
20 | #include "xfs_types.h" | 22 | #include "xfs_types.h" |
@@ -3642,32 +3644,6 @@ xfs_iaccess( | |||
3642 | return XFS_ERROR(EACCES); | 3644 | return XFS_ERROR(EACCES); |
3643 | } | 3645 | } |
3644 | 3646 | ||
3645 | /* | ||
3646 | * xfs_iroundup: round up argument to next power of two | ||
3647 | */ | ||
3648 | uint | ||
3649 | xfs_iroundup( | ||
3650 | uint v) | ||
3651 | { | ||
3652 | int i; | ||
3653 | uint m; | ||
3654 | |||
3655 | if ((v & (v - 1)) == 0) | ||
3656 | return v; | ||
3657 | ASSERT((v & 0x80000000) == 0); | ||
3658 | if ((v & (v + 1)) == 0) | ||
3659 | return v + 1; | ||
3660 | for (i = 0, m = 1; i < 31; i++, m <<= 1) { | ||
3661 | if (v & m) | ||
3662 | continue; | ||
3663 | v |= m; | ||
3664 | if ((v & (v + 1)) == 0) | ||
3665 | return v + 1; | ||
3666 | } | ||
3667 | ASSERT(0); | ||
3668 | return( 0 ); | ||
3669 | } | ||
3670 | |||
3671 | #ifdef XFS_ILOCK_TRACE | 3647 | #ifdef XFS_ILOCK_TRACE |
3672 | ktrace_t *xfs_ilock_trace_buf; | 3648 | ktrace_t *xfs_ilock_trace_buf; |
3673 | 3649 | ||
@@ -4174,7 +4150,7 @@ xfs_iext_realloc_direct( | |||
4174 | return; | 4150 | return; |
4175 | } | 4151 | } |
4176 | if (!is_power_of_2(new_size)){ | 4152 | if (!is_power_of_2(new_size)){ |
4177 | rnew_size = xfs_iroundup(new_size); | 4153 | rnew_size = roundup_pow_of_two(new_size); |
4178 | } | 4154 | } |
4179 | if (rnew_size != ifp->if_real_bytes) { | 4155 | if (rnew_size != ifp->if_real_bytes) { |
4180 | ifp->if_u1.if_extents = | 4156 | ifp->if_u1.if_extents = |
@@ -4197,7 +4173,7 @@ xfs_iext_realloc_direct( | |||
4197 | else { | 4173 | else { |
4198 | new_size += ifp->if_bytes; | 4174 | new_size += ifp->if_bytes; |
4199 | if (!is_power_of_2(new_size)) { | 4175 | if (!is_power_of_2(new_size)) { |
4200 | rnew_size = xfs_iroundup(new_size); | 4176 | rnew_size = roundup_pow_of_two(new_size); |
4201 | } | 4177 | } |
4202 | xfs_iext_inline_to_direct(ifp, rnew_size); | 4178 | xfs_iext_inline_to_direct(ifp, rnew_size); |
4203 | } | 4179 | } |