From: Andreas Dilger <adilger@sun.com>
To: Alexey Salmin <alexey.salmin@gmail.com>
Cc: Theodore Tso <tytso@mit.edu>, linux-ext4@vger.kernel.org
Subject: Re: Maximum filename length
Date: Sat, 22 Nov 2008 17:36:18 -0600 [thread overview]
Message-ID: <20081122233618.GR3186@webber.adilger.int> (raw)
In-Reply-To: <87a8dc10811221048t27b0c6dx253bed61418389e8@mail.gmail.com>
On Nov 23, 2008 00:48 +0600, Alexey Salmin wrote:
> Sure, I understand the problems you've mentioned. But every big act
> has the beginning. Adding the extension to the ext4 is only the first
> step. Of course it'll cause crashes and other problems in many places
> from kernel to userspace code. But these problems will disturb only
> people who will really use this extension (like me). Anyway most of these
> bugs will be fixed some day, may be in two or three years. No one is
> talking that it's a fast process but it will reach it's end and that's good
> I think.
If you are motivated to work on this, there are a number of possible ways
that this could be done. The simplest would be to create a new directory
entry (replacing ext4_dir_entry_2) that has a longer name_len field, and
ideally it would also have space for a 48-bit inode number (ext4 will
NEVER need more than 280 trillion inodes I think).
I don't know that it is practical to require this format for the entire
directory, because it would mean in some rare cases rewriting 1M entries
(or whatever) in a large directory to the new format. It would be better
to allow either just the leaf block to hold the new record format (with a
marker at the start of the block), or individual records having the new
format, possibly marked by a bit in the "file_type" field.
It's kind of ugly, but it needs to be possible to detect if the entry is
the old format or the new one.
#define EXT4_DIRENT3_FL 0x00400000 /* directory has any dir_entry_3 */
#define EXT4_FT_ENTRY_3 0x80 /* file_type for dir_entry_3 */
#define EXT4_FT_MASK 0x0f /* EXT4_FT_* mask */
#define EXT4_INODE_MASK 0x00ffffffffffffff /* 48-bit inode number mask */
#define EXT4_NAME_LEN3 1012
struct ext4_dir_entry_3 {
__le64 inode; /* High byte holds file_type */
__le16 rec_len;
__le16 name_len;
char name[EXT4_NAME_LEN3];
};
static inline __u8 ext4_get_de_file_type(struct ext4_dir_entry_2 *dirent)
{
return (dirent->file_type & EXT4_FT_MASK);
}
static inline int ext4_get_de_name_len(struct ext4_dir_entry_2 *dirent)
{
if (dirent->file_type & EXT4_FT_ENTRY_3) {
struct ext4_dir_entry_3 *dirent3 = dirent;
return le16_to_cpu(dirent3->name_len);
}
return dirent->name_len;
}
static inline int ext4_get_de_rec_len(struct ext4_dir_entry_2 *dirent)
{
if (dirent->file_type & EXT4_FT_ENTRY_3) {
struct ext4_dir_entry_3 *dirent3 = dirent;
return le16_to_cpu(dirent3->rec_len);
}
return le16_to_cpu(dirent->rec_len);
}
static inline __u64 ext4_get_de_inode(struct ext4_dir_entry_2 *dirent)
{
if (dirent->file_type & EXT4_FT_ENTRY_3) {
struct ext4_dir_entry_3 *dirent3 = dirent;
return le64_to_cpu(dirent3->inode) & EXT4_INODE_MASK;
}
return le32_to_cpu(dirent->inode);
}
static inline __u64 ext4_get_de_name(struct ext4_dir_entry_2 *dirent)
{
if (dirent->file_type & EXT4_FT_ENTRY_3) {
struct ext4_dir_entry_3 *dirent3 = dirent;
return dirent3->name;
}
return dirent->name);
}
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
next prev parent reply other threads:[~2008-11-22 23:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-21 12:51 Maximum filename length Alexey Salmin
2008-11-21 22:32 ` Theodore Tso
2008-11-22 2:50 ` rae l
2008-11-23 3:08 ` Theodore Tso
2008-11-22 18:48 ` Alexey Salmin
2008-11-22 23:36 ` Andreas Dilger [this message]
2008-11-23 22:15 ` 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=20081122233618.GR3186@webber.adilger.int \
--to=adilger@sun.com \
--cc=alexey.salmin@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.