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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F620CCA480 for ; Thu, 9 Jun 2022 17:40:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343904AbiFIRkn (ORCPT ); Thu, 9 Jun 2022 13:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237051AbiFIRkl (ORCPT ); Thu, 9 Jun 2022 13:40:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3F4E155319; Thu, 9 Jun 2022 10:40:38 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > > }