From owner-p4-projects@FreeBSD.ORG Thu May 27 13:32:40 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 62251106567D; Thu, 27 May 2010 13:32:40 +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 251D7106567A for ; Thu, 27 May 2010 13:32:40 +0000 (UTC) (envelope-from lz@FreeBSD.org) Received: from repoman.freebsd.org (unknown [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id EDE0A8FC1E for ; Thu, 27 May 2010 13:32:39 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o4RDWdCE052504 for ; Thu, 27 May 2010 13:32:39 GMT (envelope-from lz@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o4RDWdXK052502 for perforce@freebsd.org; Thu, 27 May 2010 13:32:39 GMT (envelope-from lz@FreeBSD.org) Date: Thu, 27 May 2010 13:32:39 GMT Message-Id: <201005271332.o4RDWdXK052502@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to lz@FreeBSD.org using -f From: Zheng Liu To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 178881 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 May 2010 13:32:40 -0000 http://p4web.freebsd.org/@@178881?ac=10 Change 178881 by lz@gnehzuil-freebsd on 2010/05/27 13:32:05 Adjust the reservation window size dynamically. Affected files ... .. //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#19 edit .. //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_rsv_win.h#9 edit Differences ... ==== //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_alloc.c#19 (text+ko) ==== @@ -128,6 +128,7 @@ EXT2_TREE_LOCK(ip->i_e2fs); ext2_remove_rsv_win(ip->i_e2fs, rp); EXT2_TREE_UNLOCK(ip->i_e2fs); + rp->rsv_goal_size = EXT2_RSV_DEFAULT_RESERVE_BLKS; } /* @@ -189,7 +190,7 @@ { struct ext2_rsv_win *rsv, *prev, *next; int32_t cur; - int size = EXT2_RSV_DEFAULT_RESERVE_BLKS; + int size = rp->rsv_goal_size; if (search == NULL) search = RB_ROOT(&fs->e2fs_rsv_tree); @@ -340,6 +341,7 @@ EXT2_TREE_LOCK(fs); ext2_add_rsv_win(fs, rp); EXT2_TREE_UNLOCK(fs); + rp->rsv_alloc_hit++; allocated: setbit(bbp, (daddr_t)bpref); @@ -363,10 +365,20 @@ u_long start; char *bbp; daddr_t bno = -1; + int size = EXT2_RSV_DEFAULT_RESERVE_BLKS; ump = ip->i_ump; bbp = (char *)bp->b_data; + if (rp->rsv_end != EXT2_RSV_NOT_ALLOCATED && + rp->rsv_alloc_hit > + (rp->rsv_goal_size / 2)) { + size = rp->rsv_goal_size * 2; + if (size > EXT2_RSV_MAX_RESERVE_BLKS) + size = EXT2_RSV_MAX_RESERVE_BLKS; + rp->rsv_goal_size = size; + } + if (dtog(fs, bpref) != cg) goto find; ==== //depot/projects/soc2010/extfs/src/sys/fs/ext2fs/ext2_rsv_win.h#9 (text+ko) ==== @@ -31,6 +31,7 @@ #include #define EXT2_RSV_DEFAULT_RESERVE_BLKS 8 +#define EXT2_RSV_MAX_RESERVE_BLKS 1027 #define EXT2_RSV_NOT_ALLOCATED 0 #define EXT2_RSV_LOCK(ip) mtx_lock(&ip->i_rsv_lock)