patch-2.3.46 linux/fs/nfsd/vfs.c

Next file: linux/fs/open.c
Previous file: linux/fs/nfsd/nfssvc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.45/linux/fs/nfsd/vfs.c linux/fs/nfsd/vfs.c
@@ -73,8 +73,6 @@
 				p_rawin;
 };
 
-int nfsd_nservers = 0;
-#define FILECACHE_MAX		(2 * nfsd_nservers) 
 static struct raparms *		raparml = NULL;
 static struct raparms *		raparm_cache = NULL;
 
@@ -272,10 +270,7 @@
 		if (err)
 			goto out_nfserr;
 
-		err = locks_verify_area(FLOCK_VERIFY_WRITE, inode, NULL,
-				  iap->ia_size<inode->i_size ? iap->ia_size : inode->i_size,
-				  abs(inode->i_size - iap->ia_size));
-
+		err = locks_verify_truncate(inode, NULL, iap->ia_size);
 		if (err)
 			goto out_nfserr;
 		DQUOT_INIT(inode);
@@ -377,7 +372,7 @@
 	int			error;
 
 	error = fh_verify(rqstp, fhp, 0, MAY_NOP);
-	if (error < 0)
+	if (error)
 		goto out;
 
 	export = fhp->fh_export;
@@ -1061,9 +1056,7 @@
 	err = get_write_access(inode);
 	if (err)
 		goto out_nfserr;
-	err = locks_verify_area(FLOCK_VERIFY_WRITE, inode, NULL,
-				  size<inode->i_size ? size : inode->i_size,
-				  abs(inode->i_size - size));
+	err = locks_verify_truncate(inode, NULL, size);
 	if (err)
 		goto out_nfserr;
 
@@ -1703,34 +1696,34 @@
 {
 	if (!raparm_cache)
 		return;
-	dprintk("nfsd: freeing %d readahead buffers.\n", FILECACHE_MAX);
+	dprintk("nfsd: freeing readahead buffers.\n");
 	kfree(raparml);
-	nfsd_nservers = 0;
 	raparm_cache = raparml = NULL;
 }
 /*
  * Initialize readahead param cache
  */
-void
-nfsd_racache_init(void)
+int
+nfsd_racache_init(int cache_size)
 {
 	int	i;
 
 	if (raparm_cache)
-		return;
-	raparml = kmalloc(sizeof(struct raparms) * FILECACHE_MAX, GFP_KERNEL);
+		return 0;
+	raparml = kmalloc(sizeof(struct raparms) * cache_size, GFP_KERNEL);
 
 	if (raparml != NULL) {
 		dprintk("nfsd: allocating %d readahead buffers.\n",
-			FILECACHE_MAX);
-		memset(raparml, 0, sizeof(struct raparms) * FILECACHE_MAX);
-		for (i = 0; i < FILECACHE_MAX - 1; i++) {
+			cache_size);
+		memset(raparml, 0, sizeof(struct raparms) * cache_size);
+		for (i = 0; i < cache_size - 1; i++) {
 			raparml[i].p_next = raparml + i + 1;
 		}
 		raparm_cache = raparml;
 	} else {
 		printk(KERN_WARNING
 		       "nfsd: Could not allocate memory read-ahead cache.\n");
-		nfsd_nservers = 0;
+		return -ENOMEM;
 	}
+	return 0;
 }

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen (who was at: [email protected])