Re: Deletion of big files...

Ralf Baechle (ralf@gnu.org)
Mon, 17 May 1999 12:32:49 +0200


On Fri, May 14, 1999 at 02:01:59PM +0200, Jorge Gonzalez Villalonga wrote:

> I have noticed that when I delete a big file (say 800MB), with a rm
> command, for example, the rm command does not return until the file has
> been deleted (or so it seems). With small files, this is almost
> inmediate, but with files which are say 800 megs in size, this can
> easily be 10 seconds (_seconds_, it's right) till I get the prompt
> again, on a P2-333.
>
> In other Unices, like IRIX, the rm command returns _inmediately_, no
> matter the size of the file.
>
> Looks to me like the unlink syscall is somewhat synchronous, and it
> shouldn't, or does it? For this concrete issue, it could be easily
> solved by the unlink syscall starting a thread to unlink the big file,
> while the rest of the system keeps running normally. But I suppose it's
> not only an issue of the unlink syscall, but more...

Actually, if you care you can use a clone(2)'ed thread for removing the
process. On Linux rm is slow at times because for large files on ext2 it
may have to read indirect / double indirect / tripple indirect pointers
blocks in order to find and free all blocks belonging to the file. More
modern file systems use extends. With the typical number of extends
being small enough to fit into the inode or one additional block the
performance of rm(2) may make rm look like performing instantaneously.

In short, it's a filesystem issue.

Ralf

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/