[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPXz4EN8Tty5bdwrkbj79eVSZNWh5J-QWs-vfGhNXHec4yEbXw@mail.gmail.com>
Date: Tue, 11 Jun 2024 06:26:36 -0700
From: Nic Bretz <bretznic@...il.com>
To: Andreas Dilger <adilger@...ger.ca>
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>,
Harshad Shirwadkar <harshadshirwadkar@...il.com>
Subject: Re: stat Size and Blocks numbers don't decrease after deletion
On Mon, Jun 10, 2024 at 1:55 PM Andreas Dilger <adilger@...ger.ca> wrote:
>
> On Jun 7, 2024, at 10:25 AM, Nic Bretz <bretznic@...il.com> wrote:
> >
> > When I create a new directory and new files in it, I see its size and
> > blocks increase when running stat. After deleting all files, the size
> > and blocks of the directory don't decrease in stat.
>
> Correct, ext4 does not shrink directories after they have been populated.
> There was a patch series at https://patchwork.ozlabs.org/project/linux-ext4/patch/20190821182740.97127-1-harshadshirwadkar@gmail.com/ that fell
> into a crack and was never landed. However, I think that patch would
> still be interesting to revive.
>
> > I was thinking that ext4 runs defragmentation in the background and
> > eventually those two numbers will decrease. It looks like they don't.
>
> No, ext4 does not do any kind of automatic background scanning or
> filesystem changes. You can run (offline) "e2fsck -fD" if there is
> a big problem with large empty directories.
>
> Cheers, Andreas
>
Thank you for taking the time to explain this. I was thinking to
possibly start looking into this, but if there is already a patch,
I'll study that.
Nic
Powered by blists - more mailing lists