From patchwork Wed May 24 06:38:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13253303 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 4C495C77B7A for ; Wed, 24 May 2023 06:38:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0CCB6B0072; Wed, 24 May 2023 02:38:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4669900003; Wed, 24 May 2023 02:38:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0DD46B0075; Wed, 24 May 2023 02:38:33 -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 920066B0072 for ; Wed, 24 May 2023 02:38:33 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6124B4089D for ; Wed, 24 May 2023 06:38:33 +0000 (UTC) X-FDA: 80824194906.12.E649CD6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf28.hostedemail.com (Postfix) with ESMTP id B0344C0003 for ; Wed, 24 May 2023 06:38:31 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ke0+rXm1; spf=none (imf28.hostedemail.com: domain of BATV+8349dc162fb675e8d54f+7213+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8349dc162fb675e8d54f+7213+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684910311; 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=i1RqdoBmGpSI4AoluhMWSmKwEQoLh7rSlvwZtq3xMpc=; b=kEGJPq0pw8CFW5Bqkb5XtA7GgJGB3UF9MzMx9v3uxjK9CTA9ZALNZSbQj/UrXqSIU4zmna W/FypHRw+AuV7/YKfTt2hkrUc1a5d0LccuAup8DabxGEqN8LlgJQwFqVmvNMbZkeVJwDW/ haPme8KnEm0x1v3z1DZlGqYUz4onqhs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684910311; a=rsa-sha256; cv=none; b=QcKcBl3ev/T6oKNZm10QWetJ9SlLqhPXySiJYqFA+OfeJs//NhYryXLkgGmvjhs6PZLQEd nyv1lFqhguMKFCcenTuoE+UvWcEcKWIKBe+goXx5xflEMPOUERfqRFisiiaGuuD2K/iqAY yqZ/AkxHwYM+6gx7JyB2PAN0Ye2dQxc= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ke0+rXm1; spf=none (imf28.hostedemail.com: domain of BATV+8349dc162fb675e8d54f+7213+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8349dc162fb675e8d54f+7213+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none 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=i1RqdoBmGpSI4AoluhMWSmKwEQoLh7rSlvwZtq3xMpc=; b=ke0+rXm1I+H4jWkGSmB5Pvjfls Ax469rTeh6NFooGWSj+OyR/gQOOCNXmTcHB//65B4AAeTWh+8v+kOnTf83phdlbLYQANm/xrelpKO RPEcRgSn5ZizNYXFRdqRNbcCBJoc/CloJeJBhecvABTLDE00F5dvyIHhM6+UnqHl3jIAza8/mg3No RtjM/skaLWEkdssyDF1XBD8OVIZXSCWSZQwuR7WUjIhOHEVNyPqGJR5SC/DSSjJfkwfGUPruKxAzS 4ZZSQ6AZRI0e9yGK0i67PwJ4CoUjusCveYX70o0pH4iDQMSa7dPAZ0aeXl7tzo1DZvnjxd5jcRdXu z+zNBwCg==; Received: from [2001:4bb8:188:23b2:cbb8:fcea:a637:5089] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q1i8a-00CVes-0r; Wed, 24 May 2023 06:38:20 +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 Subject: [PATCH 02/11] iomap: update ki_pos a little later in iomap_dio_complete Date: Wed, 24 May 2023 08:38:01 +0200 Message-Id: <20230524063810.1595778-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230524063810.1595778-1-hch@lst.de> References: <20230524063810.1595778-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-Stat-Signature: y3xqs1w7ar1e51rqgd8w8s7fw36wmf5y X-Rspamd-Server: rspam10 X-Rspamd-Queue-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ZPDPHHlBibqwwA1Bg41+5Rlgqjp1LyRo4gZ3XCZA1XwzV+v7PDgEERjo19QzVPbv4xMdioPVQouQzN0lx12bFQCQnXPTzqP/fY98bN7ge0q/A8q8dGP3wXN/3jp8tCOYSowbHWwd9Lyp2kEwPpVyh6sPl0xzZTa7ZqlfBVG/Ql0Yfqg3jhKpfOC+0PYN38mvqW5CfzcCh+6RCozIuZp/UU1MnHwTE31ou+mFxih9J5SKKtsJtpcuWXnBgoMqjujik3kpWrACLHulWSMr0oEsmA7UdM0vyxhnNKBkVhfv4KJgp5BwYgoPlnqttJEUlF2z1rQeQX9M+++KhUJHlmpPrH8k4tsi2g3qL8fevXdujKVzelhjCXAyWRDNqBjMqAaekuihCrn2596dOeB1YUM5cqYGNpILixHAJ6rZu2YndHQKm4C3pfIIC8DGPGUmaJqTfXORk85MblN7ilLx7A83YagNsiBVLJR0xk3A= 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: Darrick J. Wong Reviewed-by: Hannes Reinecke --- 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);