Hello, I use btrfs for containers (e.g. full OS style containers using lxc/lxd etc. rather than application containers). btrfs de-duplication and send/receive are very useful features for this use-case.
Each container runs in its own subvolume, and I use quotas to stop one container exhausting the disk space of the others. df shows the total space + free space for the entire filesystem - which is confusing for users within the containers. Worse - they don't have any way of knowing how much quota they actually have left (other than du -xs / vs. whatever I've told them). It'd be really nice if running e.g. statfs("/home", ...) within a container could be made to return the qgroup usage + limit for the path (e.g. by passing in an option at mount time - such as qgroup level maybe?) , instead of the global filesystem data in f_bfree f_blocks etc. A useful tweak might be to only return the qgroup info within non-root user namespaces, or perhaps just if the root UID != 0 (since the normal use case for this is unprivileged containers), but I've no idea how viable that idea is. Yet another idea - (since btrfs always returns 0 for f_files - used for inodes by other FS), then perhaps having the option of returning quota information there would be useful (or maybe return quota referenced size info in f_blocks and f_bfree, and exclusive size info in f_files and f_free)? Googling shows that this question has come up briefly on the #btrfs IRC channel in the past. Does sound like something that could be added to btrfs? What I need to do currently only works with zfs, but I don't really want to go there if I can avoid it... ref: search for btrfs in this web page: https://www.stgraber.org/2016/03/26/lxd-2-0-resource-control-412/ ... the shown working example is on zfs... Tim. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html