
From: Eric Van Hensbergen <ericvh@gmail.com>

Replace v9fs_block_bits() with fls()

Originally from Rene Scharfe.

Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 fs/9p/vfs_super.c |   33 +++------------------------------
 1 files changed, 3 insertions(+), 30 deletions(-)

diff -puN fs/9p/vfs_super.c~v9fs-vfs-superblock-operations-and-glue-replace-v9fs_block_bits-with-fls fs/9p/vfs_super.c
--- devel/fs/9p/vfs_super.c~v9fs-vfs-superblock-operations-and-glue-replace-v9fs_block_bits-with-fls	2005-07-25 21:10:15.000000000 -0700
+++ devel-akpm/fs/9p/vfs_super.c	2005-07-25 21:10:15.000000000 -0700
@@ -25,6 +25,7 @@
  *
  */
 
+#include <linux/kernel.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
@@ -74,34 +75,6 @@ static int v9fs_set_super(struct super_b
 }
 
 /**
- * v9fs_block_bits - Determine bits in blocksize (from NFS Code)
- * @bsize: blocksize
- * @nrbitsp: number of bits
- *
- * this bit from linux/fs/nfs/inode.c
- * Copyright (C) 1992  Rick Sladkey
- * XXX - shouldn't there be a global linux function for this?
- *
- */
-
-static inline unsigned long
-v9fs_block_bits(unsigned long bsize, unsigned char *nrbitsp)
-{
-	/* make sure blocksize is a power of two */
-	if ((bsize & (bsize - 1)) || nrbitsp) {
-		unsigned char nrbits;
-
-		for (nrbits = 31; nrbits && !(bsize & (1 << nrbits));
-		     nrbits--) ;
-		bsize = 1 << nrbits;
-		if (nrbitsp)
-			*nrbitsp = nrbits;
-	}
-
-	return bsize;
-}
-
-/**
  * v9fs_fill_super - populate superblock with info
  * @sb: superblock
  * @v9ses: session information
@@ -113,8 +86,8 @@ v9fs_fill_super(struct super_block *sb, 
 		int flags)
 {
 	sb->s_maxbytes = MAX_LFS_FILESIZE;
-	sb->s_blocksize =
-	    v9fs_block_bits(v9ses->maxdata, &sb->s_blocksize_bits);
+	sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
+	sb->s_blocksize = 1 << sb->s_blocksize_bits;
 	sb->s_magic = V9FS_MAGIC;
 	sb->s_op = &v9fs_super_ops;
 
_
