On 2018年07月31日 21:49, Thomas Leister wrote: > Dear David, > hello everyone, > > during a recent project of mine involving LXD and BTRFS I found out that > quotas on BTRFS subvolumes are enforced, but file system usage and > limits set via quotas are not reported correctly in LXC containers. > > I've found this discussion regarding my problem: > https://github.com/lxc/lxd/issues/2180 That's not the expected usage of btrfs qgroup/quota. Quota only accounts how many bytes are used exclusively or shared between subvolumes at extent level. > > There was already a proposal to introduce subvolume quota support some > time ago: > https://marc.info/?l=linux-btrfs&m=147576434114415&w=2 It's in fact impossible if I didn't miss something. There are several technical problems in the proposal: 1) Multi-level qgroups The real limit is limited by all related qgroups, including higher level qgroup. Such design makes it pretty hard to calculation the real limit. 2) Different limitations on exclusive/shared bytes Btrfs can set different limit on exclusive/shared bytes, further complicating the problem. 3) Btrfs quota only accounts data/metadata used by the subvolume It lacks all the shared trees (mentioned below), and in fact such shared tree can be pretty large (especially for extent tree and csum tree). Only accounting quota limit would hit real ENOSPC easily IMHO. > > @David as I've seen your response on that topic on the mailing list, > maybe you can tell me if there are any plans to support correct > subvolume quota reporting e.g. for "df -h" calls from within a > container? Maybe there's already something on your / SUSE's roadmap? :-) > > As more and more container environments spin up these days, there might > be a growing demand on that :-) Personally I'd really appreciate if I > could read the current file system usage and limit from within a > container using BTRFS as storage backend. For current btrfs design, I think it's skeptical to implement such design. The main problem here is, btrfs doesn't do the full LVM work. (unlike ZFS IIRC) It doesn't really manage multiple volumes, that's why it's called subvolume in btrfs. A subvolume is not a fully usable fs, it's just a subset of a full fs. It relies on all the other trees (root tree, extent tree, chunk tree, csum tree, and quota tree in this case) to do all the work. Thus it's pretty hard to implement such special purposed df call. On the other hand, isn't easier to implement special interface for container to get real disk usage/limit other than using the old vanilla df interface? Thanks, Qu > > Best regards, > Thomas > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html >
Attachment:
signature.asc
Description: OpenPGP digital signature
