From owner-p4-projects@FreeBSD.ORG Fri Jun 26 21:31:25 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4DE53106567C; Fri, 26 Jun 2009 21:31:25 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DCE8106564A for ; Fri, 26 Jun 2009 21:31:25 +0000 (UTC) (envelope-from truncs@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EFD888FC18 for ; Fri, 26 Jun 2009 21:31:24 +0000 (UTC) (envelope-from truncs@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QLVOov084988 for ; Fri, 26 Jun 2009 21:31:24 GMT (envelope-from truncs@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5QLVOjd084986 for perforce@freebsd.org; Fri, 26 Jun 2009 21:31:24 GMT (envelope-from truncs@FreeBSD.org) Date: Fri, 26 Jun 2009 21:31:24 GMT Message-Id: <200906262131.n5QLVOjd084986@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to truncs@FreeBSD.org using -f From: Aditya Sarawgi To: Perforce Change Reviews Cc: Subject: PERFORCE change 165292 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 21:31:26 -0000 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;