mbox series

[00/46] btrfs: convert most of the data path to use folios

Message ID cover.1722022376.git.josef@toxicpanda.com (mailing list archive)
Headers show
Series btrfs: convert most of the data path to use folios | expand

Message

Josef Bacik July 26, 2024, 7:35 p.m. UTC
Hello,

Willy indicated that he wants to get rid of page->index in the next merge
window, so I went to look at what that would entail for btrfs, and I got a
little carried away.

This patch series does in fact accomplish that, but it takes almost the entirety
of the data write path and makes it work with only folios.  I was going to
convert everything, but there's some weird gaps that need to be handled in their
own chunk.

1. Scrub.  We're still passing around page pointers.  Not a huge deal, it was
   just another 10ish patches just for that work, so I decided against it.

2. Buffered writes.  Again, I did most of this work and it wasn't bad, but then
   I realized that the free space cache uses some of this code, and I really
   don't want to convert that code, I want to delete it, so I'll do that first.

3. Metadata.  Qu has been doing this consistently and I didn't want to get in
   the way of his work so I just left most of that.

This has run through the CI and didn't cause any issues.  I've made everything
as easy to review as possible and as small as possible.  My eyes started to
glaze over a little bit with the changelogs, so let me know if there's anything
you want changed.  Thanks,

Josef

Josef Bacik (46):
  btrfs: convert btrfs_readahead to only use folio
  btrfs: convert btrfs_read_folio to only use a folio
  btrfs: convert end_page_read to take a folio
  btrfs: convert begin_page_folio to take a folio instead
  btrfs: convert submit_extent_page to use a folio
  btrfs: convert btrfs_do_readpage to only use a folio
  btrfs: update the writepage tracepoint to take a folio
  btrfs: convert __extent_writepage_io to take a folio
  btrfs: convert extent_write_locked_range to use folios
  btrfs: convert __extent_writepage to be completely folio based
  btrfs: convert add_ra_bio_pages to use only folios
  btrfs: utilize folio more in btrfs_page_mkwrite
  btrfs: convert can_finish_ordered_extent to use a folio
  btrfs: convert btrfs_finish_ordered_extent to take a folio
  btrfs: convert btrfs_mark_ordered_io_finished to take a folio
  btrfs: convert writepage_delalloc to take a folio
  btrfs: convert find_lock_delalloc_range to use a folio
  btrfs: convert lock_delalloc_pages to take a folio
  btrfs: convert __unlock_for_delalloc to take a folio
  btrfs: convert __process_pages_contig to take a folio
  btrfs: convert process_one_page to operate only on folios
  btrfs: convert extent_clear_unlock_delalloc to take a folio
  btrfs: convert extent_write_locked_range to take a folio
  btrfs: convert run_delalloc_cow to take a folio
  btrfs: convert cow_file_range_inline to take a folio
  btrfs: convert cow_file_range to take a folio
  btrfs: convert fallback_to_cow to take a folio
  btrfs: convert run_delalloc_nocow to take a folio
  btrfs: convert btrfs_cleanup_ordered_extents to use folios
  btrfs: convert btrfs_cleanup_ordered_extents to take a folio
  btrfs: convert run_delalloc_compressed to take a folio
  btrfs: convert btrfs_run_delalloc_range to take a folio
  btrfs: convert async_chunk to hold a folio
  btrfs: convert submit_uncompressed_range to take a folio
  btrfs: convert btrfs_writepage_fixup_worker to use a folio
  btrfs: convert btrfs_writepage_cow_fixup to use folio
  btrfs: convert btrfs_writepage_fixup to use a folio
  btrfs: convert uncompress_inline to take a folio
  btrfs: convert read_inline_extent to use a folio
  btrfs: convert btrfs_get_extent to take a folio
  btrfs: convert __get_extent_map to take a folio
  btrfs: convert find_next_dirty_byte to take a folio
  btrfs: convert wait_subpage_spinlock to only use a folio
  btrfs: convert btrfs_set_range_writeback to use a folio
  btrfs: convert insert_inline_extent to use a folio
  btrfs: convert extent_range_clear_dirty_for_io to use a folio

 fs/btrfs/btrfs_inode.h           |   6 +-
 fs/btrfs/compression.c           |  62 +++--
 fs/btrfs/extent_io.c             | 436 +++++++++++++++----------------
 fs/btrfs/extent_io.h             |   6 +-
 fs/btrfs/file.c                  |  24 +-
 fs/btrfs/inode.c                 | 342 ++++++++++++------------
 fs/btrfs/ordered-data.c          |  28 +-
 fs/btrfs/ordered-data.h          |   6 +-
 fs/btrfs/tests/extent-io-tests.c |  10 +-
 include/trace/events/btrfs.h     |  10 +-
 10 files changed, 467 insertions(+), 463 deletions(-)

Comments

Qu Wenruo July 26, 2024, 10:57 p.m. UTC | #1
在 2024/7/27 05:05, Josef Bacik 写道:
> Hello,
>
> Willy indicated that he wants to get rid of page->index in the next merge
> window, so I went to look at what that would entail for btrfs, and I got a
> little carried away.
>
> This patch series does in fact accomplish that, but it takes almost the entirety
> of the data write path and makes it work with only folios.  I was going to
> convert everything, but there's some weird gaps that need to be handled in their
> own chunk.
>
> 1. Scrub.  We're still passing around page pointers.  Not a huge deal, it was
>     just another 10ish patches just for that work, so I decided against it.
>
> 2. Buffered writes.  Again, I did most of this work and it wasn't bad, but then
>     I realized that the free space cache uses some of this code, and I really
>     don't want to convert that code, I want to delete it, so I'll do that first.

Totally agree, v1 is better to be deprecated.

>
> 3. Metadata.  Qu has been doing this consistently and I didn't want to get in
>     the way of his work so I just left most of that.

I guess there are still metadata codes switching between page and folios.

I'm totally fine if you feel like to convert them to use folios.
The only focus for me is to enable larger folios.
So the conversion part is totally fine.

>
> This has run through the CI and didn't cause any issues.  I've made everything
> as easy to review as possible and as small as possible.  My eyes started to
> glaze over a little bit with the changelogs, so let me know if there's anything
> you want changed.  Thanks,

Just give us some time to review the whole series though, the pure
amount of patches is already making my eyes glazing.

Thanks,
Qu

>
> Josef
>
> Josef Bacik (46):
>    btrfs: convert btrfs_readahead to only use folio
>    btrfs: convert btrfs_read_folio to only use a folio
>    btrfs: convert end_page_read to take a folio
>    btrfs: convert begin_page_folio to take a folio instead
>    btrfs: convert submit_extent_page to use a folio
>    btrfs: convert btrfs_do_readpage to only use a folio
>    btrfs: update the writepage tracepoint to take a folio
>    btrfs: convert __extent_writepage_io to take a folio
>    btrfs: convert extent_write_locked_range to use folios
>    btrfs: convert __extent_writepage to be completely folio based
>    btrfs: convert add_ra_bio_pages to use only folios
>    btrfs: utilize folio more in btrfs_page_mkwrite
>    btrfs: convert can_finish_ordered_extent to use a folio
>    btrfs: convert btrfs_finish_ordered_extent to take a folio
>    btrfs: convert btrfs_mark_ordered_io_finished to take a folio
>    btrfs: convert writepage_delalloc to take a folio
>    btrfs: convert find_lock_delalloc_range to use a folio
>    btrfs: convert lock_delalloc_pages to take a folio
>    btrfs: convert __unlock_for_delalloc to take a folio
>    btrfs: convert __process_pages_contig to take a folio
>    btrfs: convert process_one_page to operate only on folios
>    btrfs: convert extent_clear_unlock_delalloc to take a folio
>    btrfs: convert extent_write_locked_range to take a folio
>    btrfs: convert run_delalloc_cow to take a folio
>    btrfs: convert cow_file_range_inline to take a folio
>    btrfs: convert cow_file_range to take a folio
>    btrfs: convert fallback_to_cow to take a folio
>    btrfs: convert run_delalloc_nocow to take a folio
>    btrfs: convert btrfs_cleanup_ordered_extents to use folios
>    btrfs: convert btrfs_cleanup_ordered_extents to take a folio
>    btrfs: convert run_delalloc_compressed to take a folio
>    btrfs: convert btrfs_run_delalloc_range to take a folio
>    btrfs: convert async_chunk to hold a folio
>    btrfs: convert submit_uncompressed_range to take a folio
>    btrfs: convert btrfs_writepage_fixup_worker to use a folio
>    btrfs: convert btrfs_writepage_cow_fixup to use folio
>    btrfs: convert btrfs_writepage_fixup to use a folio
>    btrfs: convert uncompress_inline to take a folio
>    btrfs: convert read_inline_extent to use a folio
>    btrfs: convert btrfs_get_extent to take a folio
>    btrfs: convert __get_extent_map to take a folio
>    btrfs: convert find_next_dirty_byte to take a folio
>    btrfs: convert wait_subpage_spinlock to only use a folio
>    btrfs: convert btrfs_set_range_writeback to use a folio
>    btrfs: convert insert_inline_extent to use a folio
>    btrfs: convert extent_range_clear_dirty_for_io to use a folio
>
>   fs/btrfs/btrfs_inode.h           |   6 +-
>   fs/btrfs/compression.c           |  62 +++--
>   fs/btrfs/extent_io.c             | 436 +++++++++++++++----------------
>   fs/btrfs/extent_io.h             |   6 +-
>   fs/btrfs/file.c                  |  24 +-
>   fs/btrfs/inode.c                 | 342 ++++++++++++------------
>   fs/btrfs/ordered-data.c          |  28 +-
>   fs/btrfs/ordered-data.h          |   6 +-
>   fs/btrfs/tests/extent-io-tests.c |  10 +-
>   include/trace/events/btrfs.h     |  10 +-
>   10 files changed, 467 insertions(+), 463 deletions(-)
>
Neal Gompa July 27, 2024, 12:55 a.m. UTC | #2
On Fri, Jul 26, 2024 at 6:58 PM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>
>
>
> 在 2024/7/27 05:05, Josef Bacik 写道:
> > Hello,
> >
> > Willy indicated that he wants to get rid of page->index in the next merge
> > window, so I went to look at what that would entail for btrfs, and I got a
> > little carried away.
> >
> > This patch series does in fact accomplish that, but it takes almost the entirety
> > of the data write path and makes it work with only folios.  I was going to
> > convert everything, but there's some weird gaps that need to be handled in their
> > own chunk.
> >
> > 1. Scrub.  We're still passing around page pointers.  Not a huge deal, it was
> >     just another 10ish patches just for that work, so I decided against it.
> >
> > 2. Buffered writes.  Again, I did most of this work and it wasn't bad, but then
> >     I realized that the free space cache uses some of this code, and I really
> >     don't want to convert that code, I want to delete it, so I'll do that first.
>
> Totally agree, v1 is better to be deprecated.
>

Didn't we already deprecate it? We should just announce the removal schedule.

> >
> > 3. Metadata.  Qu has been doing this consistently and I didn't want to get in
> >     the way of his work so I just left most of that.
>
> I guess there are still metadata codes switching between page and folios.
>
> I'm totally fine if you feel like to convert them to use folios.
> The only focus for me is to enable larger folios.
> So the conversion part is totally fine.
>
> >
> > This has run through the CI and didn't cause any issues.  I've made everything
> > as easy to review as possible and as small as possible.  My eyes started to
> > glaze over a little bit with the changelogs, so let me know if there's anything
> > you want changed.  Thanks,
>
> Just give us some time to review the whole series though, the pure
> amount of patches is already making my eyes glazing.
>

I'm impressed, but my eyes are glazing over reading it patch by patch
through emails, do you happen to have a branch on GitHub/GitLab/etc.
that I could look at it through instead?
Josef Bacik July 29, 2024, 2:43 p.m. UTC | #3
On Fri, Jul 26, 2024 at 08:55:54PM -0400, Neal Gompa wrote:
> On Fri, Jul 26, 2024 at 6:58 PM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
> >
> >
> >
> > 在 2024/7/27 05:05, Josef Bacik 写道:
> > > Hello,
> > >
> > > Willy indicated that he wants to get rid of page->index in the next merge
> > > window, so I went to look at what that would entail for btrfs, and I got a
> > > little carried away.
> > >
> > > This patch series does in fact accomplish that, but it takes almost the entirety
> > > of the data write path and makes it work with only folios.  I was going to
> > > convert everything, but there's some weird gaps that need to be handled in their
> > > own chunk.
> > >
> > > 1. Scrub.  We're still passing around page pointers.  Not a huge deal, it was
> > >     just another 10ish patches just for that work, so I decided against it.
> > >
> > > 2. Buffered writes.  Again, I did most of this work and it wasn't bad, but then
> > >     I realized that the free space cache uses some of this code, and I really
> > >     don't want to convert that code, I want to delete it, so I'll do that first.
> >
> > Totally agree, v1 is better to be deprecated.
> >
> 
> Didn't we already deprecate it? We should just announce the removal schedule.
> 
> > >
> > > 3. Metadata.  Qu has been doing this consistently and I didn't want to get in
> > >     the way of his work so I just left most of that.
> >
> > I guess there are still metadata codes switching between page and folios.
> >
> > I'm totally fine if you feel like to convert them to use folios.
> > The only focus for me is to enable larger folios.
> > So the conversion part is totally fine.
> >
> > >
> > > This has run through the CI and didn't cause any issues.  I've made everything
> > > as easy to review as possible and as small as possible.  My eyes started to
> > > glaze over a little bit with the changelogs, so let me know if there's anything
> > > you want changed.  Thanks,
> >
> > Just give us some time to review the whole series though, the pure
> > amount of patches is already making my eyes glazing.
> >
> 
> I'm impressed, but my eyes are glazing over reading it patch by patch
> through emails, do you happen to have a branch on GitHub/GitLab/etc.
> that I could look at it through instead?

Yup it's here

https://github.com/josefbacik/linux/tree/btrfs-convert-readahead

Thanks,

Josef
David Sterba July 29, 2024, 8:32 p.m. UTC | #4
On Fri, Jul 26, 2024 at 03:35:47PM -0400, Josef Bacik wrote:
> Hello,
> 
> Willy indicated that he wants to get rid of page->index in the next merge
> window, so I went to look at what that would entail for btrfs, and I got a
> little carried away.
> 
> This patch series does in fact accomplish that, but it takes almost the entirety
> of the data write path and makes it work with only folios.  I was going to
> convert everything, but there's some weird gaps that need to be handled in their
> own chunk.
> 
> 1. Scrub.  We're still passing around page pointers.  Not a huge deal, it was
>    just another 10ish patches just for that work, so I decided against it.
> 
> 2. Buffered writes.  Again, I did most of this work and it wasn't bad, but then
>    I realized that the free space cache uses some of this code, and I really
>    don't want to convert that code, I want to delete it, so I'll do that first.
> 
> 3. Metadata.  Qu has been doing this consistently and I didn't want to get in
>    the way of his work so I just left most of that.
> 
> This has run through the CI and didn't cause any issues.  I've made everything
> as easy to review as possible and as small as possible.  My eyes started to
> glaze over a little bit with the changelogs, so let me know if there's anything
> you want changed.  Thanks,

I did two passes, most of the conversions are straightforward, the API
changes seem OK. There are some local variable referring to page, like
page_start but initialized from folios. Not a big problem for now, we'll
keep removing references to pages, this can be done later.

Reviewed-by: David Sterba <dsterba@suse.com>