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 0E013C3527C for ; Tue, 26 Apr 2022 17:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351089AbiDZRrR (ORCPT ); Tue, 26 Apr 2022 13:47:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353104AbiDZRrN (ORCPT ); Tue, 26 Apr 2022 13:47:13 -0400 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE46E182B12 for ; Tue, 26 Apr 2022 10:44:04 -0700 (PDT) Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23QGQXa7011627 for ; Tue, 26 Apr 2022 10:44:04 -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=jZ8zm1AxxdEMBw4Xyg+B8XIbvk32PCxpRIjKZ5MQxFk=; b=XbdBQubfBl2KLFaneN5G4B++9sQ3awWKiyTV7p3ugdPM0JE+ivN4kAR+or/3aDhsAHJ1 aRBQbpXdBS1pGqz0JVQG4ReEZzRhKg7niYZaYAVEMaNjqMtavkbUV5XiX4bX0O2+23pM Td2DvaFFlDE/k+ggdGov/FhHRV5PwdSeKBE= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3fmeyu3nxj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 26 Apr 2022 10:44:04 -0700 Received: from twshared13345.18.frc3.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Apr 2022 10:44:03 -0700 Received: by devvm225.atn0.facebook.com (Postfix, from userid 425415) id B702BE2D4869; Tue, 26 Apr 2022 10:43:40 -0700 (PDT) From: Stefan Roesch To: , , , , CC: , Subject: [RFC PATCH v1 11/18] xfs: add async buffered write support Date: Tue, 26 Apr 2022 10:43:28 -0700 Message-ID: <20220426174335.4004987-12-shr@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220426174335.4004987-1-shr@fb.com> References: <20220426174335.4004987-1-shr@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: FcncllD5dYbCWep0RV2ZWa2l350DdFEA X-Proofpoint-ORIG-GUID: FcncllD5dYbCWep0RV2ZWa2l350DdFEA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-26_05,2022-04-26_02,2022-02-23_01 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org This adds the async buffered write support to XFS. For async buffered write requests, the request will return -EAGAIN if the ilock cannot be obtained immediately. Signed-off-by: Stefan Roesch --- fs/xfs/xfs_file.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 6f9da1059e8b..49d54b939502 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -739,12 +739,14 @@ xfs_file_buffered_write( bool cleared_space =3D false; int iolock; =20 - if (iocb->ki_flags & IOCB_NOWAIT) - return -EOPNOTSUPP; - write_retry: iolock =3D XFS_IOLOCK_EXCL; - xfs_ilock(ip, iolock); + if (iocb->ki_flags & IOCB_NOWAIT) { + if (!xfs_ilock_nowait(ip, iolock)) + return -EAGAIN; + } else { + xfs_ilock(ip, iolock); + } =20 ret =3D xfs_file_write_checks(iocb, from, &iolock); if (ret) --=20 2.30.2