public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Masato Minda <minmin@jprs.co.jp>, linux-ext4@vger.kernel.org
Subject: Re: How many files to create in one directory?
Date: Mon, 27 Jan 2014 12:02:39 -0600	[thread overview]
Message-ID: <52E69F3F.2000104@redhat.com> (raw)
In-Reply-To: <52E607B1.2060206@jprs.co.jp>

On 1/27/14, 1:16 AM, Masato Minda wrote:
> Dear Ext4 Developer;
> 
> I've copied the files from VxFS to EXT4, I saw the message “Directory
> index full!”. I've checked the search engine and found these mails.
> 
>   http://www.spinics.net/lists/linux-ext4/msg25058.html
>   http://www.spinics.net/lists/linux-ext4/msg25069.html
> 
> Our Ext4's block size was 1024. I've changed the block size from 1024 to
> 4096. Our problem was solved. But I have question.
> 
> How many files to create in one directory in 4096 block size?
> I think that it is about 3 million files with perfect hashing.
> 
>   16*(4096-16)/8*(4096-8)/8*3/4= 3M
> 
> Is this correct?

It will depend on the length of the filenames.  But by my calculations,
for average 28-char filenames, it's closer to 30 million.

There are (4096-32)/8 indices per block, or 508.
There are 2 levels, so 508*508=258064 leaf blocks.
The length of each record for 28 char names would be 32 bytes.
So you can fit 4096/32 = 128 entries per leaf block.
258064 leaf blocks * 128 entries/bock is 33,032,192 entries.

I recently made a spreadsheet to calculate this.
I'm not sure if I am doing google docs sharing and protection
correctly, but this might work:

https://docs.google.com/spreadsheet/ccc?key=0AtdHTZsZ8XoYdE1IUXlDb1RXQkdPM3F4YWpfNGhMbFE&usp=sharing#gid=0

-Eric

> Thanks in advance.
> 
> --
> Masato minmin Minda <minmin@jprs.co.jp>
> Japan Registry Services Co., Ltd. (JPRS)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-01-27 18:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27  7:16 How many files to create in one directory? Masato Minda
2014-01-27 18:02 ` Eric Sandeen [this message]
2014-01-27 19:39   ` Theodore Ts'o
2014-01-27 19:48     ` Eric Sandeen
2014-01-28  2:53       ` Masato Minda
2014-01-28 21:02       ` Andreas Dilger

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=52E69F3F.2000104@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=minmin@jprs.co.jp \
    /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