From patchwork Tue Jan 14 16:12:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "hch@lst.de" X-Patchwork-Id: 11332637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BDA46C1 for ; Tue, 14 Jan 2020 16:13:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 38AEC24655 for ; Tue, 14 Jan 2020 16:13:22 +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 38AEC24655 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4475C8E0009; Tue, 14 Jan 2020 11:13:08 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 2,0,0,b4fb818026a648d3,d41d8cd98f00b204,batv+ea884c299640eab8340e+5987+infradead.org+hch@bombadil.srs.infradead.org,:linux-xfs@vger.kernel.org:linux-fsdevel@vger.kernel.org:longman@redhat.com:peterz@infradead.org:tglx@linutronix.de:mingo@redhat.com:will@kernel.org:akpm@linux-foundation.org:linux-ext4@vger.kernel.org:cluster-devel@redhat.com:linux-kernel@vger.kernel.org:,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2897:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3871:3874:4321:5007:6261:6653:10004:11026:11473:11658:11914:12048:12114:12160:12297:12438:12517:12519:12555:12895:13069:13311:13357:13894:14096:14181:14384:14394:14721:14877:21080:21324:21451:21627:21990:30054:30070,0,RBL:198.137.202.133:@bombadil.srs.infradead.org:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,C ustom_ru 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 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( } 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( /* * 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 = IOMAP_DIO_RWSEM_EXCL | IOMAP_DIO_SYNCHRONOUS; + dio_flags = IOMAP_DIO_RWSEM_EXCL; } else { if (iolock == XFS_IOLOCK_EXCL) { xfs_ilock_demote(ip, XFS_IOLOCK_EXCL);