Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp646840iol; Thu, 9 Jun 2022 10:50:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYxAp1hOB/atRnyEwL8TTXhfsRmNxP3a4up3LDX345AM+b7Hjy23dTA96m7cX3mcQGuN1X X-Received: by 2002:a17:906:4356:b0:711:cd0d:b205 with SMTP id z22-20020a170906435600b00711cd0db205mr21132599ejm.240.1654797049765; Thu, 09 Jun 2022 10:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654797049; cv=none; d=google.com; s=arc-20160816; b=Pcub6qToMtPUEbQSJIXcW0zbTng4GDqbqRdelVK+VWzFPhSzqzwhmiJ7W5Nh4pX9S7 6f7NS3ZDg7BdmYSPDPB3EMg9rizYEdrSTi8IQDUFdjKZiUaOYLABCyd3oGAEr0SrjKR/ 3A7L1nQQCRCw9y/Wf9f+vmuQy9QDvvxXkIp5BRnmGAKz++/ROftF/YMJqPOowKfksXEJ QXOiT8JCbwWdyvay42fzenwPDn6pcKnO6wEPblzuHBVyIX4fFehEa8udPzq3C2KrdDSr KHA+LeP82/Xo4DBiI/SRvCMyyVSB7uQMR4YWOiyecXFEahmUy8EcvlHTMgJ3E0Urdajd s5oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=50LH8Dogtui4JOE7bz/ojMzo0HRhZGWl5FgghUdbsso=; b=oZHX51iX+MZ3e0Y1HJeZclYcIXDrjxtfPDJApI9q8Rd+lVxAcNxXYOqGozXNfJO+zu g4ywq4TAVGjjzo4erCpRDqiI8zPObVDL/0Is4S+9Zun0DwdhN+MY+lB5p6KGjnsE6aRo Cu13Crr5QmRFwW+c7jL5q7zUKkvG75cAUGT6z3nbm4pY5PUPY7uteHcJ1/Z1HWr3ewNn /riMx4Ia3xKt3U1XBxyWK5tgc3g5vqc/N5Z1KNqn2m2O7iKM5ggckTOmMLgXf9650oZa G9y6o6oAVRc93S/zsEK9JvmlpiUTa1fEvXDGndx1tUcFGP+DyQCCUJUXSxyKIk4D7sk+ V9Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=H80hSPNq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga17-20020a1709070c1100b007058f943d0bsi14383206ejc.87.2022.06.09.10.50.12; Thu, 09 Jun 2022 10:50:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=H80hSPNq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345024AbiFIRkm (ORCPT + 99 others); Thu, 9 Jun 2022 13:40:42 -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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@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); > > }