From patchwork Thu Aug 19 01:00:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 120286 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7J12TkS027509 for ; Thu, 19 Aug 2010 01:02:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751371Ab0HSBCO (ORCPT ); Wed, 18 Aug 2010 21:02:14 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:41134 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972Ab0HSBCN (ORCPT ); Wed, 18 Aug 2010 21:02:13 -0400 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o7J128QA020183 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 19 Aug 2010 01:02:10 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o7IKGq8R021451; Thu, 19 Aug 2010 01:02:08 GMT Received: from abhmt012.oracle.com by acsmt353.oracle.com with ESMTP id 509809421282179633; Wed, 18 Aug 2010 18:00:33 -0700 Received: from localhost (/66.66.148.185) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Aug 2010 18:00:32 -0700 Date: Wed, 18 Aug 2010 21:00:31 -0400 From: Chris Mason To: Steven Pratt Cc: linux-btrfs Subject: Re: 2.6.35 performance results Message-ID: <20100819010031.GI5854@think> Mail-Followup-To: Chris Mason , Steven Pratt , linux-btrfs References: <4C5C57FB.4090003@dangyankee.net> <20100816200444.GJ993@think> <4C69B2D0.4010501@dangyankee.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4C69B2D0.4010501@dangyankee.net> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 19 Aug 2010 01:02:29 +0000 (UTC) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 32d0940..55e1ee0 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3681,6 +3681,7 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_block_rsv *block_rsv = &root->fs_info->delalloc_block_rsv; u64 to_reserve; + u64 max_reserve; int nr_extents; int retries = 0; int ret; @@ -3717,7 +3718,11 @@ again: block_rsv_add_bytes(block_rsv, to_reserve, 1); - if (block_rsv->size > 512 * 1024 * 1024) + /* 10% or 2GB */ + max_reserve = min_t(u64, 2ULL * 1024 * 1024 * 1024, + div_factor(root->fs_info->fs_devices->total_rw_bytes, 1)); + + if (block_rsv->size > max_reserve) shrink_delalloc(NULL, root, to_reserve); return 0;