From patchwork Wed Mar 16 09:48:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Itaru Kitayama X-Patchwork-Id: 639021 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2G9mxrm018093 for ; Wed, 16 Mar 2011 09:48:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752474Ab1CPJs4 (ORCPT ); Wed, 16 Mar 2011 05:48:56 -0400 Received: from irs1ma.bb4u.ne.jp ([202.229.9.180]:55468 "HELO irs1m.bias.ne.jp" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with SMTP id S1752409Ab1CPJs4 (ORCPT ); Wed, 16 Mar 2011 05:48:56 -0400 Received: (qmail 983 invoked from network); 16 Mar 2011 09:48:50 -0000 Received: from unknown (HELO prime) (58.89.221.61) by 0 with SMTP; Wed, 16 Mar 2011 18:48:50 +0900 Date: Wed, 16 Mar 2011 18:48:50 +0900 From: Itaru Kitayama To: miaox@cn.fujitsu.com Cc: linux-btrfs@vger.kernel.org Subject: Re: [PATCH V3] btrfs: implement delayed inode items operation Message-Id: <20110316184850.f25551a6.kitayama@cl.bb4u.ne.jp> In-Reply-To: <4D786DF2.7000104@cn.fujitsu.com> References: <20110310000355.f225f0d0.kitayama@cl.bb4u.ne.jp> <4D786DF2.7000104@cn.fujitsu.com> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 16 Mar 2011 09:48:59 +0000 (UTC) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 495a6af..b6ea082 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1006,9 +1006,9 @@ int btrfs_run_delayed_items(struct btrfs_trans_handle *trans, return ret; } -int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans, - struct btrfs_root *root, - struct inode *inode) +int __btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct inode *inode, int delayed_update) { struct btrfs_delayed_node *delayed_node = btrfs_get_delayed_node(inode); struct btrfs_path *path; @@ -1036,7 +1036,7 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans, if (!ret) ret = btrfs_delete_delayed_items(trans, path, root, delayed_node); - if (!ret) + if (!ret && delayed_update) ret = btrfs_update_delayed_inode(trans, root, path, delayed_node); btrfs_free_path(path); @@ -1044,13 +1044,27 @@ int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans, return ret; } +int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct inode *inode) +{ + return __btrfs_commit_inode_delayed_items(trans, root, inode, 1); +} + +int btrfs_commit_inode_delayed_items_no_delayed_update(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct inode *inode) +{ + return __btrfs_commit_inode_delayed_items(trans, root, inode, 0); +} + int btrfs_remove_delayed_node(struct inode *inode) { struct btrfs_trans_handle *trans; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_delayed_node *delayed_node = BTRFS_I(inode)->delayed_node; int ret; - + if (!delayed_node) return 0; diff --git a/fs/btrfs/delayed-inode.h b/fs/btrfs/delayed-inode.h index d4134bc..b6986df 100644 --- a/fs/btrfs/delayed-inode.h +++ b/fs/btrfs/delayed-inode.h @@ -114,6 +114,11 @@ void btrfs_balance_delayed_items(struct btrfs_root *root); int btrfs_commit_inode_delayed_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode); +int btrfs_commit_inode_delayed_items_no_delayed_update( + struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct inode *inode); + /* Used for evicting the inode. */ int btrfs_remove_delayed_node(struct inode *inode); int btrfs_kill_delayed_inode_items(struct btrfs_trans_handle *trans, diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5299d9c..e198051 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2611,8 +2611,12 @@ noinline int btrfs_update_inode_nodelayed(struct btrfs_trans_handle *trans, struct btrfs_inode_item *inode_item; struct btrfs_path *path; struct extent_buffer *leaf; + struct btrfs_delayed_node *delayed_node; int ret; + btrfs_commit_inode_delayed_items_no_delayed_update(trans, root, inode); + delayed_node = NULL; + path = btrfs_alloc_path(); if (!path) return -ENOMEM;