diff options
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 | } | 
