Re: [PROGS PATCH] Import btrfs-extent-same

David Sterba
Mon, 02 Sep 2013 16:43:58 -0000

On Tue, Aug 13, 2013 at 12:35:15PM -0700, Mark Fasheh
wrote:
> > Can you (or Mark) please turn it into a subcommand of dedup? The idea
is
> > to merge both in-bound and out-bound dedup into one command, eg.
> >
> >  btrfs dedup files dir/*
>
> I can handle this - it''s pretty easy but we have to talk about
what we''re
> expecting here.

> Specifically, the btrfs-extent-same.c software is just a wrapper around the
> ioctl. It never does actual reads of the files or data comparisons, etc.
The
> syntax you describe above seems like it wants an actual "scan these
files
> and dedupe them" which is a whole other ball game.

Yes that''s what I meant and that''s what dupremove in your git
tree does,
right?

Using the EXTENT_SAME ioctl without any checks is dangerous, and that''s
what btrfs-extent-same.c does, so it''s suitable for testing but not
about to be given to users as-is.

> So I would suggest maybe something like the syhntax of btrfs-extent-same.c:
>
> btrfs dedupe files len file1 loff1 file2 loff2 ...

I''m not sure I see what ''len'' means here, length of
the dedup block?