From: Jan Schmidt <list.btrfs@jan-o-sch.net>
To: Thomas Koch <thomas@koch.ro>
Cc: Hugo Mills <hugo@carfax.org.uk>, linux-btrfs@vger.kernel.org
Subject: Re: check for reflink capability and for shared data
Date: Mon, 26 Aug 2013 08:42:44 +0200 [thread overview]
Message-ID: <521AF8E4.80405@jan-o-sch.net> (raw)
In-Reply-To: <20130824162013.GL3115@carfax.org.uk>
On Sat, August 24, 2013 at 18:20 (+0200), Hugo Mills wrote:
> On Sat, Aug 24, 2013 at 06:09:58PM +0200, Thomas Koch wrote:
>> Hi,
>>
>> how can I do the following in a shell script:
>>
>> - check whether my file system supports cp --reflink?
>
> touch foo; if cp --reflink=always foo bar; then ...; fi; rm -f foo bar
>
>> - check whether two files share the same data on disk, i.e. one has been
>> created by cp --reflink of the other?
>
> You can't, using simple userspace tools. I think the only way would
> be to use the tree search ioctl to inspect the extents for each file,
> and see whether any of them overlap. Why do you need to know this?
It should work with fiemap to a file in question and btrfs inspect logical to
what ever extents fiemap reported as "physical".
-Jan
next prev parent reply other threads:[~2013-08-26 6:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-24 16:09 check for reflink capability and for shared data Thomas Koch
2013-08-24 16:20 ` Hugo Mills
2013-08-26 6:42 ` Jan Schmidt [this message]
2013-08-26 9:30 ` Liu Bo
2013-08-27 1:37 ` Marios Titas
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=521AF8E4.80405@jan-o-sch.net \
--to=list.btrfs@jan-o-sch.net \
--cc=hugo@carfax.org.uk \
--cc=linux-btrfs@vger.kernel.org \
--cc=thomas@koch.ro \
/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).