From patchwork Fri May 19 09:35:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13248021 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 5849EC7EE29 for ; Fri, 19 May 2023 09:36:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6645280003; Fri, 19 May 2023 05:36:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DEFAE280001; Fri, 19 May 2023 05:36:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C905F280003; Fri, 19 May 2023 05:36:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B16DF280001 for ; Fri, 19 May 2023 05:36:01 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6BD6F406ED for ; Fri, 19 May 2023 09:36:01 +0000 (UTC) X-FDA: 80806498122.20.318A2AE Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf22.hostedemail.com (Postfix) with ESMTP id B578CC0010 for ; Fri, 19 May 2023 09:35:59 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=oyB5ENrt; spf=none (imf22.hostedemail.com: domain of BATV+aecf67361b95543ec79f+7208+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+aecf67361b95543ec79f+7208+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=1684488959; 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=C58xAMXMWyHPUrJzlledIWUNnBNJDxIHqrA6uNazQYQ=; b=LA1nBUgiqiA+0MwSYnDRy4/TIgw1tt1VKL48kW8UXOuLbEcGYO+gaWMZ3tEc8FD8JsfVCc ruky3lQWN9vOtdnaZMLT2llX9BwxvmQQlL9A5vvtO4TPtwzwg9y1Kp077hjgj6fvlueG50 1gVqVfxyoq/+gYX3r+S319I6YoEGzWU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684488959; a=rsa-sha256; cv=none; b=F+p7xKv3oHYSP4C8KrNWJwc7H6pkYP5cAIr3zo3A2lWEHB2VOt1OAwvtobniSq2AgUr8aU cNIYpCXhxwVb/C2KEOgw72KDrMj7lGQQgcTyqWegEp4aAswbQnCwWfLtG2HW7lI+UBXtq+ WedxHfSeNIkrVo7RSJYmZPUxpRgTWEM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=oyB5ENrt; spf=none (imf22.hostedemail.com: domain of BATV+aecf67361b95543ec79f+7208+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+aecf67361b95543ec79f+7208+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=C58xAMXMWyHPUrJzlledIWUNnBNJDxIHqrA6uNazQYQ=; b=oyB5ENrtpS3oCMIV1tdQqugXkU sJw9tWTnvGCKGzKa9RpoMfHRvUYSVzT0RXiuWCYAumP4uyadSzytLs+6N80qNj9Wx28cGiAr5gPRY KzRMEKVFBYf9VfLGcLm7M27cD+XoFkxkgCSSKqQHZ2uH/AqoUIgSHz/wG2IogiCKWS/kp20FiYsw9 xyQ9CaQyFtSTLVG/mgOLVL5dwvmUwJri/zQlIjlsjwVm/9D6Z4u0xvXzVPX25fHmcOK0AEKAUd6wR 5Pyq49d9NQSlXRan5UmQ0bHDH+gbH8e7O2mZ27adQFXSM/HW3HE7/4rluA8VRqK7aYy04HDSPH9D2 6F0846Dw==; Received: from [2001:4bb8:188:3dd5:e8d0:68bb:e5be:210a] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pzwWF-00Fjaj-1T; Fri, 19 May 2023 09:35:27 +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 (open list:F2FS FILE SYSTEM), cluster-devel@redhat.com, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 01/13] iomap: update ki_pos a little later in iomap_dio_complete Date: Fri, 19 May 2023 11:35:09 +0200 Message-Id: <20230519093521.133226-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230519093521.133226-1-hch@lst.de> References: <20230519093521.133226-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: B578CC0010 X-Rspam-User: X-Rspamd-Server: rspam11 X-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OsW2QMhpGR3fuxc421edcYKktonE4gGLxwb/PnSUTbJUsM7tj+g0xXu9tXHfudQIA3HlGxie9mfstVQG8qNsHDajGn6/WoZmMHAQAGIEMW9eRlyyxSyRw5pLGcaoVjz+rJKpm/WzP/QsvVvG4UhnBKddte4kAobL6ouBxYqn7BPJ9cFZqW1DMInmkNlQTjZWPZH+uKIsZOb4hmfNELf3mYt/ZALncp+dgeDtzRsFBh3hmskyiR4HWa5Hj8EiQWTlYxzQhQFO/LAmLs2g/bM2nKSnLMuUev2CbMkVrGE4pD8Pu1w4turfHJYEWxvE9bTbLBgHiZ4vdh+TFtszJccXTxd66mNPKVqI+ROjaMTmEZ7F9e/I/8/uqIzb26rwbWNMZZ91SWLPCzIUe4c2U//ecp3Hz8uas1e4KMzTHRFeSY8tYNW6GteZSVhtUt3IA== 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 --- 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);