Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp865447iol; Thu, 9 Jun 2022 16:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQDZp6+EffQ3lfu9TxaPEJfQVxDLkONn6Q67LiZNEUapCutmKy1UflbiOaPPE2JmxfC137 X-Received: by 2002:a17:906:14d5:b0:711:c55a:998 with SMTP id y21-20020a17090614d500b00711c55a0998mr24291882ejc.708.1654816281363; Thu, 09 Jun 2022 16:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654816281; cv=none; d=google.com; s=arc-20160816; b=B3cozzFVRMejQNLIqH4+ETI2qMEdJWwUNQU4eJsC3tcSO/+4pXf8boUrSiVNgDTy1H Vk37eJc9hONvG8MqDLQsFXcfR+20v8s20+0hm7FXLGcHCvtr9q5fxqcV25LnGF4FQdxo PV+7G+8SFxkyhK3oiAmRExa+47myXuNY9p8AVhZZfR7L8GIyGMc6omhrrqF6P0P7HL+n gv7bhl7RP/YI8GBHi+vr1THjD7x0PaJ56fnlR6syjoPIz4YEuw5ku5potq0pdprjDLtV KVrJMETu0sTSb652YnxQIpK6GN1y61UzcdSPRN4M4EGvliIHkKqAtj7gg76Iu/L3sZB8 4egw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=qJ6CI0mpfkDIaS/pnwJC/3BIuCFzValbcslJLDqCmdg=; b=Sc47yaTMwCVRh6dDuOej2N42lEsx6Ds/0nQ3d/sVYNpA9QHLkGbLzdoMFP77fhIKfa F8+L2CbyRYSr5CalWLfYRW/XdYUXhhAMeBXEzG2pwTgUCpRQIBnSv+JMHHetDpwpzeSk QjQaqHdE4Hu+j5eRECFmmt7OFUwliLXCWCmI2kIrMiGrfniXp5E5jTnxMKmJ0qhDHYpg /E0pxLshSZlPl5R2MFcey8i3OJWMa42Mn8ciRAJnUSdPrsVhLJfiPIlHZUbGJzXgo6hl JBM15zjlT/A+mFdWF0LebuZCIFS1+wWoZDJZvy9ZkhN1/t5YQ9ER5nTVnjoCkjwwBRUF xaTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="I4/06b2l"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 24-20020a170906025800b00711f65cd3a1si6141475ejl.831.2022.06.09.16.10.43; Thu, 09 Jun 2022 16:11:21 -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=@suse.cz header.s=susede2_rsa header.b="I4/06b2l"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 S1345901AbiFIXJi (ORCPT + 99 others); Thu, 9 Jun 2022 19:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345214AbiFIXJg (ORCPT ); Thu, 9 Jun 2022 19:09:36 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75DF1E86C2; Thu, 9 Jun 2022 16:09:33 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A49541FF09; Thu, 9 Jun 2022 23:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654816172; h=from:from:reply-to:reply-to: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=qJ6CI0mpfkDIaS/pnwJC/3BIuCFzValbcslJLDqCmdg=; b=I4/06b2ltiKrPbL7GgKqUfyrBDeCyX3UBUG59EJr4ULzJeSHMklpbChcFfJ1kbSeucBXix La6qOv94FBGz6zARxy9vvZ/rfr+o4fJAO1+4sOg84lO5ESeVeDRRH4GNx2iw82Lzfy4RBp n/81rXgBPEK2N99/Wl5n9BN9FjCnnSs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654816172; h=from:from:reply-to:reply-to: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=qJ6CI0mpfkDIaS/pnwJC/3BIuCFzValbcslJLDqCmdg=; b=L3W4XRXz86YAqVEeWGz5ZqCwllS9CYkUvRzkZLgLEjLQjJDb2qGw16RPUqD736ufsddkqi GP6X1OhCsdJk3BBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 31C9113456; Thu, 9 Jun 2022 23:09:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kuItC6x9omLpJgAAMHmgww (envelope-from ); Thu, 09 Jun 2022 23:09:32 +0000 Date: Fri, 10 Jun 2022 01:05:01 +0200 From: David Sterba To: Matthew Wilcox Cc: 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: <20220609230501.GY20633@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Matthew Wilcox , 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 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: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) 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_PASS,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:40:28PM +0100, Matthew Wilcox wrote: > 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. Either way it works for me. If it would mean an unsafe change in folios or complicate other code I'm fine with the migration callback that does additional work for btrfs that could be changed later.