PERFORCE change 165292 for review

Aditya Sarawgi truncs at FreeBSD.org
Fri Jun 26 21:31:26 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165292

Change 165292 by truncs at aditya on 2009/06/26 21:30:27

	Introduce new functions in the code. Check whether a directory has to be allocated if yes obtain a cylinder group based on 
	ext2_dirpref else try to place it in the same cylinder group. The preferred inode will always be the next inode.

Affected files ...

.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#17 edit

Differences ...

==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#17 (text+ko) ====

@@ -369,17 +369,24 @@
 	struct inode *pip;
 	struct m_ext2fs *fs;
 	struct inode *ip;
-	ino_t ino;
-	int i, error;
+	ino_t ino, ipref;
+	int i, error, cg;
 	
 	*vpp = NULL;
 	pip = VTOI(pvp);
 	fs = pip->i_e2fs;
 	if (fs->e2fs->e2fs_ficount == 0)
 		goto noinodes;
-	
-	/* call the Linux routine - it returns the inode number only */
-	ino = ext2_new_inode(pip, mode);
+	/*
+	 * If it is a directory then obtain a cylinder group based on ext2_dirpref 
+	 * else the preferred inode is the next inode. 
+	 */
+	if((mode & IFMT) == IFDIR)
+		cg = ext2_dirpref(fs);
+	else
+		cg = ino_to_cg(fs, pip->i_number);
+	ipref = cg * fs->e2fs.e2fs_ipg + 1;
+        ino = ext2_hashalloc(pip, cg, (long)ipref, mode, ext2_nodealloccg);
 
 	if (ino == 0) 
 		goto noinodes;


More information about the p4-projects mailing list