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 4DAD1C433EF for ; Thu, 9 Jun 2022 23:09:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5C518D0034; Thu, 9 Jun 2022 19:09:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8F458D0063; Thu, 9 Jun 2022 19:09:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E1548D0034; Thu, 9 Jun 2022 19:09:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6C55C8D0034 for ; Thu, 9 Jun 2022 19:09:39 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 47F2835A7F for ; Thu, 9 Jun 2022 23:09:39 +0000 (UTC) X-FDA: 79560241278.15.5E25963 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf11.hostedemail.com (Postfix) with ESMTP id 5E74D40071; Thu, 9 Jun 2022 23:09:34 +0000 (UTC) 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) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1654816174; a=rsa-sha256; cv=none; b=XH6Z6G5kF5LSxEAMijVWybX00JUXhRDirKU9YdxXoi/Q0wOk2L67slPUPRpIn+8AADV9J4 9SEhkFkiNPGHbHieNSuLcyD/+QLYO9CY96rW+L34c5qD92Sh7FKQZsSkdY3FmV2lPJ7WWq BGPZZT9CYyJDR+hCq1ad9LWo1l7PzaY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="I4/06b2l"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=L3W4XRXz; dmarc=none; spf=pass (imf11.hostedemail.com: domain of dsterba@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=dsterba@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1654816174; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qJ6CI0mpfkDIaS/pnwJC/3BIuCFzValbcslJLDqCmdg=; b=VcPpHx6nn/WFiUOzpKgAwvugoDZ8pPK08KSm6MfBm5JD349pVKBjoF87jgstLm9De6zh4f nBKcNxBIY+7txuZcGdkub64J4Epd1HanwnsnFjQgS0nrQwCGOyQ8kp1XWOhJYRRxlfdFQT CmN79Aunqvn/Fp2bs25CZ5NkdLMiBuI= X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 5E74D40071 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="I4/06b2l"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=L3W4XRXz; dmarc=none; spf=pass (imf11.hostedemail.com: domain of dsterba@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=dsterba@suse.cz X-Stat-Signature: yms1eagbanxwofrmx9k9pzn4uofxcxnp X-HE-Tag: 1654816174-30490 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: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.