lkml.org 
[lkml]   [2022]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 12/19] btrfs: Convert btrfs_migratepage to migrate_folio
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) <willy@infradead.org>
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> Acked-by: David Sterba <dsterba@suse.com>
>
> > +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);
> > }

\
 
 \ /
  Last update: 2022-06-09 19:43    [W:0.070 / U:0.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site