From owner-p4-projects@FreeBSD.ORG Sat Jul 4 17:38:54 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C5D651065676; Sat, 4 Jul 2009 17:38:53 +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 848CB106564A for ; Sat, 4 Jul 2009 17:38:53 +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 6812F8FC0C for ; Sat, 4 Jul 2009 17:38:53 +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 n64HcrPc009469 for ; Sat, 4 Jul 2009 17:38:53 GMT (envelope-from truncs@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n64HcrmZ009467 for perforce@freebsd.org; Sat, 4 Jul 2009 17:38:53 GMT (envelope-from truncs@FreeBSD.org) Date: Sat, 4 Jul 2009 17:38:53 GMT Message-Id: <200907041738.n64HcrmZ009467@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 165599 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: Sat, 04 Jul 2009 17:38:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=165599 Change 165599 by truncs@aditya on 2009/07/04 17:38:31 This function make no sense since preallocation is removed. Affected files ... .. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#27 edit Differences ... ==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_alloc.c#27 (text+ko) ==== @@ -62,41 +62,37 @@ static daddr_t ext2_mapsearch(struct m_ext2fs *, char *, daddr_t); /* - * Linux calls this functions at the following locations: - * (1) the inode is freed - * (2) a preallocation miss occurs - * (3) truncate is called - * (4) release_file is called and f_mode & 2 - * - * I call it in ext2_inactive, ext2_truncate, ext2_vfree and in (2) - * the call in vfree might be redundant - */ -void -ext2_discard_prealloc(ip) - struct inode * ip; -{ -#ifdef EXT2_PREALLOCATE - if (ip->i_prealloc_count) { - int i = ip->i_prealloc_count; - ip->i_prealloc_count = 0; - ext2_free_blocks (ITOV(ip)->v_mount, - ip->i_prealloc_block, - i); - } -#endif -} - -/* * Allocate a block in the file system. - * - * this takes the framework from ffs_alloc. To implement the - * actual allocation, it calls ext2_new_block, the ported version - * of the same Linux routine. * - * we note that this is always called in connection with ext2_blkpref + * A preference may be optionally specified. If a preference is given + * the following hierarchy is used to allocate a block: + * 1) allocate the requested block. + * 2) allocate a rotationally optimal block in the same cylinder. + * 3) allocate a block in the same cylinder group. + * 4) quadradically rehash into other cylinder groups, until an + * available block is located. + * If no block preference is given the following hierarchy is used + * to allocate a block: + * 1) allocate a block in the cylinder group that contains the + * inode for the file. + * 2) quadradically rehash into other cylinder groups, until an + * available block is located. * - * preallocation is done as Linux does it + * A preference may be optionally specified. If a preference is given + * the following hierarchy is used to allocate a block: + * 1) allocate the requested block. + * 2) allocate a rotationally optimal block in the same cylinder. + * 3) allocate a block in the same cylinder group. + * 4) quadradically rehash into other cylinder groups, until an + * available block is located. + * If no block preference is given the following hierarchy is used + * to allocate a block: + * 1) allocate a block in the cylinder group that contains the + * inode for the file. + * 2) quadradically rehash into other cylinder groups, until an + * available block is located. */ + int ext2_alloc(ip, lbn, bpref, size, cred, bnp) struct inode *ip; @@ -495,7 +491,6 @@ /* ext2_debug("ext2_vfree (%d, %d) called\n", pip->i_number, mode); */ - ext2_discard_prealloc(pip); /* we need to make sure that ext2_free_inode can adjust the used_dir_counts in the group summary information - I'd