From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5200CECAAD2 for ; Thu, 1 Sep 2022 22:59:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235072AbiIAW7g (ORCPT ); Thu, 1 Sep 2022 18:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235074AbiIAW7f (ORCPT ); Thu, 1 Sep 2022 18:59:35 -0400 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5B57FE4C for ; Thu, 1 Sep 2022 15:59:34 -0700 (PDT) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 281MnZVX010621 for ; Thu, 1 Sep 2022 15:59:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=XVCHQQfWhWgKAKMZPJkW78hrbIW41ozZ96M/ldxVQ+c=; b=KnfGKqv7uHvGB11KFCpX830jJ3sANFbKSsaAmgoXCzTsPUhtufoSOCIvuAJTN5Q7wgj7 X9Z32atEmqtYTU02Xh3BKZVQUdiu2Xk2+FiYH6bsDRQyeFXYzPHuDCKpXczHqD4N2zgP yVV4rtFwygZ73dnfTB5aFcZtHOGeBdmoydQ= Received: from mail.thefacebook.com ([163.114.132.120]) by m0089730.ppops.net (PPS) with ESMTPS id 3jam3vesbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 01 Sep 2022 15:59:33 -0700 Received: from twshared22593.02.prn5.facebook.com (2620:10d:c085:208::11) by mail.thefacebook.com (2620:10d:c085:11d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Sep 2022 15:59:32 -0700 Received: by dev1180.prn1.facebook.com (Postfix, from userid 425415) id 5C00119149D3; Thu, 1 Sep 2022 15:59:13 -0700 (PDT) From: Stefan Roesch To: , , CC: , , Subject: [PATCH v1 10/10] btrfs: enable nowait async buffered writes Date: Thu, 1 Sep 2022 15:58:49 -0700 Message-ID: <20220901225849.42898-11-shr@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220901225849.42898-1-shr@fb.com> References: <20220901225849.42898-1-shr@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: CGABbtso-PWS5XHGnmD6NEo-kzFwgqWx X-Proofpoint-ORIG-GUID: CGABbtso-PWS5XHGnmD6NEo-kzFwgqWx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-09-01_12,2022-08-31_03,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Enable nowait async buffered writes in btrfs_do_write_iter() and btrfs_file_open(). Signed-off-by: Stefan Roesch --- fs/btrfs/file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index b498541228ca..984225a92207 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2107,13 +2107,13 @@ ssize_t btrfs_do_write_iter(struct kiocb *iocb, s= truct iov_iter *from, if (BTRFS_FS_ERROR(inode->root->fs_info)) return -EROFS; =20 - if ((iocb->ki_flags & IOCB_NOWAIT) && !(iocb->ki_flags & IOCB_DIRECT)) - return -EOPNOTSUPP; - if (sync) atomic_inc(&inode->sync_writers); =20 if (encoded) { + if (iocb->ki_flags & IOCB_NOWAIT) + return -EOPNOTSUPP; + num_written =3D btrfs_encoded_write(iocb, from, encoded); num_sync =3D encoded->len; } else if (iocb->ki_flags & IOCB_DIRECT) { @@ -3755,7 +3755,7 @@ static int btrfs_file_open(struct inode *inode, str= uct file *filp) { int ret; =20 - filp->f_mode |=3D FMODE_NOWAIT | FMODE_BUF_RASYNC; + filp->f_mode |=3D FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC; =20 ret =3D fsverity_file_open(inode, filp); if (ret) --=20 2.30.2