From patchwork Thu Jun 1 14:58:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13263979 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E793C7EE2A for ; Thu, 1 Jun 2023 14:59:45 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1q4jmB-0000FP-26; Thu, 01 Jun 2023 14:59:43 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1q4jm4-0000FI-9B for linux-f2fs-devel@lists.sourceforge.net; Thu, 01 Jun 2023 14:59:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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=1AhsMC0b8Le+Qj8+/F9cJR6e5GLVWYekas+17NCVqqI=; b=TIgkZaHuOGJTJd0cK2tPn4vidE ojhegD/ZPLxFWEB3z/o3C5tsuLlIq1INzmFPm7qAKXr/Gj6PDTuhWrTJti/3zs859VmN5ZMsELzEA dQCBSc35RkHexcehonFltsG3p61YRB2/R1Wzc5WoysBax+kP6vyCmV0oPrk0lN+S6Tvw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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=1AhsMC0b8Le+Qj8+/F9cJR6e5GLVWYekas+17NCVqqI=; b=jBvEnwWaOBZJsNjc5hYpacFqET rPcnRAHAlEdTRP6nVNKnUhpsDyH7MoVIVfhkPjZyZvd6Frxi7I28UNM39ApRnL4D5A1Wm6dAyFfF7 aO4x7iyE3eryLYKH4HuLwEYNxSSFa0+/JhrNqhEsUoOI7RDUP96bkaNljgNpw7g4zIVU=; Received: from bombadil.infradead.org ([198.137.202.133]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1q4jm0-008SYD-Qx for linux-f2fs-devel@lists.sourceforge.net; Thu, 01 Jun 2023 14:59:36 +0000 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=wiZK9iqy2Q2DgmztCycdzZFJYV +f+Z1EUaPp/WxVng7hKAlTugkvoijJtdaCd0abPoIux8/9iobGyPP3C6ZdxSo+5MDjs+QVxSsZ3Yw 3H/pO+bF6DsK8j6VvoAk02XyxLpv8r9mchlt36SS/V9hKI45pU8u3aID3Cuyz6NRbbOYhfrEEm6b1 NNHoLMnhvwSNrDWABgK8ExwUWqr924HfRyejUtySvIZe/Xw5vgaGGms+mTqdLK9GBRSnpE9VluHzD Eeh8qQMBY9tUVU6xoJPSMjm7g2W4rjDN+CjEc3/cLcIsyBTtm2CIz0MxYanPENl5SoUy/NTEUsg2H qg0aEunA==; Received: from [2001:4bb8:182:6d06:eacb:c751:971:73eb] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q4jlf-003w32-1z; Thu, 01 Jun 2023 14:59:12 +0000 From: Christoph Hellwig To: Matthew Wilcox Date: Thu, 1 Jun 2023 16:58:54 +0200 Message-Id: <20230601145904.1385409-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230601145904.1385409-1-hch@lst.de> References: <20230601145904.1385409-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-Headers-End: 1q4jm0-008SYD-Qx Subject: [f2fs-dev] [PATCH 02/12] iomap: update ki_pos a little later in iomap_dio_complete X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Darrick J. Wong" , linux-mm@kvack.org, Andreas Gruenbacher , Miklos Szeredi , cluster-devel@redhat.com, Ilya Dryomov , linux-ext4@vger.kernel.org, linux-nfs@vger.kernel.org, linux-block@vger.kernel.org, Damien Le Moal , Alexander Viro , Jaegeuk Kim , ceph-devel@vger.kernel.org, Xiubo Li , Trond Myklebust , Jens Axboe , Christian Brauner , Theodore Ts'o , linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, Anna Schumaker , linux-fsdevel@vger.kernel.org, Andrew Morton , Hannes Reinecke Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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);