From patchwork Wed May 31 07:50:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13261639 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 BAD40C83005 for ; Wed, 31 May 2023 07:50:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7DB666B0075; Wed, 31 May 2023 03:50:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76358900002; Wed, 31 May 2023 03:50:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62AA16B007B; Wed, 31 May 2023 03:50:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4CECB6B0075 for ; Wed, 31 May 2023 03:50:50 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1017C80290 for ; Wed, 31 May 2023 07:50:50 +0000 (UTC) X-FDA: 80849778660.01.03F2686 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf19.hostedemail.com (Postfix) with ESMTP id EB3CE1A001F for ; Wed, 31 May 2023 07:50:47 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=uBZ06PKZ; spf=none (imf19.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; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685519448; 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=chpTIhAIF6N7Dr6b1nzszF+TXvxv6hW4PAIQbx8EQsaundTxl3aJgqiXGsOK4NTQ7J5p4b Axol5a20uJmDWtitQzgBS+Mjv2yNqBKsZZlEoRQiDRut3+BIhU+M23T+tL1nYyJj6UnzT3 C4RCebAPg5Tlc5D55QvDqMuV6tCa8IU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685519448; a=rsa-sha256; cv=none; b=pjsFgMS0RceOZBnKOabmPKbqjZRc7vcK9ejXh6svb6UB+j9ndLcNaYFB+SX18hZOf+8saa 8002erAMGadR88f6PFa+5zq0Qu7bv0HHxnCkPcCoh0jxhHGUQY8A204hG7XFtWddjq/Vhb WIc9YnEnWimS2yh+69aQQnm+ZWdV4YM= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=uBZ06PKZ; spf=none (imf19.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; 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=1AhsMC0b8Le+Qj8+/F9cJR6e5GLVWYekas+17NCVqqI=; b=uBZ06PKZz56TQZNDL5Rj3l6Ywk 8hDrBqiUGVvcnLZ96e4rBnJsLigvjBlDrb+OYi7cBk6/wm2sE/xqKs9swjM2jJO8KETrxs76khtQn d4fOq3XMAndT05YkXMtMyms1Rsmq2g6bjt9chnJpDEJD189AC84uz33pb6ILpz/E0Uu5VJpMDXTn8 011Ez/C8z4tcneQxI80elWP3wXIRS7ELykiDvQUu4E0BsYMRyDtEDdmmAoHwPe65nRDwYtKcQRJ5P /46jPJjoSfx7uXd345WSwgi6WauS6l+vXHFNg0/2Uh4xvlWFw/Q0ltbf1G6Q7gUX0QwJ4yFOYjWg8 hmquvfyA==; 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 1q4GbK-00GVnQ-2g; Wed, 31 May 2023 07:50:35 +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 02/12] iomap: update ki_pos a little later in iomap_dio_complete Date: Wed, 31 May 2023 09:50:16 +0200 Message-Id: <20230531075026.480237-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531075026.480237-1-hch@lst.de> References: <20230531075026.480237-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: EB3CE1A001F X-Rspam-User: X-Rspamd-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yFZ6wcW7qu0SIGNXAWNo88G1wr4vNPrxs72wLclBskj+vRw4rIT32OnR36DjhG2ANLIMo1E0vmiJVeh9HCN0oevVSiIdknt0xL6Br1lLCnVG2oe00a+IGx9pqs1RP40tpxFjJIbyEDVHGkSxQRwTnmD/CSxcShR37p9J/qCOKtM12FOiOJzsNDNHKvnTuEXOOERDitOcYHqmkylSKs++OviodAQauxuZYHGyPV2XvCIfAW9iYkMbUBUlbRmQdyCDeQJEd2yHHOGjg4CIA8nLn+YG/Lb2Z/Xwhhu/D0jFejHJVS61P9ceEaW/tnKje1sX+2g4e5cI7uN5XLeL3Cc3ZBNwgvNQQQqRoRd6FFW0ouhaivSQSOoqQDcHoU64ghTv6H4ElRSBLn9/lbbHBO2JWn3dk+pQ4p1usxpSifLMrI3fxXl5XCTAtwBxZU59HSKftG/MD0dgUQizFU2mNRUNqkRfOFCjSlNsKtSz6lyb5LKdXjOykCu5NrNQaGIZ1osZ4OfwQEyBDf8EWvc4WtEnHo0pedF37z6sAA0c4ReHo7AjU+rawoboa8rxBW7a4JHKMcwehH20LkwfhILswKxFRtpsRCb 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);