On Mon, Aug 05, 2019 at 09:19:42AM -0400, Josef Bacik wrote: > In testing block group removal it's sometimes handy to be able to create > block groups on demand. Add an ioctl to allow us to force allocation > from userspace. For debugging and testing purposes that's possible to add, but certainly not as a high-level command of 'btrfs filesystem'. > +#define BTRFS_IOC_ALLOC_CHUNK _IOR(BTRFS_IOCTL_MAGIC, 63, __u64) >From interface POV, this is wrong on several levels. * it addresses a single narrow usecase * the parameters are non-extensible so when you're going to need one more u64 next week or month, it'll cost another ioctl, but this one has to stay forever * ioctl for debugging is not always the best interface (sysfs was suggested) It would help if you explain the 'sometimes handy' in more detail otherwise I'm going to be suspecting the usecase is not to help debugging but to paper over inefficient chunk allocator behaviour. I hope I'm wrong on that one but user interest under the patch shows otherwise. Regarding the points above, the sysfs is IMO more suitable: * single file representing a command to the filesystem is fine for a narrow usecase, ie. 'echo metadata > /sys/fs/btrfs/UUID/debug/force_chunk_alloc' is acceptable for testing * string-based commands are extensible, as long as we pass eg. key=value
