Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5339501rwd; Tue, 23 May 2023 23:40:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64/xbQkz3KSKGPL94CbyVb4bAQZmYajVGW4FPdfTvGjbqJN0xw3z8tinenvvofZO585++y X-Received: by 2002:a05:6a20:8f08:b0:eb:e2eb:d7ec with SMTP id b8-20020a056a208f0800b000ebe2ebd7ecmr20206689pzk.17.1684910457673; Tue, 23 May 2023 23:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684910457; cv=none; d=google.com; s=arc-20160816; b=I6kJHEkZ4J644W9vVFLEog37w8l7sLilM2rD1xDA/vJfkZCewEkAOHURUYfEuemyIz GWuzSyMq8eye+vkNxjpbFEU+n6cBY6uFcenEJXF87/D85RGmSclfLw8YQRMbjb5bLuh2 5zTFJDcFX0WmHCBy8OWIYPOZstICB+qQ2ImBzVUajkzTs3Yzk2PgkAU437HUK6y7O5eu eGU5Sjnyp0cTn7UHt86VnxN/r4uRlJgsEw1ByV0DWYYRUmqqFQgYQOxEZ17nl3aIPKHj i2emrAsWrEsHSd5PietpCxow5zdhjTvmHnxKd8CBA4jLvEl/NiC6sQG5BkjifTaqH+0l 1edQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i1RqdoBmGpSI4AoluhMWSmKwEQoLh7rSlvwZtq3xMpc=; b=zXTN8ie+RdZjKOZIHejlL2iqmVxk0vRwBhE/0eg6I30uSBF4oCRTU0ES+hpdTWfKNK 6yZg66NgO3cAouS53EojP8joNnThlQapQbSIiIU4wNPhpf2So3Q0lb8KMxIBipUxU2/K qeFD2wFaCanNLGCA+vMHyLfJAS2ucZCBPu57uUgvULOurYdbVtDQCeOAEHFfwqbAsA1/ TfyOYKZk8xlaflfHnDh+PABqRJSLfuT+/AS3+Q2pmFRcVQ/bVSJmUfUn71mjCuaQ95ir IfL07n4XAnbv+pZHwCq/BEODNbKBjP6cqWe9MZdzH2F8+sGIz9A9qRRnVrh/mU6qblnY WXOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ke0+rXm1; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a637b50000000b005285dfbf364si592930pgn.262.2023.05.23.23.40.44; Tue, 23 May 2023 23:40:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ke0+rXm1; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239582AbjEXGir (ORCPT + 99 others); Wed, 24 May 2023 02:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239712AbjEXGia (ORCPT ); Wed, 24 May 2023 02:38:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA2C189; Tue, 23 May 2023 23:38:30 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- 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); -- 2.39.2