public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs: adjust subpage bit start based on sectorsize
Date: Wed, 16 Apr 2025 09:23:10 +0930	[thread overview]
Message-ID: <e137c120-4d7b-447e-84cf-b08783cbd878@gmx.com> (raw)
In-Reply-To: <20250415172344.GB2701859@perftesting>



在 2025/4/16 02:53, Josef Bacik 写道:
> On Tue, Apr 15, 2025 at 07:38:29AM +0930, Qu Wenruo wrote:
>>
>>
[...]
>> The problem is, we can not ensure all extent buffers are nodesize aligned.
>>
>> If we have an eb whose bytenr is only block aligned but not node size
>> aligned, this will lead to the same problem.
>>
>> We need an extra check to reject tree blocks which are not node size
>> aligned, which is another big change and not suitable for a quick fix.
> 
> We already have this.

The checks inside check_eb_alignment() only ensure the subpage eb will 
not cross page boundary, not strong nodesize alignment:

         if (fs_info->nodesize < PAGE_SIZE &&
             offset_in_page(start) + fs_info->nodesize > PAGE_SIZE) {
                 btrfs_err(fs_info,
                 "tree block crosses page boundary, start %llu nodesize %u",
                           start, fs_info->nodesize);
                 return true;
         }

In fact, it even allows such unaligned tree blocks, but with some warnings:

         if (!IS_ALIGNED(start, fs_info->nodesize) &&
             !test_and_set_bit(BTRFS_FS_UNALIGNED_TREE_BLOCK, 
&fs_info->flags)) {
                 btrfs_warn(fs_info,
"tree block not nodesize aligned, start %llu nodesize %u, can be 
resolved by a full metadata balance",
                               start, fs_info->nodesize);
         }

Thanks,
Qu

> 
>>
>>
>> Can we do a gang radix tree lookup for the involved ranges that can cover
>> the block, then increase bit_start to the end of the found eb instead?
> 
> That's a followup patch that I'm testing now.  I've started with the simplest
> fix so that they can be pulled back to all the affected kernels, and then I'm
> following up with much more invasive changes to make these problems go away in
> general.  Thanks,
> 
> Josef
> 


  reply	other threads:[~2025-04-15 23:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14 19:08 [PATCH] btrfs: adjust subpage bit start based on sectorsize Josef Bacik
2025-04-14 19:54 ` Boris Burkov
2025-04-14 22:08 ` Qu Wenruo
2025-04-14 22:37   ` Qu Wenruo
2025-04-15 16:16     ` Boris Burkov
2025-04-15 23:49       ` Qu Wenruo
2025-04-16 14:16         ` Josef Bacik
2025-04-16 22:07           ` Qu Wenruo
2025-04-15 17:25     ` Josef Bacik
2025-04-16  0:08       ` Qu Wenruo
2025-04-15 17:23   ` Josef Bacik
2025-04-15 23:53     ` Qu Wenruo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-04-21 13:37 Josef Bacik
2025-04-21 20:17 ` Qu Wenruo
2025-04-24 10:40 ` Daniel Vacek
2025-04-24 20:57   ` 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=e137c120-4d7b-447e-84cf-b08783cbd878@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.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