public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>
Subject: Re: [PATCH RFC 2/2] btrfs: defrag: prepare defrag for larger data folio size
Date: Thu, 15 Feb 2024 20:23:44 +0000	[thread overview]
Message-ID: <Zc5y0IRJdqjmstvp@casper.infradead.org> (raw)
In-Reply-To: <5708df27430cdeaf472266b5c13dc8c4315f539c.1706068026.git.wqu@suse.com>

On Wed, Jan 24, 2024 at 02:29:08PM +1030, Qu Wenruo wrote:
> Although we have migrated defrag to use the folio interface, we can
> still further enhance it for the future larger data folio size.

This patch is wrong.  Please drop it.

>  {
>  	struct btrfs_fs_info *fs_info = inode->root->fs_info;
>  	struct extent_changeset *data_reserved = NULL;
>  	const u64 start = target->start;
>  	const u64 len = target->len;
> -	unsigned long last_index = (start + len - 1) >> PAGE_SHIFT;
> -	unsigned long start_index = start >> PAGE_SHIFT;
> +	unsigned long last_index = (start + len - 1) >> fs_info->folio_shift;
> +	unsigned long start_index = start >> fs_info->folio_shift;

indices are always in multiples of PAGE_SIZE.

>  	unsigned long first_index = folios[0]->index;

... so if you've shifted a file position by some "folio_shift" and then
subtracted it from folio->index, you have garbage.


  reply	other threads:[~2024-02-15 20:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24  3:59 [PATCH RFC 0/2] btrfs: defrag: further preparation for multi-page sector size Qu Wenruo
2024-01-24  3:59 ` [PATCH RFC 1/2] btrfs: introduce cached folio size Qu Wenruo
2024-01-24  3:59 ` [PATCH RFC 2/2] btrfs: defrag: prepare defrag for larger data " Qu Wenruo
2024-02-15 20:23   ` Matthew Wilcox [this message]
2024-02-15 23:07     ` Qu Wenruo
2024-02-27 21:32       ` Matthew Wilcox
2024-02-27 21:42         ` Qu Wenruo
2024-01-24  4:03 ` [PATCH RFC 0/2] btrfs: defrag: further preparation for multi-page sector size Qu Wenruo
2024-01-24  4:48   ` Matthew Wilcox
2024-01-24  5:27     ` Qu Wenruo
2024-01-24  5:43       ` Matthew Wilcox
2024-01-24  5:50         ` 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=Zc5y0IRJdqjmstvp@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dsterba@suse.com \
    --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