From: Christoph Hellwig <hch@infradead.org>
To: Demi Marie Obenour <demiobenour@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Can the output of FIEMAP on BTRFS be used to check if a file and its reflink copy might have diverged?
Date: Mon, 22 Sep 2025 09:48:04 -0700 [thread overview]
Message-ID: <aNF9xH30pAEq5y4r@infradead.org> (raw)
In-Reply-To: <a697548b-cc40-4275-9da1-3b29351654f0@gmail.com>
On Sun, Sep 21, 2025 at 08:07:10PM -0400, Demi Marie Obenour wrote:
> Wyng Backup (https://codeberg.org/tasket/wyng-backup) relies on FIEMAP
> to determine which parts of a file have not changed since it was last
> backed up. Specifically, the output of filefrag -v is passed to sort and
> then to uniq, and differences between the outputs for the file and
> the previous version (a reflink copy) determine what gets backed up.
>
> Is this safe under BTRFS, or can it result in data loss due to data
> not being backed up that should be? In other words, can it result
> in data being considered unchanged when it really is?
This is not safe with any file system. FIEMAP is purely a debugging
interface, and the output may or may not correspond to physical
block numbers. E.g. for btrfs it points to virtual space, for XFS
it can point to the RT device. It also is racy against file I/O.
The idea of that tool looks nice, but without a proper kernel interface
to look at the relationship between two files in a way that is locked
against I/O it is fundamentally unsafe.
next prev parent reply other threads:[~2025-09-22 16:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 0:07 Can the output of FIEMAP on BTRFS be used to check if a file and its reflink copy might have diverged? Demi Marie Obenour
2025-09-22 0:50 ` Qu Wenruo
2025-09-22 18:24 ` Demi Marie Obenour
2025-09-22 21:38 ` Qu Wenruo
2025-09-22 16:48 ` Christoph Hellwig [this message]
2025-09-22 17:18 ` Demi Marie Obenour
2025-09-22 17:20 ` Christoph Hellwig
2025-09-22 17:30 ` Demi Marie Obenour
2025-09-22 17:31 ` Christoph Hellwig
2025-09-22 17:54 ` Demi Marie Obenour
2025-09-29 8:50 ` Christoph Hellwig
2025-09-29 23:56 ` Demi Marie Obenour
2025-09-30 1:34 ` Demi Marie Obenour
2025-10-03 7:45 ` Christoph Hellwig
2025-09-22 23:25 ` Chris Laprise
2025-09-29 8:49 ` Christoph Hellwig
2025-09-29 23:55 ` Demi Marie Obenour
2025-10-03 7:44 ` Christoph Hellwig
2025-10-04 1:09 ` Demi Marie Obenour
2025-10-04 1:43 ` Chris Laprise
2025-10-04 4:51 ` Christoph Hellwig
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=aNF9xH30pAEq5y4r@infradead.org \
--to=hch@infradead.org \
--cc=demiobenour@gmail.com \
--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).