From patchwork Tue Dec 10 08:51:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 3316241 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6F2BE9F37A for ; Tue, 10 Dec 2013 08:52:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9F84201BD for ; Tue, 10 Dec 2013 08:51:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B96332015A for ; Tue, 10 Dec 2013 08:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752921Ab3LJIvx (ORCPT ); Tue, 10 Dec 2013 03:51:53 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:26437 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270Ab3LJIvw (ORCPT ); Tue, 10 Dec 2013 03:51:52 -0500 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rBA8pnEd020676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Dec 2013 08:51:50 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rBA8pni1014854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Dec 2013 08:51:49 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rBA8pmmC028300; Tue, 10 Dec 2013 08:51:49 GMT Received: from localhost.localdomain (/10.191.10.241) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Dec 2013 00:51:48 -0800 Date: Tue, 10 Dec 2013 16:51:41 +0800 From: Liu Bo To: Chris Mason Cc: linux-btrfs@vger.kernel.org Subject: Re: [PATCH] Btrfs: avoid building inode cache repeatly Message-ID: <20131210084733.GA8913@localhost.localdomain> Reply-To: bo.li.liu@oracle.com References: <1386581671-4639-1-git-send-email-bo.li.liu@oracle.com> <20131209142005.20371.31891@ret.masoncoding.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131209142005.20371.31891@ret.masoncoding.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Dec 09, 2013 at 09:20:05AM -0500, Chris Mason wrote: > Quoting Liu Bo (2013-12-09 04:34:31) > > Inode cache is similar to free space cache and in fact shares the same > > code, however, we don't load inode cache unless we're about to allocate > > inode id, then there is a case where we only commit the transaction during > > other operations, such as snapshot creation, we now update fs roots' generation > > to the new transaction id, after that when we want to load the inode cache, > > we'll find that it's not valid thanks to the mismatch of generation, and we > > have to push btrfs-ino-cache thread to build inode cache from disk, and > > this operation is sometimes time-costing. > > > > So to fix the above, we load inode cache into memory during reading fs root. > > Thanks Liu. Have you tested this with orphan replay? I'd like to make > sure the new ordering of starting caching isn't causing problems with > finding and processing the orphan items. I hacked the code with the following change in order to test orphan replay with inode cache enabled, it's ok on my side on mounting and using, I'll make some tests to make sure xfstests is ok, too. I'll be glad if anyone tells me he/she has a better way to test it :) -liubo --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 431ba6f..ba5abd7 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3515,7 +3515,7 @@ static int btrfs_orphan_del(struct btrfs_trans_handle *trans, if (delete_item) { atomic_dec(&root->orphan_inodes); - if (trans) + if (0 && trans) ret = btrfs_del_orphan_item(trans, root, btrfs_ino(inode)); }