From patchwork Wed Feb 11 20:08:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 5814291 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CBD5D9F30C for ; Wed, 11 Feb 2015 20:09:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E9FA8201F4 for ; Wed, 11 Feb 2015 20:09:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B58722015E for ; Wed, 11 Feb 2015 20:09:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753814AbbBKUJH (ORCPT ); Wed, 11 Feb 2015 15:09:07 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:64635 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753380AbbBKUJG (ORCPT ); Wed, 11 Feb 2015 15:09:06 -0500 Received: from pps.filterd (m0004003 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t1BK56kG002666 for ; Wed, 11 Feb 2015 12:09:05 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wit.ai; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=mx2; bh=EqhZNw5M7QvpqB/y6HiAwzk7as9EqKvA5M9RGDlRjuw=; b=tVYMSkacbxf+7yuvyZEorzlEI/4EYKAfDVjasVrJ23ICBAYzoYRKGXEpkUd813+sqZVV I/aBdQt9ZC4xOWHqJ6zUE9s8aLdAhXifLXRPF3MUO1k2mp2nzfaVueQc2toTgTuR34MR vIfthumnCBbaWHDgrs32wNxJ77Uw6it/0HgkFhU9Xo/EkeMMUjxT4I4I3ft0JhPfZwwq mtE7wf6lE/8xyLFwNnp/u1hd7NVT8Q/Fb9nE+dqlGAn2+cGNIB08BfJhDKvX1Bx+qrCw jNbbzj3H9fUXJ8ErDEmcxpYGUrEAJi/8/9vVUktcJf1DDLu8Fpqk2l0U9YEc8JB62Ada pw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=EqhZNw5M7QvpqB/y6HiAwzk7as9EqKvA5M9RGDlRjuw=; b=cBcDlk8dZJuGK7E6loqe2FWiRr2252td335dJYBbUis1qnERzpZCyGXP10fT6Q87ksJO WqUIh89rgO1m7ui8W5aSqyp85T5QrfQaUV5UY+SgHGJo5xkIoflsQpmPyftmmQdTyqnM Vx8HvNTYRABQhAOrOMii0jeease5LlUgqOw= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1sgc180cvg-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Wed, 11 Feb 2015 12:09:05 -0800 Received: from localhost (192.168.57.29) by mail.thefacebook.com (192.168.16.14) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 11 Feb 2015 12:09:03 -0800 From: Josef Bacik To: Subject: [PATCH 2/3] Btrfs: don't set and clear delalloc for O_DIRECT writes Date: Wed, 11 Feb 2015 15:08:58 -0500 Message-ID: <1423685339-8278-2-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1423685339-8278-1-git-send-email-jbacik@fb.com> References: <1423685339-8278-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.57.29] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-02-11_04:2015-02-11, 2015-02-11, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 spamscore=0 suspectscore=3 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502110201 X-FB-Internal: deliver Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 We do this to get the space accounting, but this is just needless churn on the io_tree, so just drop setting/clearing delalloc and just drop the reserved data space when we have a successfull allocation. Thanks, Signed-off-by: Josef Bacik Reviewed-by: Liu Bo --- fs/btrfs/inode.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e78a2fd..fb16fd3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7142,7 +7142,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, int ret = 0; if (create) - unlock_bits |= EXTENT_DELALLOC | EXTENT_DIRTY; + unlock_bits |= EXTENT_DIRTY; else len = min_t(u64, len, root->sectorsize); @@ -7278,11 +7278,7 @@ unlock: BTRFS_I(inode)->outstanding_extents++; spin_unlock(&BTRFS_I(inode)->lock); } - - ret = set_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, - lockstart + len - 1, EXTENT_DELALLOC, NULL, - &cached_state, GFP_NOFS); - BUG_ON(ret); + btrfs_free_reserved_data_space(inode, len); } /*