From patchwork Fri May 19 09:35: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: 13248024 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 8F776C7EE26 for ; Fri, 19 May 2023 09:36:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 25950280006; Fri, 19 May 2023 05:36:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E19E280001; Fri, 19 May 2023 05:36:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00DAB280006; Fri, 19 May 2023 05:36:06 -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 DED44280001 for ; Fri, 19 May 2023 05:36:06 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B6DA2C095B for ; Fri, 19 May 2023 09:36:05 +0000 (UTC) X-FDA: 80806498290.21.F7F5412 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf07.hostedemail.com (Postfix) with ESMTP id E37724000E for ; Fri, 19 May 2023 09:36:03 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=GayNG3kz; dmarc=none; spf=none (imf07.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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684488964; 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=DWCBIuCWrEPUSgFUMsFJ6qSq1T5QDjJd5vFpRCChJ1w=; b=mgVNwDbO03lkKa0LBOfiTno7HC46fs18X8cDRZsvT7D24E0SZliyrjzj65huMZIymlGndp aCN/xPDeB1LqopRFliXSmDPpF+zHxT8nnO/zy3XRz+LnC6VKKLcORwKZuOuXujY9QPTLr9 BXGlmKSicIxZT8+E2TnirNNA2bNOBQE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=GayNG3kz; dmarc=none; spf=none (imf07.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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684488964; a=rsa-sha256; cv=none; b=Uwghz/1VTgkjpPVmigw+pYLRFsDxG3PfDNTyx3WV2acpNitlqNlHRX4t1ApWlxgX6hSBwW bYzlvPUfrQyj1lQVSYWJm7WuTlCBveSeqtOIiS3VI2QsY+0mqdDL69czK3ZzrwOhE7PMvQ qf9b7t/Ld6/Wid55r8LHcQinfoPA1Xo= 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=DWCBIuCWrEPUSgFUMsFJ6qSq1T5QDjJd5vFpRCChJ1w=; b=GayNG3kzJFJ5dJ+3pyHdgpJaHg Vg+D3WJSisJRAfKh4FdM+kMULiHBkVK2JlSjPpe6AWhhM9TnhNcnVYwVNicVKsW2D6CwQtiNr4GbI ifi8oL59NNJcPyuNM4H5lL3BQg0kUH1IUPhrqcRX4x0gkGHePahAMpgU+OMoye7IWbL1i4P4N0K7d hPveIYGdIaP1exiwrksrwwox3ggk+6PoAmRpABmAJW0vLpX170W8n4+WiyOMWiWdUV0KUHViDPR2V y4iTj0Am5OrXwsAxT9LSL8UdxWNyTm0g69FXTbp/zKBR4iorevNKqz7EDBD0kG/pHeghxQmsCy7c1 7dhC9L+g==; 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 1pzwWZ-00FjgM-1F; Fri, 19 May 2023 09:35:48 +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 08/13] iomap: assign current->backing_dev_info in iomap_file_buffered_write Date: Fri, 19 May 2023 11:35:16 +0200 Message-Id: <20230519093521.133226-9-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-Server: rspam09 X-Rspamd-Queue-Id: E37724000E X-Stat-Signature: ffx5cgng63kh63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1WhpegXu7TnBeUj4OfWwPuwTbmFAmjC9J9IRtx+sXbg/YoKgy+lw8SJkIZ59mKcKmxd4Tl4Y253o5bZuj+5gFhynVFtm5ILGtKYdnnnjk0fBhQn41M21ESTcyOwq3Ll2v9K9zRJSqqs0vc+Nzp7a0tSzgU0yBH+hknDr5jDuKAo/GOs3lR+I50c7GnTLg7yMsuRyPBQHd09jDDlCvczMSkyoHW1TVDaLoHIkTAnecTCtIMiKUbMQJQhDxgl9eSEgMOvoqrntYA24JXip0zeorhrX7aKb44cM8GheIoRdmcIwTENHrFbNrDkT6+ilzKIvO4ExIPAMXHoEG7ziCQl7qPXO4nnMNSx+RmH7DI5VZNXD9Cn85wb9Co9YekANZ8IctzJds9cbrjJRAMbjH5qs2IFjBppwteDHif6DEKHEPtg+JefYpwlzzWfTw== 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 assignment to current->backing_dev_info from the callers into iomap_file_buffered_write to reduce boiler plate code and reduce the scope to just around the page dirtying loop. Note that zonefs was missing this assignment before. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- fs/gfs2/file.c | 3 --- fs/iomap/buffered-io.c | 3 +++ fs/xfs/xfs_file.c | 5 ----- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 499ef174dec138..261897fcfbc495 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "gfs2.h" @@ -1041,11 +1040,9 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb, goto out_unlock; } - current->backing_dev_info = inode_to_bdi(inode); pagefault_disable(); ret = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops); pagefault_enable(); - current->backing_dev_info = NULL; if (ret > 0) written += ret; diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 550525a525c45c..b2779bd1f10611 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -3,6 +3,7 @@ * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2016-2019 Christoph Hellwig. */ +#include #include #include #include @@ -869,8 +870,10 @@ iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *i, if (iocb->ki_flags & IOCB_NOWAIT) iter.flags |= IOMAP_NOWAIT; + current->backing_dev_info = inode_to_bdi(iter.inode); while ((ret = iomap_iter(&iter, ops)) > 0) iter.processed = iomap_write_iter(&iter, i); + current->backing_dev_info = NULL; if (unlikely(ret < 0)) return ret; diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index bfba10e0b0f3c2..98d763cc3b114c 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -717,9 +716,6 @@ xfs_file_buffered_write( if (ret) goto out; - /* We can write back this queue in page reclaim */ - current->backing_dev_info = inode_to_bdi(inode); - trace_xfs_file_buffered_write(iocb, from); ret = iomap_file_buffered_write(iocb, from, &xfs_buffered_write_iomap_ops); @@ -751,7 +747,6 @@ xfs_file_buffered_write( goto write_retry; } - current->backing_dev_info = NULL; out: if (iolock) xfs_iunlock(ip, iolock);