linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Claudius Heine <ch@denx.de>
To: linux-btrfs@vger.kernel.org
Cc: Henning Schild <henning.schild@siemens.com>
Subject: btrfs-send format that contains binary diffs
Date: Mon, 29 Mar 2021 15:16:47 +0200	[thread overview]
Message-ID: <f3306b7c-a97a-21f2-0f66-dc94dc2c0272@denx.de> (raw)

Hi,

I am currently investigating the possibility to use `btrfs-stream` files 
(generated by `btrfs send`) for deploying a image based update to 
systems (probably embedded ones).

One of the issues I encountered here is that btrfs-send does not use any 
diff algorithm on files that have changed from one snapshot to the next.

One way to implement this would be to add some sort of 'patch' command 
to the `btrfs-stream` format.

Is this something upstream would be interested in?

Lets say we introduce a new `btrfs-send` format, lets call it 
`btrfs-delta-stream`, which could can be created from a `btrfs-stream`:

1. For all `write` commands, check the requirements:
    - Does the file already exists in the old snapshot?
    - Is the file smaller than xMiB (this depends on the diff-algo and 
the available resources)
2. If the file fulfills those requirements, replace 'write' command with 
'patch' command, and calculate the binary delta.  Also check if the 
delta is actually smaller than the data of the new file.  Possible add 
the used binary diff algo as well as a checksum of the 'old' file to the 
command as well.

This file format can of course be converted back to `btrfs-stream` and 
then applied with `btrfs-receive`.

I would probably start with `bsdiff` for the diff algorithm, but maybe 
we want to be flexible here.

Of course if `btrfs-delta-stream` is implemented in `btrfs-progs` then, 
we can create and apply this format directly.

regards,
Claudius

             reply	other threads:[~2021-03-29 13:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 13:16 Claudius Heine [this message]
2021-03-29 16:30 ` btrfs-send format that contains binary diffs Andrei Borzenkov
2021-03-29 17:25   ` Henning Schild
2021-03-29 18:00     ` Martin Raiber
2021-03-29 19:25       ` Claudius Heine
2021-03-29 19:14   ` Claudius Heine
2021-03-29 19:53     ` Lionel Bouton
2021-03-30  7:48       ` Claudius Heine
2021-03-30  5:33     ` Andrei Borzenkov
2021-03-30  5:38       ` Andrei Borzenkov
2021-03-30  8:12         ` Claudius Heine
2021-03-30 16:32           ` Henning Schild
2021-03-31  1:17           ` Zygo Blaxell

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=f3306b7c-a97a-21f2-0f66-dc94dc2c0272@denx.de \
    --to=ch@denx.de \
    --cc=henning.schild@siemens.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).