All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@dilger.ca>
To: Mark Hills <mark@xwax.org>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: Maildir quickly hitting max htree
Date: Sat, 13 Nov 2021 09:19:58 -0800	[thread overview]
Message-ID: <82C9B126-527B-4D41-8E01-84C560E06A3F@dilger.ca> (raw)
In-Reply-To: <d1f5c468-4afa-accc-7843-83b484dc081@xwax.org>

On Nov 13, 2021, at 04:05, Mark Hills <mark@xwax.org> wrote:
> 
> Andreas, thanks for such a prompt reply.
> 
>> On Fri, 12 Nov 2021, Andreas Dilger wrote:
>> 
>>> On Nov 12, 2021, at 11:37, Mark Hills <mark@xwax.org> wrote:
>>> 
>>> Surprised to hit a limit when handling a modest Maildir case; does 
>>> this reflect a bug?
>>> 
>>> rsync'ing to a new mail server, after fewer than 100,000 files there 
>>> are intermittent failures:
>> 
>> This is probably because you are using 1KB blocksize instead of 4KB, 
>> which reduces the size of each tree level by the cube of the ratio, so 
>> 64x. I guess that was selected because of very small files in the 
>> maildir?
> 
> Interesting! The 1Kb block size was not explicitly chosen. There was no 
> plan other than using the defaults.
> 
> However I did forget that this is a VM installed from a base image. The 
> root cause is likely to be that the /home partition has been enlarged from 
> a small size to 32Gb.
> 
> Is block size the only factor? If so, a patch like below (untested) could 
> make it clear it's relevant, and saved the question in this case.

The patch looks reasonable, but should be submitted separately with
[patch] in the subject so that it will not be lost.  

You can also add on your patch:

Reviewed-by: Andreas Dilger <adilger@dilger.ca>


Cheers, Andreas

> 
> [...]
>> If you have a relatively recent kernel, you can enable the "large_dir" 
>> feature to allow 3-level htree, which would be enough for another factor 
>> of 1024/8 = 128 more entries than now (~12M).
> 
> The system is not yet in use, so I think it's better we reformat here, and 
> get a block size chosen by the experts :)
> 
> These days I think VMs make it more common to enlarge a filesystem from a 
> small size. We could have picked this up earlier with a warning from 
> resize2fs; eg. if the block size will no longer match the one that would 
> be chosen by default. That would pick it up before anyone puts 1Kb block 
> size into production.
> 
> Thanks for identifying the issue.
> 
> -- 
> Mark
> 
> 
> From 8604c50be77a4bc56a91099598c409d5a3c1fdbe Mon Sep 17 00:00:00 2001
> From: Mark Hills <mark@xwax.org>
> Date: Sat, 13 Nov 2021 11:46:50 +0000
> Subject: [PATCH] Block size has an effect on the index size
> 
> ---
> fs/ext4/namei.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index f3bbcd4efb56..8965bed4d7ff 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2454,8 +2454,9 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>        }
>        if (add_level && levels == ext4_dir_htree_level(sb)) {
>            ext4_warning(sb, "Directory (ino: %lu) index full, "
> -                     "reach max htree level :%d",
> -                     dir->i_ino, levels);
> +                     "reach max htree level :%d"
> +                     "with block size %lu",
> +                     dir->i_ino, levels, sb->s_blocksize);
>            if (ext4_dir_htree_level(sb) < EXT4_HTREE_LEVEL) {
>                ext4_warning(sb, "Large directory feature is "
>                         "not enabled on this "
> -- 
> 2.33.1

  reply	other threads:[~2021-11-13 17:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 19:52 Maildir quickly hitting max htree Mark Hills
     [not found] ` <36FABD31-B636-4D94-B14D-93F3D2B4C148@dilger.ca>
2021-11-13 12:05   ` Mark Hills
2021-11-13 17:19     ` Andreas Dilger [this message]
2021-11-16 17:52       ` Mark Hills
2021-11-14 17:44     ` Theodore Ts'o
2021-11-16 19:31       ` Mark Hills
2021-11-17  5:20         ` Theodore Ts'o
2021-11-17 13:13           ` Mark Hills

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=82C9B126-527B-4D41-8E01-84C560E06A3F@dilger.ca \
    --to=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mark@xwax.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 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.