[PATCH NFS 3/3] Replace nfs_block_bits() with roundup_pow_of_two()
Function nfs_block_bits() an open-coded version of (the non-existing)
rounddown_pow_of_two(). That means that for non-power-of-two target
sizes it returns half the size needed for a block to fully contain
the target. I guess this is wrong. :-) The patch uses the built-in
roundup_pow_of_two() instead.
Signed-off-by: Rene Scharfe <[email protected]>
---
fs/nfs/inode.c | 22 +++-------------------
1 files changed, 3 insertions(+), 19 deletions(-)
4130722d1eeb5eb22c38df9f09dfa6be554bc72c
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -185,22 +185,6 @@ nfs_umount_begin(struct super_block *sb)
rpc_killall_tasks(rpc);
}
-
-static inline unsigned long
-nfs_block_bits(unsigned long bsize)
-{
- /* make sure blocksize is a power of two */
- if (bsize & (bsize - 1)) {
- unsigned char nrbits;
-
- for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--)
- ;
- bsize = 1 << nrbits;
- }
-
- return bsize;
-}
-
/*
* Calculate the number of 512byte blocks used.
*/
@@ -222,7 +206,7 @@ nfs_block_size(unsigned long bsize)
else if (bsize >= NFS_MAX_FILE_IO_BUFFER_SIZE)
bsize = NFS_MAX_FILE_IO_BUFFER_SIZE;
- return nfs_block_bits(bsize);
+ return roundup_pow_of_two(bsize);
}
/*
@@ -319,10 +303,10 @@ nfs_sb_init(struct super_block *sb, rpc_
}
if (sb->s_blocksize == 0) {
- sb->s_blocksize = nfs_block_bits(server->wsize);
+ sb->s_blocksize = roundup_pow_of_two(server->wsize);
sb->s_blocksize_bits = fls(sb->s_blocksize - 1);
}
- server->wtmult = nfs_block_bits(fsinfo.wtmult);
+ server->wtmult = roundup_pow_of_two(fsinfo.wtmult);
server->dtsize = nfs_block_size(fsinfo.dtpref);
if (server->dtsize > PAGE_CACHE_SIZE)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|