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 X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B702C33CB7 for ; Tue, 14 Jan 2020 16:13:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 60FAE24655 for ; Tue, 14 Jan 2020 16:13:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="NRBTU/Aa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60FAE24655 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 497128E0012; Tue, 14 Jan 2020 11:13:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4475C8E0009; Tue, 14 Jan 2020 11:13:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 386B68E0012; Tue, 14 Jan 2020 11:13:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 1A3CE8E0009 for ; Tue, 14 Jan 2020 11:13:08 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id DA42140E1 for ; Tue, 14 Jan 2020 16:13:07 +0000 (UTC) X-FDA: 76376734014.14.part56_3867fcd44e226 X-HE-Tag: part56_3867fcd44e226 X-Filterd-Recvd-Size: 3766 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 16:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=my8Ph2mEg6LXHc/rF64e/o08bhUX729CzcwPRovaKLM=; b=NRBTU/AaZu+sQFQZ4IGjdaLih2 EC4rECXtbG5PEOMagJiggEc3WbBOSbipx3iig1QOJAwDPAlfVB+txKFHjxxRC0lYrmI2UJ19gBls/ l1oDnXE081oxYp5WpcpzNqes3e7E8reV2lB3w/gXv+Lj+ru4uAknlB/WmjXbDBuSHfI7YU2C3372X mrEwnRdyiNFu6tVXXVjl93yPQQ1HnkKc3OwSENOSPt8u1307+0QFUBgKt/cGvmnt30Cdo3cBf/vHG NqR2eUe8B/zgTTP8n+hDOS5sfgXiHDhJAAlP9qRmGwVopD4rxV97jLr3c/ez20Em0fScdTyhSxAb6 IF26LMGQ==; Received: from [2001:4bb8:18c:4f54:fcbb:a92b:61e1:719] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1irOoL-0000FW-71; Tue, 14 Jan 2020 16:12:57 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Waiman Long , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Will Deacon , Andrew Morton , linux-ext4@vger.kernel.org, cluster-devel@redhat.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 11/12] xfs: don't set IOMAP_DIO_SYNCHRONOUS for unaligned I/O Date: Tue, 14 Jan 2020 17:12:24 +0100 Message-Id: <20200114161225.309792-12-hch@lst.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114161225.309792-1-hch@lst.de> References: <20200114161225.309792-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now that i_rwsem is held until asynchronous writes complete, there is no need to force them to execute synchronously, as the i_rwsem protection is exactly the same as for synchronous writes. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index d0ee7d2932e4..3a734ad4bb10 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -510,9 +510,6 @@ xfs_file_dio_aio_write( } =20 if (iocb->ki_flags & IOCB_NOWAIT) { - /* unaligned dio always waits, bail */ - if (unaligned_io) - return -EAGAIN; if (!xfs_ilock_nowait(ip, iolock)) return -EAGAIN; } else { @@ -526,14 +523,11 @@ xfs_file_dio_aio_write( =20 /* * If we are doing unaligned I/O, we can't allow any other overlapping - * I/O in-flight at the same time or we risk data corruption. Wait for - * all other I/O to drain before we submit and execute the I/O - * synchronously to prevent subsequent overlapping I/O. If the I/O is - * aligned, demote the iolock if we had to take the exclusive lock in - * xfs_file_aio_write_checks() for other reasons. + * If the I/O is aligned, demote the iolock if we had to take the + * exclusive lock in xfs_file_aio_write_checks() for other reasons. */ if (unaligned_io) { - dio_flags =3D IOMAP_DIO_RWSEM_EXCL | IOMAP_DIO_SYNCHRONOUS; + dio_flags =3D IOMAP_DIO_RWSEM_EXCL; } else { if (iolock =3D=3D XFS_IOLOCK_EXCL) { xfs_ilock_demote(ip, XFS_IOLOCK_EXCL); --=20 2.24.1