From patchwork Mon Jan 7 22:10:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 1942751 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 9869C3FE37 for ; Mon, 7 Jan 2013 22:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755795Ab3AGWEV (ORCPT ); Mon, 7 Jan 2013 17:04:21 -0500 Received: from mx2.fusionio.com ([66.114.96.31]:38367 "EHLO mx2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755790Ab3AGWEV (ORCPT ); Mon, 7 Jan 2013 17:04:21 -0500 X-ASG-Debug-ID: 1357596260-0421b52b7dd9c30001-6jHSXT Received: from mail1.int.fusionio.com (mail1.int.fusionio.com [10.101.1.21]) by mx2.fusionio.com with ESMTP id HgnjKXOvj9egQcHL (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 07 Jan 2013 15:04:20 -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; Mon, 7 Jan 2013 15:04:20 -0700 From: Josef Bacik To: Subject: [PATCH] Btrfs-progs: make btrfsck aware of free space inodes Date: Mon, 7 Jan 2013 17:10:56 -0500 X-ASG-Orig-Subj: [PATCH] Btrfs-progs: make btrfsck aware of free space inodes Message-ID: <1357596656-11658-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: 1357596260 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.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=MARKETING_SUBJECT X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.119214 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.60 MARKETING_SUBJECT Subject contains popular marketing words Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Josef Bacik The new xfstests will run fsck against the volume to make sure we didn't introduce any inconsistencies, which is nice except we will error out immediately if we mount with inode_cache. We need to make btrfsck skip the special free space cache items and then just assume that we have a link for the free space cache inode item. This makes btrfsck pass with success on a fs with inode cache items. Thanks, Signed-off-by: Josef Bacik --- btrfsck.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/btrfsck.c b/btrfsck.c index 7aac736..572dde0 100644 --- a/btrfsck.c +++ b/btrfsck.c @@ -274,6 +274,9 @@ static struct inode_record *get_inode_rec(struct cache_tree *inode_cache, node->cache.size = 1; node->data = rec; + if (ino == BTRFS_FREE_INO_OBJECTID) + rec->found_link = 1; + ret = insert_existing_cache_extent(inode_cache, &node->cache); BUG_ON(ret); } @@ -1015,6 +1018,10 @@ static int process_one_leaf(struct btrfs_root *root, struct extent_buffer *eb, nritems = btrfs_header_nritems(eb); for (i = 0; i < nritems; i++) { btrfs_item_key_to_cpu(eb, &key, i); + + if (key.objectid == BTRFS_FREE_SPACE_OBJECTID) + continue; + if (active_node->current == NULL || active_node->current->ino < key.objectid) { if (active_node->current) {