ostreedev / ostree

Operating system and container binary deployment and upgrades
https://ostreedev.github.io/ostree/
Other
1.27k stars 291 forks source link

Support faster dir diffing via xattr #1224

Open cgwalters opened 6 years ago

cgwalters commented 6 years ago

For rpm-ostree ex livefs we currently deal with both the commit tree and the "live" tree (and actually the rpm database diff, but that's not related here). Normally with libostree, a commit tree and a live tree are identical.

But ex livefs is all about breaking that barrier - for example, we want the ability to cherry-pick just a subset of changes (perhaps just a new package). And further, we need to handle the case where things were interrupted. In the latter case in particular, we could try to re-lift the transient state back to a commit but...that feels ugly.

I think the livefs logic would be a lot better if we mostly dealt with checked-out paths. Then we can handle the interrupted case more easily. But, it'd be very helpful to have the ability to quickly determine when two directories are identical.

I propose we optionally stick an ostree.dirtree xattr on our checked out directories which has its dirtree hash. At that point we can add a fast non-GFile based diff.

jlebon commented 6 years ago

Can you flesh this out a bit more on this? Would libostree learn to scrub out (or recalculate?) ostree.dirtree prior to linking new files when doing the subpath checkout into /usr?

cgwalters commented 6 years ago

Yeah, we'd need to scrub the xattr whenever we modify a directory.