Re: [PATCH v2 1/4] ext4: Convert move_extent_per_page() to use folios

From: Vishal Moola
Date: Fri Nov 18 2022 - 02:28:42 EST


On Thu, Nov 17, 2022 at 6:14 PM Vishal Moola (Oracle)
<vishal.moola@xxxxxxxxx> wrote:
>
> Converts move_extent_per_page() to use folios. This change removes
> 5 calls to compound_head() and is in preparation for the removal of
> the try_to_release_page() wrapper.
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@xxxxxxxxx>
> ---
> fs/ext4/move_extent.c | 52 ++++++++++++++++++++++++++-----------------
> 1 file changed, 31 insertions(+), 21 deletions(-)
>
> diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
> index 044e34cd835c..aa67eb240ca6 100644
> --- a/fs/ext4/move_extent.c
> +++ b/fs/ext4/move_extent.c
> @@ -253,6 +253,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
> {
> struct inode *orig_inode = file_inode(o_filp);
> struct page *pagep[2] = {NULL, NULL};
> + struct folio *folio[2] = {NULL, NULL};
> handle_t *handle;
> ext4_lblk_t orig_blk_offset, donor_blk_offset;
> unsigned long blocksize = orig_inode->i_sb->s_blocksize;
> @@ -313,6 +314,13 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
> * hold page's lock, if it is still the case data copy is not
> * necessary, just swap data blocks between orig and donor.
> */
> + folio[0] = page_folio(pagep[0]);
> + folio[1] = page_folio(pagep[1]);
> +
> + VM_BUG_ON_FOLIO(!folio_test_large(folio[0]), folio[0]);
> + VM_BUG_ON_FOLIO(!folio_test_large(folio[1]), folio[1]);
> + VM_BUG_ON_FOLIO(folio_nr_pages(folio[0]) != folio_nr_pages(folio[1]), folio[1]);

Looks like I got my assertions backward. We want to BUG if the folios are large,
or if they are different sizes. Disregard v2, its fixed in v3.