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

David Sterba
Tue, 03 Sep 2013 13:41:29 -0000

On Mon, Sep 02, 2013 at 06:43:58PM +0200, David Sterba
wrote:
> > 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?

Now I''m reading more carefully, the arguments are the same as for
btrfs-extent-same that does only the simple task of deduping just one
extent, but that''s not the point behind ''btrfs dedup files
*''.

So there are 2 usecases:

1 - give it a bunch of files and try to dedup as much as possible among
    their data
2 - what btrfs-extent-same does, dedup just a specified range in 2 files

I''m not sure if #2 is going to be used widely though it would bring
some
flexibility and fine tuning, besides testing purposes.

I think it would be good to keep both modes under one command, so it''s
a
matter of a sane UI.

#2 would look like:

$ btrfs dedup files --length 4096 --src-offset 0 --dest-offset 4096 file1 file2

and fail if != 2 files are given

#1 :

$ btrfs dedup files --min-length 65536 file1 file2 file3 ...

I think we could come up with more hints like ''min-length''
based on user
requirements, but I''d like to get some agreement if this is the way to
go.

thanks,