linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@libero.it>
To: Arvin Schnell <aschnell@suse.de>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Comparing snapshots?
Date: Fri, 25 Feb 2011 21:03:04 +0100	[thread overview]
Message-ID: <4D680AF8.5060800@libero.it> (raw)
In-Reply-To: <20110225095916.GA7609@suse.de>

On 02/25/2011 10:59 AM, Arvin Schnell wrote:
> Hi,
> 
> for a backup program I have to find all differing files
> (including metadata) in two snapshots taken from the same
> subvolume.
> 
> Having looked at the find-new command I thought about this
> process:
> 
> 1. Get the two transids when the two snapshots were created.
> 
> 2. Query modifications to the original subvolume between the two
>    transids.
> 
> Is the general process corrent or have I overseen something?

I suppose that you are thinking to something like:

- record the last trans-id (trans-id1)
- update the file-system
- [...]
- record the last trans-id (trans-id2)
- update the file-system
- [...]
- Backup all the objects which have a trans-id between (trans-id1-trans-id2]

This may lead to miss two kinds of "operations"
1) a file deletion
2) a file changed two times, the first one after the first "snapshot",
and the second one after the second snapshot.

In the first case you would not be able to find any key update between
the two trans-id(s), because they simply doesn't exist.

In the second case the trans-id associated to the object is after trans-id2.

For solving the point two you must change "Query modifications to the
original subvolume" into "Query modifications to the second snapshot".
This means that the second snapshot must exist (it is not sufficient to
know the trans-id)..

For solving the point one, it is needed to
a) track the change not only of the files but also of the directory (if
you remove a file, the timestamp of the directory inode is updated).

b) compare the update directories with the original ones. This means
that the first snapshot must exist (it is not sufficient to know the
trans-id).

I have to point out that for a backup purpose would be sufficient to
track the changed files (and not the deleted ones).

I started to develop a tool to comparing two snapshot. But I stopped
when I discovered that the ioctl BTRFS_IOC_TREE_SEARCH was not robust
enough for that: when I tried to find the changed inode, attribute,
extended attribute... I discovered that the ioctl BTRFS_IOC_TREE_SEARCH
don't work well is some corner case [*].

I even tried to propose a patch to mitigate the problem. But at the time
the develop efforts were (are) oriented to other issues, and the patch
was not merged..

However if you want to start to develop something, I can go deeper in
the problem.


[*] see the thread "Bug in the design of the tree search ioctl API ?",
http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg07523.html

> AFAIS the btrfs tool does not provide the required
> information/commands. Would it be possible to add those?
> 
> Thanks in advance,
>   Arvin
> 


      parent reply	other threads:[~2011-02-25 20:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-25  9:59 Comparing snapshots? Arvin Schnell
2011-02-25 19:32 ` João Eduardo Luís
2011-02-25 20:08   ` Goffredo Baroncelli
     [not found]     ` <4977C273-8274-4C10-A19A-B766E224A20C@gmail.com>
2011-02-25 23:26       ` Fwd: " Joao Luis
2011-02-25 20:03 ` Goffredo Baroncelli [this message]

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=4D680AF8.5060800@libero.it \
    --to=kreijack@libero.it \
    --cc=aschnell@suse.de \
    --cc=kreijack@inwind.it \
    --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).