[PATCH NFS 1/3] Lose second parameter of nfs_block_size().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[PATCH NFS 1/3] Lose second parameter of nfs_block_size().

Most calls to nfs_block_size() were done with a NULL pointer as second
parameter anyway.  We can simply calculate the number of bits ourselves
instead of using that ugly pointer thingy.

Signed-off-by: Rene Scharfe <[email protected]>
---

 fs/nfs/inode.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

6ba4cb36d1e905852917305146fbe0076ad1d86f
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -217,14 +217,14 @@ nfs_calc_block_size(u64 tsize)
  * Compute and set NFS server blocksize
  */
 static inline unsigned long
-nfs_block_size(unsigned long bsize, unsigned char *nrbitsp)
+nfs_block_size(unsigned long bsize)
 {
 	if (bsize < 1024)
 		bsize = NFS_DEF_FILE_IO_BUFFER_SIZE;
 	else if (bsize >= NFS_MAX_FILE_IO_BUFFER_SIZE)
 		bsize = NFS_MAX_FILE_IO_BUFFER_SIZE;
 
-	return nfs_block_bits(bsize, nrbitsp);
+	return nfs_block_bits(bsize, NULL);
 }
 
 /*
@@ -293,16 +293,16 @@ nfs_sb_init(struct super_block *sb, rpc_
 		server->namelen = pathinfo.max_namelen;
 	/* Work out a lot of parameters */
 	if (server->rsize == 0)
-		server->rsize = nfs_block_size(fsinfo.rtpref, NULL);
+		server->rsize = nfs_block_size(fsinfo.rtpref);
 	if (server->wsize == 0)
-		server->wsize = nfs_block_size(fsinfo.wtpref, NULL);
+		server->wsize = nfs_block_size(fsinfo.wtpref);
 
 	if (fsinfo.rtmax >= 512 && server->rsize > fsinfo.rtmax)
-		server->rsize = nfs_block_size(fsinfo.rtmax, NULL);
+		server->rsize = nfs_block_size(fsinfo.rtmax);
 	if (fsinfo.wtmax >= 512 && server->wsize > fsinfo.wtmax)
-		server->wsize = nfs_block_size(fsinfo.wtmax, NULL);
+		server->wsize = nfs_block_size(fsinfo.wtmax);
 
-	max_rpc_payload = nfs_block_size(rpc_max_payload(server->client), NULL);
+	max_rpc_payload = nfs_block_size(rpc_max_payload(server->client));
 	if (server->rsize > max_rpc_payload)
 		server->rsize = max_rpc_payload;
 	if (server->wsize > max_rpc_payload)
@@ -325,7 +325,7 @@ nfs_sb_init(struct super_block *sb, rpc_
 							 &sb->s_blocksize_bits);
 	server->wtmult = nfs_block_bits(fsinfo.wtmult, NULL);
 
-	server->dtsize = nfs_block_size(fsinfo.dtpref, NULL);
+	server->dtsize = nfs_block_size(fsinfo.dtpref);
 	if (server->dtsize > PAGE_CACHE_SIZE)
 		server->dtsize = PAGE_CACHE_SIZE;
 	if (server->dtsize > server->rsize)
@@ -419,12 +419,14 @@ nfs_fill_super(struct super_block *sb, s
 	server           = NFS_SB(sb);
 	sb->s_blocksize_bits = 0;
 	sb->s_blocksize = 0;
-	if (data->bsize)
-		sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits);
+	if (data->bsize) {
+		sb->s_blocksize = nfs_block_size(data->bsize);
+		sb->s_blocksize_bits = fls(sb->s_blocksize - 1);
+	}
 	if (data->rsize)
-		server->rsize = nfs_block_size(data->rsize, NULL);
+		server->rsize = nfs_block_size(data->rsize);
 	if (data->wsize)
-		server->wsize = nfs_block_size(data->wsize, NULL);
+		server->wsize = nfs_block_size(data->wsize);
 	server->flags    = data->flags & NFS_MOUNT_FLAGMASK;
 
 	server->acregmin = data->acregmin*HZ;
@@ -1619,9 +1621,9 @@ static int nfs4_fill_super(struct super_
 	sb->s_blocksize = 0;
 	server = NFS_SB(sb);
 	if (data->rsize != 0)
-		server->rsize = nfs_block_size(data->rsize, NULL);
+		server->rsize = nfs_block_size(data->rsize);
 	if (data->wsize != 0)
-		server->wsize = nfs_block_size(data->wsize, NULL);
+		server->wsize = nfs_block_size(data->wsize);
 	server->flags = data->flags & NFS_MOUNT_FLAGMASK;
 	server->caps = NFS_CAP_ATOMIC_OPEN;
 
-
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]
  Powered by Linux