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 89EF4C43334 for ; Thu, 9 Jun 2022 23:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345892AbiFIXJi (ORCPT ); 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) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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.