public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Tso" <tytso@mit.edu>
To: Baokun Li <libaokun@linux.alibaba.com>
Cc: Jan Kara <jack@suse.cz>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [RFC PATCH] ext4: handle wraparound when searching for blocks for indirect mapped blocks
Date: Thu, 12 Mar 2026 10:23:45 -0400	[thread overview]
Message-ID: <20260312142345.GA4689@macsyma-wired.lan> (raw)
In-Reply-To: <5ce9dfe2-721e-4d20-9bd9-3560aa76888d@linux.alibaba.com>

On Wed, Mar 11, 2026 at 10:38:20AM +0800, Baokun Li wrote:
> 
> Good spotting! ext4_find_goal() ensures that the goal block obtained for
> indirect-block-based files will not exceed EXT4_MAX_BLOCK_FILE_PHYS.
> However, on an ext4 filesystem where the two file formats are mixed,
> it is indeed possible to get an excessively large goal group via stream
> allocation.

Well, I didn't spot it; an LLM AI noticed.  :-) Arguably I should have
noticed it when doing my review, but I didn't.

> Since the mixed-format case is quite rare, I think we can simply validate
> start in ext4_mb_scan_groups() and reset it to 0 when it exceeds the limit,
> like this:

No, I don't think that's enough.  It's not just that we could have an
excessively large goal group.  The goal group could also just be, say,
2**32 - 5.  If the next 5 groups are full, then when we do an
optimized scan, we will end up beyond the 2**32 limit.  That's why we
need to add some kidn of wraparound logic to *any* caller to
ext4_get_allocation_groups_count().

							- Ted

  reply	other threads:[~2026-03-12 14:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 12:28 [RFC PATCH] ext4: handle wraparound when searching for blocks for indirect mapped blocks Theodore Ts'o
2026-03-11  2:38 ` Baokun Li
2026-03-12 14:23   ` Theodore Tso [this message]
2026-03-13  2:00     ` Baokun Li
2026-03-13 14:31       ` Theodore Tso
2026-03-14  7:41         ` Baokun Li

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=20260312142345.GA4689@macsyma-wired.lan \
    --to=tytso@mit.edu \
    --cc=jack@suse.cz \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@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