Re: Data Deduplication with the help of an online filesystem check

Chris Mason
2009-04-29T14:31:52Z

On Wed, 2009-04-29 at 15:58 +0200, Thomas Glanzmann wrote:
> Hello Chris,
>
> > But, in your ioctls you want to deal with [file, offset, len], not
> > directly with block numbers. COW means that blocks can move around
> > without you knowing, and some of the btrfs internals will COW files in
> > order to relocate storage.
>
> > So, what you want is a dedup file (or files) where your DB knows a given
> > offset in the file has a given csum.
>
> how do I track if a certain block has already been deduplicated?
>

Your database should know, and the ioctl could check to see if the
source and destination already point to the same thing before doing
anything expensive.

> So, if I only have file, offset, len and not the block number, is there
> a way from userland to tell if two blocks are already point to the same
> block?

You can use the fiemap ioctl.

-chris