All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolinux.com>
To: Steven Van Acker <deepstar@ulyssis.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: ext2 directory size bug (?)
Date: Thu, 30 Nov 2000 00:20:34 -0700 (MST)	[thread overview]
Message-ID: <200011300720.eAU7KYT28277@webber.adilger.net> (raw)
In-Reply-To: <Pine.LNX.4.21.0011300453200.31229-100000@ace.ulyssis.org> "from Steven Van Acker at Nov 30, 2000 05:17:25 am"

You write:
> Hmm, gonna try to follow the REPORTING-BUGS file here...
> 
> [1.] One line summary of the problem:
> 
>      directory size increases when adding 0-size files, 
>      but doesn't decrease when removing them.

It may or may not be considered a bug, but in any case it has been like
this for a long time and I doubt it will change.  The directory size is
not dependent upon the file size, only the length of the file names.

One "reason" why ext2 directories don't shrink when the files are deleted
is because e2fsck relies on this behaviour for the lost+found directory,
so that you don't need to allocate blocks for lost+foung on a corrupted
filesystem when doing recovery of unlinked files.

In some cases, you may have a directory entry in the last block, so you
can't free any of the earlier blocks even if they are empty.

In most cases, if you have created many files in one directory in the past,
you are likely to create many there again - so easier just to keep the
directory blocks until next time.

In most cases, the number of blocks allocated to a directory (but never
to be used again) is very small, and people don't really worry about it.
I think the scenario where you have a large amount of space in directories
that will never be used again is very unusual and should not be a reason
to make the code more complex.

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2000-11-30  7:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-30  4:17 ext2 directory size bug (?) Steven Van Acker
2000-11-30  7:20 ` Andreas Dilger [this message]
2000-11-30 13:24 ` Richard B. Johnson
2000-12-02  4:57   ` Chris Wedgwood
2000-12-02  5:14     ` Alexander Viro
2000-12-02  5:30       ` Chris Wedgwood
2000-12-02  5:42         ` Alexander Viro
2000-12-02  9:14           ` Kai Henningsen

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=200011300720.eAU7KYT28277@webber.adilger.net \
    --to=adilger@turbolinux.com \
    --cc=deepstar@ulyssis.org \
    --cc=linux-kernel@vger.kernel.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.