From patchwork Wed Apr 15 22:01:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 6222781 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BA6BABF4A6 for ; Wed, 15 Apr 2015 22:02:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD35F20306 for ; Wed, 15 Apr 2015 22:02:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CEA3202FF for ; Wed, 15 Apr 2015 22:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756761AbbDOWCU (ORCPT ); Wed, 15 Apr 2015 18:02:20 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:34273 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754549AbbDOWBp (ORCPT ); Wed, 15 Apr 2015 18:01:45 -0400 Received: from pps.filterd (m0004003 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t3FM0Yvl013557; Wed, 15 Apr 2015 15:01:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=70Kq4aOVJeCUxm3jolbe1uxTm3x4pEeTbpHyvwOH+zM=; b=NJ5Gpg0ME+6XAl/HZxExsk67viamOgnWwlbA3NUhcAHJ7eM2NzdT4Ni8Nsr7lR+nwUE6 JGEXBMqhx39qJ6S00DUHwfseDtYPOcg4bv+/e1MHdcjNV2nJyXCg/gcnFFLUdF/YLSCY CdbOiz3+v3HP9Dy2gCuGJgLHl5655svpti0= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1tsxck8dm8-2 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 15 Apr 2015 15:01:45 -0700 Received: from localhost.localdomain (192.168.54.13) by mail.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 15 Apr 2015 15:01:43 -0700 From: Jens Axboe To: , CC: Jens Axboe , Chris Mason Subject: [PATCH 2/3] btrfs: pass in DIO_SKIP_DIO_COUNT to do_blockdev_direct_IO() Date: Wed, 15 Apr 2015 16:01:37 -0600 Message-ID: <1429135298-17153-3-git-send-email-axboe@fb.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429135298-17153-1-git-send-email-axboe@fb.com> References: <1429135298-17153-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-04-15_07:2015-04-15, 2015-04-15, 1970-01-01 signatures=0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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 btrfs_direct_IO() already holds the inode i_dio_count elevated, so pass in that do_blockdev_direct_IO() does not need to. If we end up dropping the inode dio count before calling this function, then we drop the flag as well. Cc: Chris Mason Signed-off-by: Jens Axboe --- fs/btrfs/inode.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 6fe341a66ed8..3ecac37f10e0 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8121,8 +8121,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, struct inode *inode = file->f_mapping->host; u64 outstanding_extents = 0; size_t count = 0; - int flags = 0; - bool wakeup = true; + int flags = DIO_SKIP_DIO_COUNT; bool relock = false; ssize_t ret; @@ -8170,8 +8169,11 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, &BTRFS_I(inode)->runtime_flags)) { inode_dio_dec(inode); + /* + * we know need i_dio_count inc/dec, the below overwrites + * the skip inc/dec flag. + */ flags = DIO_LOCKING | DIO_SKIP_HOLES; - wakeup = false; } ret = __blockdev_direct_IO(rw, iocb, inode, @@ -8187,7 +8189,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, count - (size_t)ret); } out: - if (wakeup) + if (flags & DIO_SKIP_DIO_COUNT) inode_dio_dec(inode); if (relock) mutex_lock(&inode->i_mutex);