Re: unlink directory with files (rm -d)
From: Sergei Trofimovich <hidden>
Date: 2011-08-14 08:03:04
Attachments
- signature.asc [application/pgp-signature] 198 bytes
From: Sergei Trofimovich <hidden>
Date: 2011-08-14 08:03:04
I wonder if it would be possible to implement instant unlinking directory with files in it. Since btrfs is based on b trees it could be possible. Filesystem would have to "loose" all information on directory and object in it, and allow overwriting this information. This would be great feature, because everyone knows that recursive deleting large directories, with milions of files require huge io traffic.
I think you'll have to read directory contents anyway in order not to break permission/vfs-mountpoint/attributes violation. Consider the following example: # it's me $ id uid=1000(slyfox) gid=100(users) # fun layout $ ls -ld test test/root_o test/root_o/root_o drwxr-xr-x 3 slyfox users 60 Aug 14 10:56 test drwxr-xr-x 2 root root 60 Aug 14 10:56 test/root_o -rw-r--r-- 1 root root 0 Aug 14 10:56 test/root_o/root_o $ rm -rf test/ rm: cannot remove `test/root_o/root_o': Permission denied We can't delete it because of foreigner in our dir. -- Sergei