From patchwork Tue Jan 26 14:30:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 75179 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0QEUuaa002567 for ; Tue, 26 Jan 2010 14:30:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754429Ab0AZOaz (ORCPT ); Tue, 26 Jan 2010 09:30:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754412Ab0AZOaz (ORCPT ); Tue, 26 Jan 2010 09:30:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53318 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754201Ab0AZOay (ORCPT ); Tue, 26 Jan 2010 09:30:54 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0QEUsoW024400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 26 Jan 2010 09:30:54 -0500 Received: from localhost.localdomain (vpn-11-90.rdu.redhat.com [10.11.11.90]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0QEUr2K030976 for ; Tue, 26 Jan 2010 09:30:54 -0500 Date: Tue, 26 Jan 2010 09:30:53 -0500 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: run orphan cleanup on default fs root Message-ID: <20100126143052.GA2183@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 72c08fa..1ce093f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1937,6 +1937,12 @@ struct btrfs_root *open_ctree(struct super_block *sb, if (!fs_info->fs_root) goto fail_trans_kthread; + if (!(sb->s_flags & MS_RDONLY)) { + down_read(&fs_info->cleanup_work_sem); + btrfs_orphan_cleanup(fs_info->fs_root); + up_read(&fs_info->cleanup_work_sem); + } + return tree_root; fail_trans_kthread: diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c7fbfaa..09a4d8e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3795,12 +3795,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) if (location.type == BTRFS_INODE_ITEM_KEY) { inode = btrfs_iget(dir->i_sb, &location, root); - if (unlikely(root->clean_orphans) && - !(inode->i_sb->s_flags & MS_RDONLY)) { - down_read(&root->fs_info->cleanup_work_sem); - btrfs_orphan_cleanup(root); - up_read(&root->fs_info->cleanup_work_sem); - } return inode; }