Status update - quotas and option handling
Added 2018-12-27 15:06:10 +0000 UTCOption handling improvements: There's a single master list of option in opts.h, and that list is now used by bcachefs format as well, including for bcachefs format --help. This is a nice usability improvement - it means options are always specified the same way anywhere they can be used, and it means the helptext is always going to be consistent with the actual options.
The next thing we should do is use opts.h for generating a man page - if anyone wants to take that one on that would be a really useful project.
Also, I've been making some improvements to the per-inode options. It's already been the case that the per-inode options were all inherited from the parent directory on create - the idea being that if you set an option on a directory, you want it to apply to everything in that directory. Now, we're also attempting to keep those options on directory contents consistent with the directory: on rename, we're updating the options on the file being renamed with the options from the new parent directory (this also requires that we track whether an option was explicitly set or inherited, so we're tracking that now). If a directory is being renamed and its options would have to change, we don't want to be recursively updating options on all the children within the kernel (that would mean the rename syscall would have to do an unbounded amount of work) - so instead we return -EXDEV, and the mv command should fall back to renaming one file at a time.
For setting options on existing directories and propagating them to all the children of that directory, there's a new bcachefs setattr command:
bcachefs setattr --compression=lz4 /mnt/foo
This works just like using the extended attribute interface, i.e.
setfattr -n bcachefs.compression -v lz4 /mnt/foo
But the bcachefs setattr command also uses an ioctl to recurse through all the children and propagate the options being set, but without marking it as explicitly set (so that rename knows it should be inherited from the parent directory).
The motivation for this work on options has been for improved directory quota support. bcachefs supports project quotas, like xfs and ext4, but project quotas are a poor substitute for directory quotas. The way project quotas work is they add another inode field (project ID, much like UID and GID), and then you can assign quotas for a given project ID. But there's a lot of problems with this approach, so I may rip out project quotas and just do directory quotas right at some point in the future (but it'd be a lot of work, so it's not a terribly high priority).
Comments
"""so instead we return -EXDEV, and the mv command should fall back to renaming one file at a time""" which means the operation is no longer atomic within a mount point and mv could potentially fail in the middle of it with just half the children moved.
2018-12-28 08:18:37 +0000 UTCThanks for these status updates, it's always a pleasure to hear about bcachefs :)
tuxayo
2018-12-27 18:11:34 +0000 UTC