[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: reading an empty directory after reboot is very slow



Henrique de Moraes Holschuh wrote:
> 2. unmount filesystem and run e2fsck -D on it every so often.

Every so often?  That phrase roused my interest.  Wouldn't exactly
once be enough?

I think there are two issues under discussion.  One is if dir_index
has been applied.  For that once would be enough.

The second issue is reducing the size of the directory.  I tried a
test using ext4 and e2fsck -D and e2fsck -D did not reduce the size of
the directory.  Maybe I didn't push the size large enough.

  for i in $(seq -w 1 10000); do touch $i;done
  for i in $(seq -w 1 10000); do rm -f $i;done
  drwxr-xr-x 2 root root 229376 Apr 15 13:52 junk

Then unmounted the file system and ran e2fsck -D upon it.

  # fsck -D /dev/v1/test
  fsck from util-linux 2.25.2
  e2fsck 1.42.12 (29-Aug-2014)
  /dev/mapper/v1-test: clean, 13/25688 files, 9121/102400 blocks

This produced no change in that directory size.  It does not appear to
me that e2fsck -D compacts existing empty directories.

I am not immediately sure how to create a new ext file system without
dir_index.  Otherwise I would do a quick test to verify that it does
actually add dir_index to existing directories.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: