Use Btrfs Generations To Speed Up Scan On Startup


Recommended Posts

It would be really nice if btsync could utilize btrfs generations to quickly refresh its internal database upon startup.


Btrfs, being a copy-on-write filesystem, have built-in features to quickly list changes to the file system since a given point in time (generation)




root@skytown:/storage/media# btrfs subvolume show  .
Name: media
uuid: 6cde316a-1cad-4f41-a718-30a45292f9b6
Parent uuid: -
Creation time: 2014-05-04 07:15:24
Object ID: 257
Generation (Gen): 959
Gen at creation: 6
Parent: 5
Top Level: 5
Flags: -
We're currently at generation 959, then i write to a file.
 root@skytown:/storage/media# echo foo > Music/Other/test
After the transaction have committed (which it always does after 30 seconds, or due to sync() or umount, etc) we can query the filesystem for files that have changed since (a very fast operation compared to scanning the entire hierarchy) :
root@skytown:/storage/media# btrfs subvolume find-new . 959
inode 65807 file offset 0 len 4 disk start 0 offset 0 gen 1021 flags INLINE Music/Other/test
transid marker was 1021
and we are now at generation 1021.
I think it would be possible for btsync to utilize the btrfs generations to quickly refresh its internal state rather than having to scan the entire filesystem on startup.
Please consider adding support for this, it would be super awesome.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.