linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Mamedov <rm@romanrm.net>
To: linux-btrfs@vger.kernel.org
Subject: Checking if two files share extents
Date: Thu, 28 Apr 2016 19:33:39 +0500	[thread overview]
Message-ID: <20160428193339.6eb251cd@natsu> (raw)

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

Hello,

I'm writing a simple custom deduplication script, and faced a problem with how
to make it skip already deduped files. E.g., if I do

  cp -a --reflink fileA fileB

...after this, how to check if fileA and fileB refer to the same extents on
disk? I tried comparing the outputs of "filefrag -e", but this doesn't seem to
be very reliable (and e.g. instantly after such copying and until some time
later, the extent maps WILL differ).

The script I'm writing is in a scripting language, so ideally this should be
obtainable via some command-line text based tool, without kernel API calls or
the like.

Perhaps ideally something that would print a list of a given file's extents
with their absolute block numbers. Looked at what's available in "btrfs
inspect", but there doesn't seem to be any command of that sort.

-- 
With respect,
Roman

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

                 reply	other threads:[~2016-04-28 14:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160428193339.6eb251cd@natsu \
    --to=rm@romanrm.net \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).