Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: remove btrfs_set_range_writeback()
Date: Tue, 8 Oct 2024 18:43:56 +0200	[thread overview]
Message-ID: <20241008164356.GC1609@twin.jikos.cz> (raw)
In-Reply-To: <2c53f7555d45d6697e836fa2bb7dce137ab04c99.1728175215.git.wqu@suse.com>

I have more comments on the grammar than on the code, sorry.

On Sun, Oct 06, 2024 at 11:10:22AM +1030, Qu Wenruo wrote:
> The function btrfs_set_range_writeback() is originally a callback for
                                           was

> metadata and data, to mark a range with writeback flag.
> 
> Then it was converted into a common function call for both metadata and
> data.
> 
> >From the very beginning, the function is only called on a full page,
                                         'had been' because of the other past tense, idk

> later converted to handle range inside a page.
> 
> But it never needs to handle multiple pages, and since commit
               needed

> 8189197425e7 ("btrfs: refactor __extent_writepage_io() to do
> sector-by-sector submission") the function is only called on a
                                             has been

> sector-by-sector basis.
> 
> This makes the function unnecessary, and can be converted to a simple
> btrfs_folio_set_writeback() call instead.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  fs/btrfs/btrfs_inode.h |  1 -
>  fs/btrfs/extent_io.c   |  2 +-
>  fs/btrfs/inode.c       | 22 ----------------------
>  3 files changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index e152fde888fc..c514bab532fa 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -577,7 +577,6 @@ void btrfs_merge_delalloc_extent(struct btrfs_inode *inode, struct extent_state
>  				 struct extent_state *other);
>  void btrfs_split_delalloc_extent(struct btrfs_inode *inode,
>  				 struct extent_state *orig, u64 split);
> -void btrfs_set_range_writeback(struct btrfs_inode *inode, u64 start, u64 end);
>  void btrfs_evict_inode(struct inode *inode);
>  struct inode *btrfs_alloc_inode(struct super_block *sb);
>  void btrfs_destroy_inode(struct inode *inode);
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 9fbc83c76b94..d87dcafab537 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -1359,7 +1359,7 @@ static int submit_one_sector(struct btrfs_inode *inode,
>  	 * a folio for a range already written to disk.
>  	 */
>  	btrfs_folio_clear_dirty(fs_info, folio, filepos, sectorsize);
> -	btrfs_set_range_writeback(inode, filepos, filepos + sectorsize - 1);
> +	btrfs_folio_set_writeback(fs_info, folio, filepos, sectorsize);
>  	/*
>  	 * Above call should set the whole folio with writeback flag, even
>  	 * just for a single subpage sector.
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 103ec917ca9d..21e51924742a 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -8939,28 +8939,6 @@ static int btrfs_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
>  	return finish_open_simple(file, ret);
>  }
>  
> -void btrfs_set_range_writeback(struct btrfs_inode *inode, u64 start, u64 end)
> -{
> -	struct btrfs_fs_info *fs_info = inode->root->fs_info;
> -	unsigned long index = start >> PAGE_SHIFT;
> -	unsigned long end_index = end >> PAGE_SHIFT;
> -	struct folio *folio;
> -	u32 len;
> -
> -	ASSERT(end + 1 - start <= U32_MAX);
> -	len = end + 1 - start;
> -	while (index <= end_index) {
> -		folio = __filemap_get_folio(inode->vfs_inode.i_mapping, index, 0, 0);
> -		ASSERT(!IS_ERR(folio)); /* folios should be in the extent_io_tree */
> -
> -		/* This is for data, which doesn't yet support larger folio. */
> -		ASSERT(folio_order(folio) == 0);
> -		btrfs_folio_set_writeback(fs_info, folio, start, len);

So the new code is just btrfs_folio_set_writeback(), with the removed
comment and assertion, what's the status regarding large folios?

I assume that this now implicitly supports them, we don't necessarily
need the assertion as I think we have more places where this would be
detected.

  reply	other threads:[~2024-10-08 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-06  0:40 [PATCH] btrfs: remove btrfs_set_range_writeback() Qu Wenruo
2024-10-08 16:43 ` David Sterba [this message]
2024-10-08 20:56   ` Qu Wenruo
2024-10-08 21:39     ` David Sterba
2024-10-08 21:55       ` Qu Wenruo
2024-10-10 17:18 ` David Sterba

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=20241008164356.GC1609@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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