patch-1.3.82 linux/fs/nfs/inode.c

Next file: linux/fs/nfs/nfsiod.c
Previous file: linux/fs/nfs/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.81/linux/fs/nfs/inode.c linux/fs/nfs/inode.c
@@ -17,16 +17,22 @@
 
 #include <linux/sched.h>
 #include <linux/nfs_fs.h>
+#include <linux/nfsiod.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
 #include <linux/locks.h>
+#include <linux/smp.h>
 
 #include <asm/system.h>
 #include <asm/segment.h>
 
+/* This is for kernel_thread */
+#define __KERNEL_SYSCALLS__
+#include <linux/unistd.h>
+
 extern int close_fp(struct file *filp);
 
 static int nfs_notify_change(struct inode *, struct iattr *);
@@ -307,8 +313,39 @@
 	nfs_read_super, "nfs", 0, NULL
 };
 
+/*
+ * Start up an nfsiod process. This is an awful hack, because when running
+ * as a module, we will keep insmod's memory. Besides, the current->comm
+ * hack won't work in this case
+ * The best would be to have a syscall for nfs client control that (among
+ * other things) forks biod's.
+ * Alternatively, we might want to have the idle task spawn biod's on demand.
+ */
+static int run_nfsiod(void *dummy)
+{
+	int	ret;
+
+#ifdef __SMP__
+	lock_kernel();
+	syscall_count++;
+#endif
+
+	MOD_INC_USE_COUNT;
+	current->session = 1;
+	current->pgrp = 1;
+	sprintf(current->comm, "nfsiod");
+	ret = nfsiod();
+	MOD_DEC_USE_COUNT;
+	return ret;
+}
+
 int init_nfs_fs(void)
 {
+	/* Fork four biod's */
+	kernel_thread(run_nfsiod, NULL, 0);
+	kernel_thread(run_nfsiod, NULL, 0);
+	kernel_thread(run_nfsiod, NULL, 0);
+	kernel_thread(run_nfsiod, NULL, 0);
         return register_filesystem(&nfs_fs_type);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this