문제는왜디렉터리 항목을 삭제한 후 디렉터리가 축소됩니까? ext4
디렉터리 메타데이터를 보존하도록 파일 시스템이 구성된 방식 때문입니까 ? 분명히 디렉터리를 삭제하고 다시 만드는 것은 원래 inode를 삭제하고 새 inode를 만드는 것이므로 해결책이 아닙니다. 수량을 수동으로 줄이려면 어떤 조치를 취해야 합니까?
답변1
개발자의 말을 인용하자면(리눅스 커널 스레드에서많은 수의 파일을 삭제한 후에도 ext3/ext4 디렉토리가 줄어들지 않습니다.):
On Thu, May 14, 2009 at 08:45:38PM -0400, Timo Sirainen wrote:
>
> I was rather thinking something that I could run while the system was
> fully operational. Otherwise just moving the files to a temp directory +
> rmdir() + rename() would have been fine too.
>
> I just tested that xfs, jfs and reiserfs all shrink the directories
> immediately. Is it more difficult to implement for ext* or has no one
> else found this to be a problem?
It's probably fairest to say no one has thought it worth the effort.
It would require some fancy games to swap out block locations in the
extent trees (life would be easier with non-extent-using inodes), and
in the case of htree, we would have to keep track of the index block
so we could remove it from the htree index. So it's all doable, if a
bit tricky in terms of the technical details; it's just that the
people who could do it have been busy enough with other things.
It's hasn't been considered high priority because most of the time
directories don't go from holding thousands of files down to a small
handful.
- Ted