diff usr/src/uts/common/fs/hsfs/hsfs_vfsops.c @ 5312:55bbc18d74af

6588256 HSFS performance needs a boost
author mg147109
date Wed, 24 Oct 2007 07:14:17 -0700
parents 34d9e5474e96
children 3047ad28a67b
line wrap: on
line diff
--- a/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c	Tue Oct 23 17:36:10 2007 -0700
+++ b/usr/src/uts/common/fs/hsfs/hsfs_vfsops.c	Wed Oct 24 07:14:17 2007 -0700
@@ -137,6 +137,12 @@
 	hsfs_options
 };
 
+/*
+ * Indicates whether to enable the I/O scheduling and readahead logic
+ * 1 - Enable, 0 - Do not Enable.
+ * Debugging purposes.
+ */
+int do_schedio = 1;
 static int hsfsfstype;
 static int hsfsinit(int, char *);
 
@@ -158,6 +164,10 @@
 
 char _depends_on[] = "fs/specfs";
 
+extern void hsched_init_caches(void);
+extern void hsched_fini_caches(void);
+
+
 int
 _init(void)
 {
@@ -185,6 +195,7 @@
 	vn_freevnodeops(hsfs_vnodeops);
 
 	hs_fini_hsnode_cache();
+	hsched_fini_caches();
 	return (0);
 }
 
@@ -204,6 +215,12 @@
 uid_t hsfs_default_uid = 0;
 gid_t hsfs_default_gid = 3;
 
+extern void hsched_init(struct hsfs *fsp, int fsid,
+					struct modlinkage *modlinkage);
+extern void hsched_fini(struct hsfs_queue *hqueue);
+extern void hsfs_init_kstats(struct hsfs *fsp, int fsid);
+extern void hsfs_fini_kstats(struct hsfs *fsp);
+
 static int hsfs_mount(struct vfs *vfsp, struct vnode *mvp,
 	struct mounta *uap, struct cred *cr);
 static int hsfs_unmount(struct vfs *vfsp, int, struct cred *cr);
@@ -261,6 +278,7 @@
 	hsfsfstype = fstype;
 	mutex_init(&hs_mounttab_lock, NULL, MUTEX_DEFAULT, NULL);
 	hs_init_hsnode_cache();
+	hsched_init_caches();
 	return (0);
 }
 
@@ -388,6 +406,7 @@
 
 	mutex_exit(&hs_mounttab_lock);
 
+	hsfs_fini_kstats(fsp);
 	(void) VOP_CLOSE(fsp->hsfs_devvp, FREAD, 1, (offset_t)0, cr);
 	VN_RELE(fsp->hsfs_devvp);
 	/* free path table space */
@@ -402,6 +421,9 @@
 	if (fsp->hsfs_fsmnt != NULL)
 		kmem_free(fsp->hsfs_fsmnt, strlen(fsp->hsfs_fsmnt) + 1);
 
+	hsched_fini(fsp->hqueue);
+	kmem_free(fsp->hqueue, sizeof (struct hsfs_queue));
+
 	mutex_destroy(&fsp->hsfs_free_lock);
 	rw_destroy(&fsp->hsfs_hash_lock);
 
@@ -888,6 +910,19 @@
 	 */
 	fsp->hsfs_flags = mount_flags | (fsp->hsfs_flags & HSFSMNT_INODE);
 
+	/*
+	 * Setup I/O Scheduling structures
+	 */
+	if (do_schedio) {
+		fsp->hqueue = kmem_alloc(sizeof (struct hsfs_queue), KM_SLEEP);
+		hsched_init(fsp, fsid, &modlinkage);
+	}
+
+	/*
+	 * Setup kstats
+	 */
+	hsfs_init_kstats(fsp, fsid);
+
 	DTRACE_PROBE1(mount__done, struct hsfs *, fsp);
 
 	/*