linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* unlink directory with files (rm -d)
       [not found] <CAJ1PRS=9obyg-FRq=V6pZ7J=tccYA_UXWvNzF-6SaywL6rBY9g@mail.gmail.com>
@ 2011-08-13 21:59 ` krzf83@gmail.com 
  2011-08-14  8:03   ` Sergei Trofimovich
  2011-08-15 15:58   ` Chris Mason
  0 siblings, 2 replies; 5+ messages in thread
From: krzf83@gmail.com  @ 2011-08-13 21:59 UTC (permalink / raw)
  To: linux-btrfs

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unlink directory with files (rm -d)
  2011-08-13 21:59 ` unlink directory with files (rm -d) krzf83@gmail.com 
@ 2011-08-14  8:03   ` Sergei Trofimovich
  2011-08-14 14:18     ` krzf83@gmail.com 
  2011-08-15 15:58   ` Chris Mason
  1 sibling, 1 reply; 5+ messages in thread
From: Sergei Trofimovich @ 2011-08-14  8:03 UTC (permalink / raw)
  To: krzf83@gmail.com ; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]

> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unlink directory with files (rm -d)
  2011-08-14  8:03   ` Sergei Trofimovich
@ 2011-08-14 14:18     ` krzf83@gmail.com 
  2011-08-14 14:20       ` krzf83@gmail.com 
  0 siblings, 1 reply; 5+ messages in thread
From: krzf83@gmail.com  @ 2011-08-14 14:18 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: linux-btrfs

Not in all cases you can plan and predict where there will be need for
deleting large number of files. Also subvolumes are difficult to
maintain, not to mention still quite buggy.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unlink directory with files (rm -d)
  2011-08-14 14:18     ` krzf83@gmail.com 
@ 2011-08-14 14:20       ` krzf83@gmail.com 
  0 siblings, 0 replies; 5+ messages in thread
From: krzf83@gmail.com  @ 2011-08-14 14:20 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: linux-btrfs

And besides deleting is transparent for any programming language and
can be done with no special permissions, while subvolume deletion or
creation is of course not.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unlink directory with files (rm -d)
  2011-08-13 21:59 ` unlink directory with files (rm -d) krzf83@gmail.com 
  2011-08-14  8:03   ` Sergei Trofimovich
@ 2011-08-15 15:58   ` Chris Mason
  1 sibling, 0 replies; 5+ messages in thread
From: Chris Mason @ 2011-08-15 15:58 UTC (permalink / raw)
  To: krzf83@gmail.com; +Cc: linux-btrfs

Excerpts from krzf83@gmail.com's message of 2011-08-13 17:59:34 -0400:
> 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'm afraid the huge IO traffic is required in order to find the files in
the directory and free all the blocks reference by those files.

-chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-08-15 15:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAJ1PRS=9obyg-FRq=V6pZ7J=tccYA_UXWvNzF-6SaywL6rBY9g@mail.gmail.com>
2011-08-13 21:59 ` unlink directory with files (rm -d) krzf83@gmail.com 
2011-08-14  8:03   ` Sergei Trofimovich
2011-08-14 14:18     ` krzf83@gmail.com 
2011-08-14 14:20       ` krzf83@gmail.com 
2011-08-15 15:58   ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).