From patchwork Tue Mar 26 19:28:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2343581 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 25A13DF264 for ; Tue, 26 Mar 2013 19:20:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754208Ab3CZTUx (ORCPT ); Tue, 26 Mar 2013 15:20:53 -0400 Received: from dkim1.fusionio.com ([66.114.96.53]:58462 "EHLO dkim1.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754105Ab3CZTUx (ORCPT ); Tue, 26 Mar 2013 15:20:53 -0400 Received: from mx2.fusionio.com (unknown [10.101.1.160]) by dkim1.fusionio.com (Postfix) with ESMTP id CAA3C7C0401 for ; Tue, 26 Mar 2013 13:20:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1364325652; bh=ZQfTDC8m++nqZE2nZcbW9A95hoo4qBkT10KVrXvsEnw=; h=From:To:Subject:Date; b=kBtLL9e+bvC1nZ+dJT77rVkF98cUv+U3L7Yda6uwt3u4NNuYlVeBUVeL31I5YluAD NbbOqjU304a8jvtQOhViUX92izl7QCp86jGqDkoMhkPQbGFoCDjFc+Nvthg/3aJAOB Wk5r2uHu9Ppb+d2OtDr/oAGWAA3Il30Y8IjeBCvs= X-ASG-Debug-ID: 1364325652-0421b53e2227b10001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx2.fusionio.com with ESMTP id OrSus6HvfDsO1a7N (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Tue, 26 Mar 2013 13:20:52 -0600 (MDT) X-Barracuda-Envelope-From: JBacik@fusionio.com Received: from localhost (98.26.82.158) by mail.fusionio.com (10.101.1.19) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 26 Mar 2013 13:20:51 -0600 From: Josef Bacik To: Subject: [PATCH] Btrfs: fix space accounting for unlink and rename Date: Tue, 26 Mar 2013 15:28:16 -0400 X-ASG-Orig-Subj: [PATCH] Btrfs: fix space accounting for unlink and rename Message-ID: <1364326096-7959-1-git-send-email-jbacik@fusionio.com> X-Mailer: git-send-email 1.7.7.6 MIME-Version: 1.0 X-Barracuda-Connect: mail1.int.fusionio.com[10.101.1.21] X-Barracuda-Start-Time: 1364325652 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.181:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.126317 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org We are way over-reserving for unlink and rename. Rename is just some random huge number and unlink accounts for tree log operations that don't actually happen during unlink, not to mention the tree log doesn't take from the trans block rsv anyway so it's completely useless. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/inode.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 106b261..d38c9b3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3683,11 +3683,9 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir, * 1 for the dir item * 1 for the dir index * 1 for the inode ref - * 1 for the inode ref in the tree log - * 2 for the dir entries in the log * 1 for the inode */ - trans = btrfs_start_transaction(root, 8); + trans = btrfs_start_transaction(root, 5); if (!IS_ERR(trans) || PTR_ERR(trans) != -ENOSPC) return trans; @@ -8130,7 +8128,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, * inodes. So 5 * 2 is 10, plus 1 for the new link, so 11 total items * should cover the worst case number of items we'll modify. */ - trans = btrfs_start_transaction(root, 20); + trans = btrfs_start_transaction(root, 11); if (IS_ERR(trans)) { ret = PTR_ERR(trans); goto out_notrans;