Date: Fri, 26 Jun 2009 21:31:24 GMT From: Aditya Sarawgi <truncs@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 165292 for review Message-ID: <200906262131.n5QLVOjd084986@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=165292 Change 165292 by truncs@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906262131.n5QLVOjd084986>