public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Tso" <tytso@mit.edu>
To: Winston Wen <wentao@uniontech.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: Inquiry: Possible built-in support for longer filenames in ext4 (beyond 256 bytes)
Date: Thu, 11 Dec 2025 08:24:59 +0900	[thread overview]
Message-ID: <20251210232459.GD42106@macsyma.local> (raw)
In-Reply-To: <2EB6F335572BB77B+20251210173202.58c83465@winn-pc>

On Wed, Dec 10, 2025 at 05:32:02PM +0800, Winston Wen wrote:
> To better understand, I’ve reviewed the readdir/getdents man pages and
> the glibc struct dirent definition. It appears that d_name is
> implemented as a flexible array member rather than a fixed-size array
> of 256 bytes.

Intresting; the struture definition I quoted was from the readdir man
page.

I suspect there may be some number of random failures that might occur
because of hidden dependencies on the historical / traditional value
of NAME_MAX.  For example, it might be OK for glibc; but what about
other C libraries that ship on Linux, such as musl, dietlibc, bionic,
etc.?

> Going back to our original question: we were curious whether it might
> be possible to support longer filenames natively within ext4 itself
> (rather than through FUSE), perhaps via on-disk format extension or
> auxiliary storage like xattrs. If this is architecturally feasible, we
> would be very interested in exploring it further.

Well, extended attributes won't work, because xattrs are associated
with the inode, not the directory entry.  So you need to handle cases
where the file has multiple hard links.  And if you are doing a lookup
by long file name, there's a chicken and egg problem; you can't match
against the full filename until you read the xattr, and you can't do
that until you've lookup.

The only way to do this would be to make an incompatible change to the
directory layout.  And doing this would require either refactoring and
doing extensive rework of the code in fs/ext4/namei.c and
fs/ext4/dir.c, to support both the the original v1 version of the
directory layout, and the v2 version of the directory layout, as well
as handling the v2 verison of the directory when it is encrypted.
It's _doable_, but it's a huge amount of work.  So the question is
whether it's worth it.  If this is some random class project where you
don't care about bugs or reliability, that's one thing.  If this is
something that need to be hardened for production usage, it's quite a
lot more work.

Why are you interested in doing this?  Is there business justification
such that your company would be willing invest a significant amount of
effort?

Cheers,

						- Ted

  reply	other threads:[~2025-12-10 23:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10  7:02 Inquiry: Possible built-in support for longer filenames in ext4 (beyond 256 bytes) Winston Wen
2025-12-10  9:05 ` Theodore Tso
2025-12-10  9:32   ` Winston Wen
2025-12-10 23:24     ` Theodore Tso [this message]
2025-12-11  1:21       ` Winston Wen
2025-12-12 18:10       ` Andi Kleen
2025-12-12 23:35         ` Theodore Tso
2025-12-15 15:04           ` Andi Kleen

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=20251210232459.GD42106@macsyma.local \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=wentao@uniontech.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