]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[XFS] Use kernel-supplied "roundup_pow_of_two" for simplicity
authorRobert P. J. Day <rpjday@crashcourse.ca>
Fri, 23 Nov 2007 05:30:51 +0000 (16:30 +1100)
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>
Thu, 7 Feb 2008 07:18:19 +0000 (18:18 +1100)
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>
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.h

index 815ae978e3bdf3029f51d33535fa152f2cea93f6..dc4b8bd33f4f85054eda9e8fe72276e73bd12296 100644 (file)
@@ -15,6 +15,8 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+#include <linux/log2.h>
+
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
@@ -3642,32 +3644,6 @@ xfs_iaccess(
        return XFS_ERROR(EACCES);
 }
 
-/*
- * xfs_iroundup: round up argument to next power of two
- */
-uint
-xfs_iroundup(
-       uint    v)
-{
-       int i;
-       uint m;
-
-       if ((v & (v - 1)) == 0)
-               return v;
-       ASSERT((v & 0x80000000) == 0);
-       if ((v & (v + 1)) == 0)
-               return v + 1;
-       for (i = 0, m = 1; i < 31; i++, m <<= 1) {
-               if (v & m)
-                       continue;
-               v |= m;
-               if ((v & (v + 1)) == 0)
-                       return v + 1;
-       }
-       ASSERT(0);
-       return( 0 );
-}
-
 #ifdef XFS_ILOCK_TRACE
 ktrace_t       *xfs_ilock_trace_buf;
 
@@ -4174,7 +4150,7 @@ xfs_iext_realloc_direct(
                        return;
                }
                if (!is_power_of_2(new_size)){
-                       rnew_size = xfs_iroundup(new_size);
+                       rnew_size = roundup_pow_of_two(new_size);
                }
                if (rnew_size != ifp->if_real_bytes) {
                        ifp->if_u1.if_extents =
@@ -4197,7 +4173,7 @@ xfs_iext_realloc_direct(
        else {
                new_size += ifp->if_bytes;
                if (!is_power_of_2(new_size)) {
-                       rnew_size = xfs_iroundup(new_size);
+                       rnew_size = roundup_pow_of_two(new_size);
                }
                xfs_iext_inline_to_direct(ifp, rnew_size);
        }
index bc869fd2f6efaa7fda6d738a7ad6a33cfca9dea2..b2d7b2cd785177b6e3295da11507d9cfc9232287 100644 (file)
@@ -526,7 +526,6 @@ int         xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
 int            xfs_iflush(xfs_inode_t *, uint);
 void           xfs_iflush_all(struct xfs_mount *);
 int            xfs_iaccess(xfs_inode_t *, mode_t, cred_t *);
-uint           xfs_iroundup(uint);
 void           xfs_ichgtime(xfs_inode_t *, int);
 xfs_fsize_t    xfs_file_last_byte(xfs_inode_t *);
 void           xfs_lock_inodes(xfs_inode_t **, int, int, uint);