[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'rm -r dir' performance improvement when removing symlinks, or root
From: |
Jim Meyering |
Subject: |
Re: 'rm -r dir' performance improvement when removing symlinks, or root |
Date: |
Sun, 25 Mar 2007 09:54:47 +0200 |
Paul Eggert <address@hidden> wrote:
> Currently 'rm -r dir' invokes three system calls for each directory
> entry removed, e.g. (on Debian stable):
>
> lstat64("/proc/self/fd/5/output.0", ...)
> access("tmp/autom4te.cache/output.0", W_OK)
> unlink("/proc/self/fd/5/output.0")
>
> If we are root, the lstat and access calls aren't needed. Also, if the
> directory entry is a symlink we needn't worry about access permissions.
>
> This can be worked around with 'rm -rf' but I kind of like using 'rm
> -r' when I'm root, since it's a bit more cautious and prints more
> diagnostics when there are trouble. So I'd like 'rm -r' to be fast
> too.
>
> Here's a proposed patch.
Nice work. Committed.
Thanks!