On Fri, Jul 15, 2016 at 04:21:31PM -0700, Eric Wheeler wrote: > Hello all, > > We do btrfs subvolume snapshots over time for backups. I would like to > traverse the files in the subvolumes and find the total unique chunk count > to calculate total space for a set of subvolumes.
btrfs fi du may help here. Alternatively, qgroups should be able to tell you for groups of subvols, if it's set up correctly. You shouldn't need to implement this at a low level yourself... > This sounds kind of like the beginning of what a deduplicator would do, > but I just want to count the blocks, so no submission for deduplication. > I started looking at bedup and other deduplicator code, but the answer to > this question wasn't obvious (to me, anyway). > > Questions: > > Is there an ioctl (or some other way) to get the block device offset for a > file (or file offset) so I can count the unique occurances? This is very much an X/Y question. There already exist a couple of things that are at least close to the thing you actually want to do. :) Hugo. > What API documentation should I review? > > Can you point me at the ioctl(s) that would handle this? > > > Thank you for your help! > > -- Hugo Mills | Reintarnation: Coming back from the dead as a hugo@... carfax.org.uk | hillbilly http://carfax.org.uk/ | PGP: E2AB1DE4 |
signature.asc
Description: Digital signature