From mboxrd@z Thu Jan 1 00:00:00 1970 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 721F4C4828D for ; Mon, 5 Feb 2024 15:32:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 361A96B0083; Mon, 5 Feb 2024 10:32:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 313296B0085; Mon, 5 Feb 2024 10:32:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18D476B0087; Mon, 5 Feb 2024 10:32:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E99506B0083 for ; Mon, 5 Feb 2024 10:32:52 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BCF4D40453 for ; Mon, 5 Feb 2024 15:32:52 +0000 (UTC) X-FDA: 81758142984.21.486B005 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id DEDDF140034 for ; Mon, 5 Feb 2024 15:32:50 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ai7It3di; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707147171; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CsHOpyyNz6zLdrRHdpKUhlbdO+IltU0fGAYIWwSsnME=; b=6Zr4CsYVTyAJJwmsEpvT/RDVRUr9t6ZEbpeAc3guro4jNMbqD6txdqiRMKkmpymzADntXM cX9Iladg3qnXX6CaUeeQmnMLW55bCPSazd88RWpwSxgqG6iTjduQiQd+/mPZVugqfOqXaR OW1SE2v3DleeQJEY0cZ2yO8b1djo4UM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ai7It3di; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf09.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707147171; a=rsa-sha256; cv=none; b=Xn+PizE5OTr+LZfi3ttK3Q/tqUOrodO4wSyvJehKuE2e9k2MtY4eY3d9yxG3z2mme1lH8T /pflQMU0ejx7phlfhBz/8/2N9CfBKFpmA0uBHati0o5XyQlqAnwXQbV8OfzIHgRJAX4X7W biYyIbG0Xp4O+gZVunk701MYLiF2Yrg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707147170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CsHOpyyNz6zLdrRHdpKUhlbdO+IltU0fGAYIWwSsnME=; b=Ai7It3diO6AcBju01RhHrnzy1iaVbV0c88leaiWeG2KpsuREK7GCCSJrUOZjjgrBHsA8bc x11tUWz2SdXghW+DVymcDkFw6pznS87mJqtopFXvk+m3De5B8n3yvP9LCgcriywjAX9Zim CedxagabdWOVFZmk8LfBak4bj+yMWxM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-217-cs0W5ccaM4ODy2vVK0aelA-1; Mon, 05 Feb 2024 10:32:44 -0500 X-MC-Unique: cs0W5ccaM4ODy2vVK0aelA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 348C0863018; Mon, 5 Feb 2024 15:32:44 +0000 (UTC) Received: from bfoster (unknown [10.22.32.186]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C14982166B31; Mon, 5 Feb 2024 15:32:43 +0000 (UTC) Date: Mon, 5 Feb 2024 10:34:02 -0500 From: Brian Foster To: Christoph Hellwig Cc: linux-mm@kvack.org, Matthew Wilcox , Jan Kara , David Howells , Christian Brauner , "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 13/13] writeback: Remove a use of write_cache_pages() from do_writepages() Message-ID: References: <20240203071147.862076-1-hch@lst.de> <20240203071147.862076-14-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240203071147.862076-14-hch@lst.de> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Rspamd-Queue-Id: DEDDF140034 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 3jsskqkht3qdqras9dea8wohfnksb8gz X-HE-Tag: 1707147170-387027 X-HE-Meta: U2FsdGVkX19DS72rtOWR2IH6FQ+4wM9iwylxfbiaYhk2nA9HL+655Dr1Kc3RjnKkKrjwHLX2SuEqlN1xqdXypm8C6XUYsHJM0XrCMiEyR+xJEQWabLeIDLnRZ1U6TgqdQ0sVfedWBIJ2tZ91weyT+PGRyiE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/OaEfpS2vNAfTu5YroYG5qCapJcIBAab9 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: List-Subscribe: List-Unsubscribe: On Sat, Feb 03, 2024 at 08:11:47AM +0100, Christoph Hellwig wrote: > From: "Matthew Wilcox (Oracle)" > > Use the new writeback_iter() directly instead of indirecting > through a callback. > > Signed-off-by: Matthew Wilcox (Oracle) > [hch: ported to the while based iter style] > Signed-off-by: Christoph Hellwig > --- LGTM, modulo Jan's comments: Reviewed-by: Brian Foster > mm/page-writeback.c | 31 +++++++++++++++++++------------ > 1 file changed, 19 insertions(+), 12 deletions(-) > > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index 5fe4cdb7dbd61a..53ff2d8219ddb6 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2577,13 +2577,25 @@ 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 folio *folio = NULL; > + struct blk_plug plug; > + int err; > + > + blk_start_plug(&plug); > + while ((folio = writeback_iter(mapping, wbc, folio, &err))) { > + err = mapping->a_ops->writepage(&folio->page, wbc); > + mapping_set_error(mapping, err); > + if (err == AOP_WRITEPAGE_ACTIVATE) { > + folio_unlock(folio); > + err = 0; > + } > + } > + blk_finish_plug(&plug); > + > + return err; > } > > int do_writepages(struct address_space *mapping, struct writeback_control *wbc) > @@ -2599,12 +2611,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 >