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 61ABBC43334 for ; Thu, 9 Jun 2022 17:40:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D96A38D0032; Thu, 9 Jun 2022 13:40:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D44B78D0030; Thu, 9 Jun 2022 13:40:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCC708D0032; Thu, 9 Jun 2022 13:40:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A5F3E8D0030 for ; Thu, 9 Jun 2022 13:40:42 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 824B381113 for ; Thu, 9 Jun 2022 17:40:42 +0000 (UTC) X-FDA: 79559412324.15.CF99B7C Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf20.hostedemail.com (Postfix) with ESMTP id 306E11C0068; Thu, 9 Jun 2022 17:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:To:From:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=50LH8Dogtui4JOE7bz/ojMzo0HRhZGWl5FgghUdbsso=; b=H80hSPNqGiAd5chM6yyxpXe7GI v16rR9GPk1lsBvZCxGkkfPwwIt580VMmgSt7/ZwfufekJhmrwARChvfRps5Isb2jo31hImz/J8zhg 3Gqid/DHTzlBHrEnpsHq7tbmdB6lizbSwvMg1psBh47cB986OJv32t09q9JTTsGSl5f5sM+mUmbDC kBxIqffET9U+LDZy+bNXjBWIq4ozQI6dP3A/jTcDrHF2DBz9xSzltFjBNcK5NRZczIeDZyfqJ8lJf qfewZREEYM3aHIjRrfEfYKtBKEBJRQ6UywKBfP0QJhwiV/qPmGd6+tb1EV1S0HSjXDX6WidFPIyNN +S04cl5w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzM8y-00DjCy-V3; Thu, 09 Jun 2022 17:40:28 +0000 Date: Thu, 9 Jun 2022 18:40:28 +0100 From: Matthew Wilcox To: dsterba@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-aio@kvack.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-mm@kvack.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, ocfs2-devel@oss.oracle.com, linux-mtd@lists.infradead.org, virtualization@lists.linux-foundation.org, Christoph Hellwig Subject: Re: [PATCH v2 12/19] btrfs: Convert btrfs_migratepage to migrate_folio Message-ID: References: <20220608150249.3033815-1-willy@infradead.org> <20220608150249.3033815-13-willy@infradead.org> <20220609163323.GV20633@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220609163323.GV20633@twin.jikos.cz> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1654796442; a=rsa-sha256; cv=none; b=U3o9WB6YUectRyD1ThESnZbQ61zPi306fwLZhZ83BJJQoVFiFO+9xqUN40D8zYVu+414+z CA7VI7mZOGvkaf2nZuGAYFKC0CCCZGCdkxeYdyjsftqeg3FWj3WQtvDRpV6tI59790ArE8 Rq0/o9qM0qHN3Ib1t1wsB+3Utz853JE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1654796442; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=50LH8Dogtui4JOE7bz/ojMzo0HRhZGWl5FgghUdbsso=; b=LVXW5h01bCdyAmIEEh8gzNzZhTCmgP2y5hXgw5NiSMWweFVFdXhOu83sAIllexU3i7OjRt 171rqYLI3SiS+dq1PZBDTojwtPJUAx0Cnx/zl2qwPku2oyl3bFA0KSO8PFlhdA99SIzW6N 5MU33U8E8VQFN0BmXkBatPrKkLWp+rs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=H80hSPNq; dmarc=none; spf=none (imf20.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=H80hSPNq; dmarc=none; spf=none (imf20.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: jwysrdxe4g7dydhw59ycjpiqogkwrqi1 X-Rspamd-Queue-Id: 306E11C0068 X-Rspamd-Server: rspam12 X-Rspam-User: X-HE-Tag: 1654796441-682630 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: On Thu, Jun 09, 2022 at 06:33:23PM +0200, David Sterba wrote: > On Wed, Jun 08, 2022 at 04:02:42PM +0100, Matthew Wilcox (Oracle) wrote: > > Use filemap_migrate_folio() to do the bulk of the work, and then copy > > the ordered flag across if needed. > > > > Signed-off-by: Matthew Wilcox (Oracle) > > Reviewed-by: Christoph Hellwig > > Acked-by: David Sterba > > > +static int btrfs_migrate_folio(struct address_space *mapping, > > + struct folio *dst, struct folio *src, > > enum migrate_mode mode) > > { > > - int ret; > > + int ret = filemap_migrate_folio(mapping, dst, src, mode); > > > > - ret = migrate_page_move_mapping(mapping, newpage, page, 0); > > if (ret != MIGRATEPAGE_SUCCESS) > > return ret; > > > > - if (page_has_private(page)) > > - attach_page_private(newpage, detach_page_private(page)); > > If I'm reading it correctly, the private pointer does not need to be set > like that anymore because it's done somewhere during the > filemap_migrate_folio() call. That's correct. Everything except moving the ordered flag across is done for you, and I'm kind of tempted to modify folio_migrate_flags() to copy the ordered flag across as well. Then you could just use filemap_migrate_folio() directly. > > - > > - if (PageOrdered(page)) { > > - ClearPageOrdered(page); > > - SetPageOrdered(newpage); > > + if (folio_test_ordered(src)) { > > + folio_clear_ordered(src); > > + folio_set_ordered(dst); > > }