From patchwork Wed May 31 07:20:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13261550 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94F9AC83003 for ; Wed, 31 May 2023 07:20:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 093676B0078; Wed, 31 May 2023 03:20:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEA7B6B007B; Wed, 31 May 2023 03:20:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D14676B007D; Wed, 31 May 2023 03:20:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BFEE86B0078 for ; Wed, 31 May 2023 03:20:29 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 90C2880253 for ; Wed, 31 May 2023 07:20:29 +0000 (UTC) X-FDA: 80849702178.08.8C421B2 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf07.hostedemail.com (Postfix) with ESMTP id E925B40014 for ; Wed, 31 May 2023 07:20:27 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ngxKf22N; dmarc=none; spf=none (imf07.hostedemail.com: domain of BATV+b81a8c9a6d22e8bb2302+7220+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b81a8c9a6d22e8bb2302+7220+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685517628; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1AhsMC0b8Le+Qj8+/F9cJR6e5GLVWYekas+17NCVqqI=; b=nbxfUWeYHogLncD1RA3TrHT7ph24XyFlLyYuMvJKzJM0Dy2KyYYYaS8TfRhwKMGKvG3+ji Oxn5mJDdkH1Gby/iXSG3dLa2hr3r/YUpFINPUSfsnO2yVmMV5Itlrmo7EmVsXk9lir6Iov EGK8HrUhZrywHffeJiTlrTleLNflHuw= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ngxKf22N; dmarc=none; spf=none (imf07.hostedemail.com: domain of BATV+b81a8c9a6d22e8bb2302+7220+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+b81a8c9a6d22e8bb2302+7220+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685517628; a=rsa-sha256; cv=none; b=K583mdt+Q9bUUTCZ82VMtPEt4xVcPeiVXcCbshFpjNPNVyLLm7yefJIB3o22Pxyj+GiHR6 LmVXRODQcAnnRRiplddb1BSfQFvG2sAGP6L1TY9iskZ0N7HW1nb1C2HosQ8THvB3htA3aq umY1DKc+A4vHlIoJtpCV3yM+biQApyA= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=1AhsMC0b8Le+Qj8+/F9cJR6e5GLVWYekas+17NCVqqI=; b=ngxKf22NWcVmXxqJwcEfwC+j8T 3PxkmTMDjWxvvbR0duw8sA22hBD8npF8M7zy6uMP4A5nP81zq24egxiseYxIct9QT3BCtbnaev2MP wbiG/KzTwrwXiTebokTJ7zF2jRnxdAYau+XBec+F7XpGZX21QBO/OVfktTd4rlLpzooJH46MVsmsK +e4Tx0iJl2vZNXf3rTUvEhj2U+bq4yTQ5Rorj9IL8ZzUYJY9U+Zj+4quc3/7Yk+xX4BT5iyozg9is oymt/Or6TlEeT9TsG94njHW/hepEKG1n0Fi1TB0ymGUOgiWMRRS2N8SqiUunjzPtuqt/z9Padv5X7 cRckgdNw==; Received: from [2001:4bb8:182:6d06:f5c3:53d7:b5aa:b6a7] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q4G7y-00GPht-1z; Wed, 31 May 2023 07:20:14 +0000 From: Christoph Hellwig To: Matthew Wilcox Cc: Jens Axboe , Xiubo Li , Ilya Dryomov , Alexander Viro , Christian Brauner , "Theodore Ts'o" , Jaegeuk Kim , Chao Yu , Miklos Szeredi , Andreas Gruenbacher , "Darrick J. Wong" , Trond Myklebust , Anna Schumaker , Damien Le Moal , Andrew Morton , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, Hannes Reinecke Subject: [PATCH 2/8] iomap: update ki_pos a little later in iomap_dio_complete Date: Wed, 31 May 2023 09:20:00 +0200 Message-Id: <20230531072006.476386-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531072006.476386-1-hch@lst.de> References: <20230531072006.476386-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-Rspamd-Queue-Id: E925B40014 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature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8K+VnPOv8CXwOAxwXNMJd99juouse+h6jektkxk0EHLpBmL+Up89kZ+HPRjdU6kZyCjGwG3iXoYAf91Z5jDt/llO2TSKHzWRhLByR2ByAq5iIaILB76Hjrao4xjehDtlvcv84jnzQzEtNeUp2AJ/5Y6HzImuVhg4RarV8qtmmW0Q+jPkNHb51PPmXuR0b4yxI5TK6f3QAWSlK1xL5rSb41RiJLyjJ/mvH1zzA59jMpbkwhXxqdZMm4xsri8hj1QLgv3JRC51KaB4SJOnen8twXOHqpnZ10mHpish+idOSPIk+AAi4vNOIw8MdxoYrB5ByJjmHLUtliBEZnYDbSRjdxPXkACI69gcoo6NOf5UECh5PzePELq6L0Upy5VrdfQJaRzxLX8AIDnBQCPP8nJ3jx1hyWs5GbMbjaQMY60g82OEbsSZFIP60r3c3XPGdus2m5deJpMAkNy8am9NSU0QwbZ0aOx0pU0jB0= 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: Move the ki_pos update down a bit to prepare for a better common helper that invalidates pages based of an iocb. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Darrick J. Wong --- fs/iomap/direct-io.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 019cc87d0fb339..6207a59d2162e1 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -94,7 +94,6 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) if (offset + ret > dio->i_size && !(dio->flags & IOMAP_DIO_WRITE)) ret = dio->i_size - offset; - iocb->ki_pos += ret; } /* @@ -120,19 +119,21 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) } inode_dio_end(file_inode(iocb->ki_filp)); - /* - * If this is a DSYNC write, make sure we push it to stable storage now - * that we've written data. - */ - if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC)) - ret = generic_write_sync(iocb, ret); - if (ret > 0) - ret += dio->done_before; + if (ret > 0) { + iocb->ki_pos += ret; + /* + * If this is a DSYNC write, make sure we push it to stable + * storage now that we've written data. + */ + if (dio->flags & IOMAP_DIO_NEED_SYNC) + ret = generic_write_sync(iocb, ret); + if (ret > 0) + ret += dio->done_before; + } trace_iomap_dio_complete(iocb, dio->error, ret); kfree(dio); - return ret; } EXPORT_SYMBOL_GPL(iomap_dio_complete);