kern/142924: Small cleanup for the inode struct in ext2fs (based on UFS)

Pedro F. Giffuni giffunip at tutopia.com
Mon Jan 18 02:50:06 UTC 2010


>Number:         142924
>Category:       kern
>Synopsis:       Small cleanup for the inode struct in ext2fs (based on UFS)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 18 02:50:05 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Pedro F. Giffuni
>Release:        8.0-Release + BSD ext2fs
>Organization:
>Environment:
FreeBSD mogwai.giffuni.net 8.0-RELEASE FreeBSD 8.0-RELEASE #13: Sat Jan  9 20:39:47 UTC 2010     pedro at mogwai.giffuni.net:/usr/src/sys/i386/compile/GENERIC  i386

>Description:
Minor enhancements based on UFS:

>From SVN 118969:
Eliminate the i_devvp field from the incore EXT2FS inodes, we can
get the same value from ip->i_ump->um_devvp.

This saves a pointer in the memory copies of inodes, which can
easily run into several hundred kilobytes.

The extra indirection is unmeasurable in benchmarks.
____

While here move a line before a comment in the lookup code to
make space for a dirhash implementation.
>How-To-Repeat:

>Fix:
diff -ru ext2fs.bsd/ext2_lookup.c ext2fs/ext2_lookup.c
--- ext2fs.bsd/ext2_lookup.c	2010-01-17 19:02:30.000000000 +0000
+++ ext2fs/ext2_lookup.c	2010-01-17 20:40:10.000000000 +0000
@@ -347,6 +347,7 @@
 		slotneeded = (sizeof(struct direct) - MAXNAMLEN +
 			cnp->cn_namelen + 3) &~ 3; */
 	}
+	bmask = VFSTOEXT2(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
 
 	/*
 	 * If there is cached information on a previous search of
@@ -359,7 +360,6 @@
 	 * profiling time and hence has been removed in the interest
 	 * of simplicity.
 	 */
-	bmask = VFSTOEXT2(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
 	if (nameiop != LOOKUP || i_diroff == 0 ||
 	    i_diroff > dp->i_size) {
 		entryoffsetinblock = 0;
diff -ru ext2fs.bsd/ext2_vfsops.c ext2fs/ext2_vfsops.c
--- ext2fs.bsd/ext2_vfsops.c	2010-01-17 19:02:56.000000000 +0000
+++ ext2fs/ext2_vfsops.c	2010-01-17 20:37:52.000000000 +0000
@@ -945,9 +945,8 @@
 	}
 
 	/*
-	 * Finish inode initialization now that aliasing has been resolved.
+	 * Finish inode initialization.
 	 */
-	ip->i_devvp = ump->um_devvp;
 
 	/*
 	 * Set up a generation number for this inode if it does not
diff -ru ext2fs.bsd/inode.h ext2fs/inode.h
--- ext2fs.bsd/inode.h	2010-01-17 19:03:21.000000000 +0000
+++ ext2fs/inode.h	2010-01-17 20:35:56.000000000 +0000
@@ -62,7 +62,6 @@
  */
 struct inode {
 	struct	vnode  *i_vnode;/* Vnode associated with this inode. */
-	struct	vnode  *i_devvp;/* Vnode for block I/O. */
 	struct	ext2mount *i_ump;
 	u_int32_t i_flag;	/* flags, see below */
 	ino_t	  i_number;	/* The identity of the inode. */
@@ -143,6 +142,9 @@
 #define	IN_SPACECOUNTED	0x0080		/* Blocks to be freed in free count. */
 #define IN_LAZYACCESS   0x0100		/* Process IN_ACCESS after the
 					    suspension finished */
+
+#define i_devvp i_ump->um_devvp
+
 #ifdef _KERNEL
 /*
  * Structure used to pass around logical block paths generated by


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list