Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp866716rdb; Fri, 22 Dec 2023 07:21:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSCVCg26YNdqjuVGI3O5Piupu2Fer1ZN/1DMXU+IRs8BIACbgwjnCavXHkI79d0rAx+J2u X-Received: by 2002:a17:907:90d5:b0:a26:98e6:74e4 with SMTP id gk21-20020a17090790d500b00a2698e674e4mr520420ejb.224.1703258474797; Fri, 22 Dec 2023 07:21:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703258474; cv=none; d=google.com; s=arc-20160816; b=1As5alzAl6K9ZhlU1VlAcbrv0MrybfQzh5Mo1f9HlzxeUiMC5dN3xv5EhCAlqlBypX eX+wJ2mlrJ6QhOanItWPnah9w/J8Iucs7jlAkhoWcw1HxGLZIQp8K2PqNt2xurspg/xM QqHQ1S3aZGDilAYErSfFbzcQiR4c6AM3eA/ljGtIjqKQpzL9eo4LO9WXLnmJ/lj7gc1c t8tE0e2ppovo2s0wbAC+rqpA7nQxG4Qmzo9TLGu0dL17quqZq4q7kQIk76fMCI2gKWB9 ENiTIuWF6JBKrnEUwgWseMeEOkiGbj4C1RrwdzKBAv9nBzHVUOt+Kozgjz8uMDUiJnFT 4k7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lixDX8ZESJjee4RWhykT/1y+dKD2DSRjw7efEsZauMY=; fh=hzpEVxJ05G9gyZL9WVyKgOEGxITvmFSuTcKyr2ByStg=; b=pLs+MV4hScSbQaVeR6thQoJIq1N782AFATAromMq/8T1oJJNzHp8P4ClwM05TRdntC GCNG2uBVQSLB66Dc3uaYXJIVHsVNUSovrMnC/yIcd556UP6YmcqhxCpKt6Hiqf8bzEuB 4pVs1rqJ1Th5PR6JR2PdhzQMhEblpOW7PwH6HJpB665zvNgjG7zah6J9j1ztmYvEhwbC UjGRVGL4c6XTVqJQ8dzU7bfS5cgxqKNyc79dIL58Jyp9EODAc//zd09mbbu7DDOQdnIa 0npkXJLvxGB+/fgb1rK8k+oUyPJ1kEWxFn3nnlqajBbykbjfwLBQUw2cEi8Hyda7Qr4+ p57Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=fr1wzmpg; spf=pass (google.com: domain of linux-kernel+bounces-9828-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9828-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d7-20020a17090648c700b00a2349eea52bsi1902783ejt.997.2023.12.22.07.21.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 07:21:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9828-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=fr1wzmpg; spf=pass (google.com: domain of linux-kernel+bounces-9828-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9828-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B248D1F2670F for ; Fri, 22 Dec 2023 15:13:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F29812FC50; Fri, 22 Dec 2023 15:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="fr1wzmpg" X-Original-To: linux-kernel@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F21A82F848; Fri, 22 Dec 2023 15:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org 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=lixDX8ZESJjee4RWhykT/1y+dKD2DSRjw7efEsZauMY=; b=fr1wzmpg3g1yRFa0Y9DqGv06Wk cfDoK78nyVATk2W00QiKsY/vi82udAF0M2pyy+Ay93XVwZPJE4qz+MVWOhvOnuXDUpB2cDR0YviWU pEa0p7C4tjXfPes+OGICWcueTOsQ06AIm0+bbjDoBE1CB0mmoXrZbVxR+vklmsbA8hsDQKSvi1pEy 26uOQbqYl11Ollia+yPhtCKAS7dsKtR+F/IMr9+yAhj597hdQxeg68obkW8aguZaJl/ZMU2OFxJjc N10rjpNyBKRSURZsWSof2IhpBNqPx+qHoW6tbAa3Vig8tLlTZDipLRaHFw1jenO2m6NAKArNjk9Ba 8eg37u/A==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rGh98-006Bcf-2W; Fri, 22 Dec 2023 15:09:07 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , Jan Kara , David Howells , Brian Foster , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Dave Chinner Subject: [PATCH 16/17] writeback: Remove a use of write_cache_pages() from do_writepages() Date: Fri, 22 Dec 2023 16:08:26 +0100 Message-Id: <20231222150827.1329938-17-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231222150827.1329938-1-hch@lst.de> References: <20231222150827.1329938-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 From: "Matthew Wilcox (Oracle)" Use the new for_each_writeback_folio() directly instead of indirecting through a callback. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara Acked-by: Dave Chinner --- mm/page-writeback.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 5c33a4a527b3fa..1ff444d5e4317a 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2559,13 +2559,21 @@ int write_cache_pages(struct address_space *mapping, } EXPORT_SYMBOL(write_cache_pages); -static int writepage_cb(struct folio *folio, struct writeback_control *wbc, - void *data) +static int writeback_use_writepage(struct address_space *mapping, + struct writeback_control *wbc) { - struct address_space *mapping = data; - int ret = mapping->a_ops->writepage(&folio->page, wbc); - mapping_set_error(mapping, ret); - return ret; + struct blk_plug plug; + struct folio *folio; + int err; + + blk_start_plug(&plug); + for_each_writeback_folio(mapping, wbc, folio, err) { + err = mapping->a_ops->writepage(&folio->page, wbc); + mapping_set_error(mapping, err); + } + blk_finish_plug(&plug); + + return err; } int do_writepages(struct address_space *mapping, struct writeback_control *wbc) @@ -2581,12 +2589,7 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc) if (mapping->a_ops->writepages) { ret = mapping->a_ops->writepages(mapping, wbc); } else if (mapping->a_ops->writepage) { - struct blk_plug plug; - - blk_start_plug(&plug); - ret = write_cache_pages(mapping, wbc, writepage_cb, - mapping); - blk_finish_plug(&plug); + ret = writeback_use_writepage(mapping, wbc); } else { /* deal with chardevs and other special files */ ret = 0; -- 2.39.2