From patchwork Wed Dec 5 10:52:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 1840931 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 3EF8D3FCF2 for ; Wed, 5 Dec 2012 10:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751996Ab2LEKwY (ORCPT ); Wed, 5 Dec 2012 05:52:24 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:10578 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751712Ab2LEKwY (ORCPT ); Wed, 5 Dec 2012 05:52:24 -0500 X-IronPort-AV: E=Sophos;i="4.83,377,1352044800"; d="scan'208";a="6338926" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 05 Dec 2012 18:50:34 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id qB5AqRQe019281 for ; Wed, 5 Dec 2012 18:52:27 +0800 Received: from [10.167.225.199] ([10.167.225.199]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012120518514431-255040 ; Wed, 5 Dec 2012 18:51:44 +0800 Message-ID: <50BF2780.4080701@cn.fujitsu.com> Date: Wed, 05 Dec 2012 18:52:48 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Linux Btrfs Subject: [PATCH 1/6] Btrfs: don't auto defrag a file when doing directIO X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/05 18:51:44, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/05 18:51:44, Serialize complete at 2012/12/05 18:51:44 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org If we runt the direct IO, we should not run auto defrag, because it may introduce buffered IO vs direcIO problem, and make direct IO slow down. Signed-off-by: Miao Xie --- fs/btrfs/inode.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5fc0990..b08e4b1 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5674,9 +5674,6 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode, if (IS_ERR(trans)) return ERR_CAST(trans); - if (start <= BTRFS_I(inode)->disk_i_size && len < 64 * 1024) - btrfs_add_inode_defrag(trans, inode); - trans->block_rsv = &root->fs_info->delalloc_block_rsv; alloc_hint = get_extent_allocation_hint(inode, start, len);