Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/3] btrfs: make extent_range_clear_dirty_for_io() subpage compatible
Date: Thu, 23 May 2024 10:19:17 +0930	[thread overview]
Message-ID: <f64d771c-b47b-4db1-9bba-1790fbf91aa3@suse.com> (raw)
In-Reply-To: <015a4a2c7afb8ed894f4fb734cb886f01b9feb0c.1716421534.git.wqu@suse.com>



在 2024/5/23 09:17, Qu Wenruo 写道:
> Although the function is never called for subpage ranges, there is no
> harm to make it subpage compatible for the future sector perfect subpage
> compression support.
> 
> And since we're here, also change it to use folio APIs as the subpage
> helper is already folio based.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

This patch is causing hangs for fstests with compression involved.

Please drop the series for now.

Thanks,
Qu
> ---
>   fs/btrfs/inode.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 99be256f4f0e..dda47a273813 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -892,15 +892,20 @@ static inline void inode_should_defrag(struct btrfs_inode *inode,
>   
>   static void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)
>   {
> +	struct btrfs_fs_info *fs_info = inode_to_fs_info(inode);
> +	const u64 len = end + 1 - start;
>   	unsigned long index = start >> PAGE_SHIFT;
>   	unsigned long end_index = end >> PAGE_SHIFT;
> -	struct page *page;
>   
> +	/* We should not have such large range. */
> +	ASSERT(len < U32_MAX);
>   	while (index <= end_index) {
> -		page = find_get_page(inode->i_mapping, index);
> -		BUG_ON(!page); /* Pages should be in the extent_io_tree */
> -		clear_page_dirty_for_io(page);
> -		put_page(page);
> +		struct folio *folio;
> +
> +		folio = filemap_get_folio(inode->i_mapping, index);
> +		BUG_ON(IS_ERR(folio)); /* Pages should have been locked. */
> +		btrfs_folio_clamp_clear_dirty(fs_info, folio, start, len);
> +		folio_put(folio);
>   		index++;
>   	}
>   }

  reply	other threads:[~2024-05-23  0:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 23:47 [PATCH v2 0/3] btrfs: enhance function extent_range_clear_dirty_for_io() Qu Wenruo
2024-05-22 23:47 ` [PATCH v2 1/3] btrfs: move extent_range_clear_dirty_for_io() into inode.c Qu Wenruo
2024-05-22 23:47 ` [PATCH v2 2/3] btrfs: make extent_range_clear_dirty_for_io() subpage compatible Qu Wenruo
2024-05-23  0:49   ` Qu Wenruo [this message]
2024-05-22 23:47 ` [PATCH v2 3/3] btrfs: remove the BUG_ON() inside extent_range_clear_dirty_for_io() Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f64d771c-b47b-4db1-9bba-1790fbf91aa3@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox