From patchwork Fri Mar 1 18:37:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 2202721 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 78E0C3FCA4 for ; Fri, 1 Mar 2013 18:30:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752078Ab3CASaQ (ORCPT ); Fri, 1 Mar 2013 13:30:16 -0500 Received: from dkim2.fusionio.com ([66.114.96.54]:50994 "EHLO dkim2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751436Ab3CASaP (ORCPT ); Fri, 1 Mar 2013 13:30:15 -0500 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim2.fusionio.com (Postfix) with ESMTP id 343279A067A for ; Fri, 1 Mar 2013 11:30:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1362162615; bh=ayAlyzrNvK/qLPc/2dLnmUL+0XxKKZba3OOqO4x4bag=; h=From:To:Subject:Date; b=pc9d/7uQrl74+9dRdWQy8K/mnQMjpozY8l5E4BoFXG7lPmGunA2i4pR1DYo/3GbfT 2uvrpW4+uXFrG76xgXa4uUf5eZNBaGtvy/yT/z7A7UUd3UJJdfjtzYHqDIVjK45bn9 FzqMMJyDgFlBwh1n31f6AFZomFXvAmf70HOUPtPs= X-ASG-Debug-ID: 1362162614-03d6a5664b7ecb0001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx1.fusionio.com with ESMTP id AyGZcujpJGo3jaWe (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 01 Mar 2013 11:30:14 -0700 (MST) 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; Fri, 1 Mar 2013 11:30:13 -0700 From: Josef Bacik To: Subject: [PATCH] Btrfs: use set_nlink if our i_nlink is 0 Date: Fri, 1 Mar 2013 13:37:22 -0500 X-ASG-Orig-Subj: [PATCH] Btrfs: use set_nlink if our i_nlink is 0 Message-ID: <1362163042-16514-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: 1362162614 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user 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.123967 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 need to inc the nlink of deleted entries when running replay so we can do the unlink on the fs_root and get everything cleaned up and then have the orphan cleanup do the right thing. The problem is inc_nlink complains about this, even thought it still does the right thing. So use set_nlink() if our i_nlink is 0 to keep users from seeing the warnings during log replay. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/tree-log.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index c7ef569..451fad9 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -1382,7 +1382,10 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans, btrfs_release_path(path); if (ret == 0) { - btrfs_inc_nlink(inode); + if (!inode->i_nlink) + set_nlink(inode, 1); + else + btrfs_inc_nlink(inode); ret = btrfs_update_inode(trans, root, inode); } else if (ret == -EEXIST) { ret = 0;